forked from espressif/esp-idf
fix(esp_hw_support): add delay to wait chip enter sleep in ut
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
@@ -38,9 +38,13 @@ static int process_sleep(int argc, char **argv)
|
|||||||
|
|
||||||
if (sleep_args.mode->count == 1) {
|
if (sleep_args.mode->count == 1) {
|
||||||
if (sleep_args.mode->ival[0] == 0) {
|
if (sleep_args.mode->ival[0] == 0) {
|
||||||
|
ESP_LOGI(TAG, "enter light sleep");
|
||||||
|
fflush(stdout);
|
||||||
|
fsync(fileno(stdout));
|
||||||
esp_light_sleep_start();
|
esp_light_sleep_start();
|
||||||
ESP_LOGI(TAG, "esp_light_sleep_start");
|
ESP_LOGI(TAG, "wakeup from lightsleep");
|
||||||
} else if (sleep_args.mode->ival[0] == 1) {
|
} else if (sleep_args.mode->ival[0] == 1) {
|
||||||
|
ESP_LOGI(TAG, "enter deep sleep");
|
||||||
esp_deep_sleep_start();
|
esp_deep_sleep_start();
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, "no valid arguments");
|
ESP_LOGE(TAG, "no valid arguments");
|
||||||
@@ -128,7 +132,7 @@ static void register_ext1_wakeup(void)
|
|||||||
|
|
||||||
const esp_console_cmd_t cmd = {
|
const esp_console_cmd_t cmd = {
|
||||||
.command = "ext1",
|
.command = "ext1",
|
||||||
.help = "configue ext1 wakeup",
|
.help = "configure ext1 wakeup",
|
||||||
.hint = NULL,
|
.hint = NULL,
|
||||||
.func = &process_ext1_wakeup,
|
.func = &process_ext1_wakeup,
|
||||||
.argtable = &ext1_wakeup_args
|
.argtable = &ext1_wakeup_args
|
||||||
@@ -202,7 +206,7 @@ static void register_rtcio_wakeup(void)
|
|||||||
|
|
||||||
const esp_console_cmd_t cmd = {
|
const esp_console_cmd_t cmd = {
|
||||||
.command = "rtcio",
|
.command = "rtcio",
|
||||||
.help = "configue rtcio wakeup",
|
.help = "configure rtcio wakeup",
|
||||||
.hint = NULL,
|
.hint = NULL,
|
||||||
.func = &process_rtcio_wakeup,
|
.func = &process_rtcio_wakeup,
|
||||||
.argtable = &rtcio_wakeup_args
|
.argtable = &rtcio_wakeup_args
|
||||||
@@ -277,7 +281,7 @@ static void register_gpio_wakeup(void)
|
|||||||
|
|
||||||
const esp_console_cmd_t cmd = {
|
const esp_console_cmd_t cmd = {
|
||||||
.command = "gpio",
|
.command = "gpio",
|
||||||
.help = "configue gpio wakeup",
|
.help = "configure gpio wakeup",
|
||||||
.hint = NULL,
|
.hint = NULL,
|
||||||
.func = &process_gpio_wakeup,
|
.func = &process_gpio_wakeup,
|
||||||
.argtable = &gpio_wakeup_args
|
.argtable = &gpio_wakeup_args
|
||||||
@@ -336,7 +340,7 @@ static void register_gpio_control(void)
|
|||||||
|
|
||||||
const esp_console_cmd_t cmd = {
|
const esp_console_cmd_t cmd = {
|
||||||
.command = "gpio_control",
|
.command = "gpio_control",
|
||||||
.help = "configue gpio control",
|
.help = "configure gpio control",
|
||||||
.hint = NULL,
|
.hint = NULL,
|
||||||
.func = &process_gpio_control,
|
.func = &process_gpio_control,
|
||||||
.argtable = &gpio_control_args
|
.argtable = &gpio_control_args
|
||||||
|
@@ -113,15 +113,14 @@ def test_rtcio_deepsleep(dut: Tuple[IdfDut, IdfDut]) -> None:
|
|||||||
waker.expect(f'io_level = {sleep_level}', timeout=10)
|
waker.expect(f'io_level = {sleep_level}', timeout=10)
|
||||||
|
|
||||||
wakee.write('sleep -m 1')
|
wakee.write('sleep -m 1')
|
||||||
|
wakee.expect('enter deep sleep', timeout=10)
|
||||||
|
sleep(2)
|
||||||
|
|
||||||
waker.write(f'gpio_control -p {gpio_num} -l {wakeup_level}')
|
waker.write(f'gpio_control -p {gpio_num} -l {wakeup_level}')
|
||||||
waker.expect(f'io_num = {gpio_num}', timeout=10)
|
waker.expect(f'io_num = {gpio_num}', timeout=10)
|
||||||
waker.expect(f'io_level = {wakeup_level}', timeout=10)
|
waker.expect(f'io_level = {wakeup_level}', timeout=10)
|
||||||
|
|
||||||
wakee.expect('io_wakeup_test>', timeout=10)
|
wakee.expect('io_wakeup_test>', timeout=10)
|
||||||
|
|
||||||
sleep(2)
|
|
||||||
|
|
||||||
wakee.write('cause')
|
wakee.write('cause')
|
||||||
wakee.expect('Wake up from GPIO', timeout=10)
|
wakee.expect('Wake up from GPIO', timeout=10)
|
||||||
wakee.write(f'rtcio -p {gpio_num} -d')
|
wakee.write(f'rtcio -p {gpio_num} -d')
|
||||||
@@ -156,12 +155,13 @@ def test_gpio_wakeup_enable_lightsleep(dut: Tuple[IdfDut, IdfDut]) -> None:
|
|||||||
waker.expect(f'io_level = {sleep_level}', timeout=10)
|
waker.expect(f'io_level = {sleep_level}', timeout=10)
|
||||||
|
|
||||||
wakee.write('sleep -m 0')
|
wakee.write('sleep -m 0')
|
||||||
|
wakee.expect('enter light sleep', timeout=10)
|
||||||
|
sleep(1)
|
||||||
|
|
||||||
waker.write(f'gpio_control -p {gpio_num} -l {wakeup_level}')
|
waker.write(f'gpio_control -p {gpio_num} -l {wakeup_level}')
|
||||||
waker.expect(f'io_num = {gpio_num}', timeout=10)
|
waker.expect(f'io_num = {gpio_num}', timeout=10)
|
||||||
waker.expect(f'io_level = {wakeup_level}', timeout=10)
|
waker.expect(f'io_level = {wakeup_level}', timeout=10)
|
||||||
|
wakee.expect('wakeup from lightsleep', timeout=10)
|
||||||
wakee.expect('esp_light_sleep_start', timeout=10)
|
|
||||||
|
|
||||||
wakee.write('cause')
|
wakee.write('cause')
|
||||||
wakee.expect('Wake up from GPIO', timeout=10)
|
wakee.expect('Wake up from GPIO', timeout=10)
|
||||||
|
Reference in New Issue
Block a user