diff --git a/components/esp_hw_support/Kconfig b/components/esp_hw_support/Kconfig index 759cc09bf6..4a9b2d226b 100644 --- a/components/esp_hw_support/Kconfig +++ b/components/esp_hw_support/Kconfig @@ -164,6 +164,12 @@ menu "Hardware Settings" only for code quality inspection. Enabling it will increase the time overhead of entering and exiting sleep. It is not recommended to enable it in the release version. + config ESP_SLEEP_DEBUG + bool "esp sleep debug" + default n + help + Enable esp sleep debug. + endmenu menu "ESP_SLEEP_WORKAROUND" diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 3835c113aa..4175ae3d06 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -579,6 +579,14 @@ static esp_err_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags, esp_sleep_mode_t m bool deep_sleep = (mode == ESP_SLEEP_MODE_DEEP_SLEEP); bool should_skip_sleep = false; +#if CONFIG_ESP_SLEEP_DEBUG + // The following three logs are used to confirm whether the digital domain and modem are powered off. + // Some CI tests depend on these three logs and it is best not to modify them. + ESP_EARLY_LOGD(TAG, "pd_lags %lu", pd_flags); + ESP_EARLY_LOGD(TAG, "PMU_SLEEP_PD_TOP: %s", (pd_flags & PMU_SLEEP_PD_TOP) ? "True":"False"); + ESP_EARLY_LOGD(TAG, "PMU_SLEEP_PD_MODEM: %s", (pd_flags & PMU_SLEEP_PD_MODEM) ? "True":"False"); +#endif + int64_t sleep_duration = (int64_t) s_config.sleep_duration - (int64_t) s_config.sleep_time_adjustment; #if SOC_RTC_SLOW_CLK_SUPPORT_RC_FAST_D256 diff --git a/examples/openthread/ot_sleepy_device/sdkconfig.ci.sleepy_c6 b/examples/openthread/ot_sleepy_device/sdkconfig.ci.sleepy_c6 index e61c1118f2..80eea90801 100644 --- a/examples/openthread/ot_sleepy_device/sdkconfig.ci.sleepy_c6 +++ b/examples/openthread/ot_sleepy_device/sdkconfig.ci.sleepy_c6 @@ -2,3 +2,5 @@ CONFIG_IDF_TARGET="esp32c6" CONFIG_IDF_TARGET_ESP32C6=y CONFIG_OPENTHREAD_NETWORK_CHANNEL=12 CONFIG_OPENTHREAD_NETWORK_MASTERKEY="aabbccddeeff00112233445566778899" +CONFIG_ESP_SLEEP_DEBUG=y +CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y diff --git a/examples/openthread/ot_sleepy_device/sdkconfig.ci.sleepy_h2 b/examples/openthread/ot_sleepy_device/sdkconfig.ci.sleepy_h2 index fbc855ee78..43b8d650b8 100644 --- a/examples/openthread/ot_sleepy_device/sdkconfig.ci.sleepy_h2 +++ b/examples/openthread/ot_sleepy_device/sdkconfig.ci.sleepy_h2 @@ -2,3 +2,5 @@ CONFIG_IDF_TARGET="esp32h2" CONFIG_IDF_TARGET_ESP32H2=y CONFIG_OPENTHREAD_NETWORK_CHANNEL=12 CONFIG_OPENTHREAD_NETWORK_MASTERKEY="aabbccddeeff00112233445566778899" +CONFIG_ESP_SLEEP_DEBUG=y +CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y diff --git a/examples/openthread/pytest_otbr.py b/examples/openthread/pytest_otbr.py index 87334b4264..2ae516518b 100644 --- a/examples/openthread/pytest_otbr.py +++ b/examples/openthread/pytest_otbr.py @@ -576,6 +576,8 @@ def test_ot_sleepy_device(dut: Tuple[IdfDut, IdfDut]) -> None: ocf.clean_buffer(sleepy_device) sleepy_device.serial.hard_reset() sleepy_device.expect('detached -> child', timeout=20) + sleepy_device.expect('PMU_SLEEP_PD_TOP: True', timeout=10) + sleepy_device.expect('PMU_SLEEP_PD_MODEM: True', timeout=20) ocf.clean_buffer(sleepy_device) output = sleepy_device.expect(pexpect.TIMEOUT, timeout=5) assert 'rst:' not in str(output) and 'boot:' not in str(output)