From 2bcc29510a845ac8df404c37afbb76e5e5895890 Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Mon, 16 Mar 2026 20:37:08 +0800 Subject: [PATCH] fix(esp_hw_support): move timers suspend/resume to misc modules prepare --- components/esp_hw_support/sleep_modes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index fe308d2f43..f85256885d 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -723,6 +723,7 @@ static SLEEP_FN_ATTR void misc_modules_sleep_prepare(uint32_t sleep_flags, bool sar_periph_ctrl_power_disable(); } #endif + suspend_timers(sleep_flags); } /** @@ -730,6 +731,7 @@ static SLEEP_FN_ATTR void misc_modules_sleep_prepare(uint32_t sleep_flags, bool */ static SLEEP_FN_ATTR void misc_modules_wake_prepare(uint32_t sleep_flags) { + resume_timers(sleep_flags); #if CONFIG_ESP_ENABLE_PVT && SOC_PVT_EN_WITH_SLEEP pvt_func_enable(true); #endif @@ -906,7 +908,6 @@ static esp_err_t FORCE_IRAM_ATTR esp_sleep_start_safe(uint32_t sleep_flags, uint result = rtc_deep_sleep_start(s_config.wakeup_triggers, reject_triggers); #endif } else { - suspend_timers(sleep_flags); /* Cache Suspend 1: will wait cache idle in cache suspend */ suspend_cache(); if (!(sleep_flags & RTC_SLEEP_PD_VDDSDIO)) { @@ -992,7 +993,6 @@ static esp_err_t FORCE_IRAM_ATTR esp_sleep_start_safe(uint32_t sleep_flags, uint #endif /* Cache Resume 1: Resume cache for continue running*/ resume_cache(); - resume_timers(sleep_flags); #if CONFIG_PM_SLP_SPIRAM_HALFSLEEP_ENABLED && CONFIG_SPIRAM_XIP_FROM_PSRAM // Code outside of esp_sleep_start_safe may be linked to FLASH, and if CONFIG_SPIRAM_XIP_FROM_PSRAM // is enabled, code in Flash will be copied to PSRAM for execution. We need to wait here until