change(esp_driver_uart): change ci test to improve the pass rate for hp uart wakeup

This commit is contained in:
Li Shuai
2025-04-25 15:56:20 +08:00
committed by BOT
parent d83995106e
commit 4b9001a84c
2 changed files with 15 additions and 6 deletions

View File

@ -61,7 +61,7 @@
#define SLAVE_UART_RX_IO_NUM DEFAULT_UART1_TX_IO_NUM
#define UART_BAUD_RATE (115200)
#define BUF_SIZE (1024)
#define TIMER_WAKEUP_TIME_US (5 * 100 * 1000)
#define TIMER_WAKEUP_TIME_US (1 * 100 * 1000)
static void force_stdout(void)
{
@ -139,14 +139,16 @@ void send_and_verify_recived_data(const char* message, uint8_t length, bool shou
uart_flush_input(MASTER_UART_NUM);
uart_write_bytes(MASTER_UART_NUM, message, length);
char *data = (char *) malloc(BUF_SIZE);
int len = uart_read_bytes(MASTER_UART_NUM, data, (BUF_SIZE - 1), 1000 / portTICK_PERIOD_MS);
/* Wait for uart write finish */
uart_wait_tx_idle_polling(MASTER_UART_NUM);
bool wake_up_detected = false;
const char *target = "Wakeup OK!";
int target_len = 11;
bool match = true;
char *data = (char *) malloc(BUF_SIZE);
int len = uart_read_bytes(MASTER_UART_NUM, data, target_len, 5000 / portTICK_PERIOD_MS);
if (len > 0) {
if (len != target_len) {
match = false;
@ -207,8 +209,11 @@ static void enter_sleep_and_send_respond(void)
/* Get timestamp after waking up from sleep */
int64_t t_after_us = esp_timer_get_time();
/* Clear uart input buffer */
uart_flush_input(SLAVE_UART_NUM);
printf("sleep duration: %lld\n", t_after_us - t_before_us);
/* Determine the reason for uart wakeup */
switch (esp_sleep_get_wakeup_cause()) {
case ESP_SLEEP_WAKEUP_UART:
/* Hang-up for a while to switch and execute the uart task

View File

@ -37,7 +37,11 @@ def test_uart_single_dev(case_tester) -> None: # type: ignore
assert uart_ports, f"Error: Chip type '{chip_type}' is not defined in input_argv. Aborting..."
for case in case_tester.test_menu:
if 'hp-uart-only' not in case.groups and 'wakeup' not in case.groups:
if 'wakeup' in case.groups:
# multi-dev cases, skip on generic runner
continue
if 'hp-uart-only' not in case.groups:
for uart_port in uart_ports:
dut.serial.hard_reset()
dut._get_ready()
@ -46,7 +50,7 @@ def test_uart_single_dev(case_tester) -> None: # type: ignore
dut.expect("select to test 'uart' or 'lp_uart' port", timeout=10)
dut.write(f'{uart_port}')
dut.expect_unity_test_output()
elif 'wakeup' not in case.groups:
else:
dut._run_normal_case(case, reset=True)