Skip to content

Commit d976f2f

Browse files
committed
Merge branch 'change/improve_hp_uarts_wakeup_ci_test' into 'master'
change(driver_uart): change hp uart wakeup ci test to enhance the pass rate Closes IDFCI-2871 See merge request espressif/esp-idf!38752
2 parents 3f2f57a + 4b9001a commit d976f2f

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

components/esp_driver_uart/test_apps/uart/main/test_hp_uart_wakeup.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
#define SLAVE_UART_RX_IO_NUM DEFAULT_UART1_TX_IO_NUM
6262
#define UART_BAUD_RATE (115200)
6363
#define BUF_SIZE (1024)
64-
#define TIMER_WAKEUP_TIME_US (5 * 100 * 1000)
64+
#define TIMER_WAKEUP_TIME_US (1 * 100 * 1000)
6565

6666
static void force_stdout(void)
6767
{
@@ -139,14 +139,16 @@ void send_and_verify_recived_data(const char* message, uint8_t length, bool shou
139139

140140
uart_flush_input(MASTER_UART_NUM);
141141
uart_write_bytes(MASTER_UART_NUM, message, length);
142-
143-
char *data = (char *) malloc(BUF_SIZE);
144-
int len = uart_read_bytes(MASTER_UART_NUM, data, (BUF_SIZE - 1), 1000 / portTICK_PERIOD_MS);
142+
/* Wait for uart write finish */
143+
uart_wait_tx_idle_polling(MASTER_UART_NUM);
145144

146145
bool wake_up_detected = false;
147146
const char *target = "Wakeup OK!";
148147
int target_len = 11;
149148
bool match = true;
149+
char *data = (char *) malloc(BUF_SIZE);
150+
int len = uart_read_bytes(MASTER_UART_NUM, data, target_len, 5000 / portTICK_PERIOD_MS);
151+
150152
if (len > 0) {
151153
if (len != target_len) {
152154
match = false;
@@ -207,8 +209,11 @@ static void enter_sleep_and_send_respond(void)
207209
/* Get timestamp after waking up from sleep */
208210
int64_t t_after_us = esp_timer_get_time();
209211

212+
/* Clear uart input buffer */
210213
uart_flush_input(SLAVE_UART_NUM);
211214
printf("sleep duration: %lld\n", t_after_us - t_before_us);
215+
216+
/* Determine the reason for uart wakeup */
212217
switch (esp_sleep_get_wakeup_cause()) {
213218
case ESP_SLEEP_WAKEUP_UART:
214219
/* Hang-up for a while to switch and execute the uart task

components/esp_driver_uart/test_apps/uart/pytest_uart.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ def test_uart_single_dev(case_tester) -> None: # type: ignore
3737
assert uart_ports, f"Error: Chip type '{chip_type}' is not defined in input_argv. Aborting..."
3838

3939
for case in case_tester.test_menu:
40-
if 'hp-uart-only' not in case.groups and 'wakeup' not in case.groups:
40+
if 'wakeup' in case.groups:
41+
# multi-dev cases, skip on generic runner
42+
continue
43+
44+
if 'hp-uart-only' not in case.groups:
4145
for uart_port in uart_ports:
4246
dut.serial.hard_reset()
4347
dut._get_ready()
@@ -46,7 +50,7 @@ def test_uart_single_dev(case_tester) -> None: # type: ignore
4650
dut.expect("select to test 'uart' or 'lp_uart' port", timeout=10)
4751
dut.write(f'{uart_port}')
4852
dut.expect_unity_test_output()
49-
elif 'wakeup' not in case.groups:
53+
else:
5054
dut._run_normal_case(case, reset=True)
5155

5256

0 commit comments

Comments
 (0)