diff --git a/components/esp_pm/pm_impl.c b/components/esp_pm/pm_impl.c index c4c1d91f4b..52339db972 100644 --- a/components/esp_pm/pm_impl.c +++ b/components/esp_pm/pm_impl.c @@ -821,10 +821,6 @@ void IRAM_ATTR vApplicationSleep( TickType_t xExpectedIdleTime ) #endif if (sleep_time_us >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP * portTICK_PERIOD_MS * 1000LL) { esp_sleep_enable_timer_wakeup(sleep_time_us - LIGHT_SLEEP_EARLY_WAKEUP_US); -#if CONFIG_PM_TRACE && SOC_PM_SUPPORT_RTC_PERIPH_PD - /* to force tracing GPIOs to keep state */ - esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); -#endif /* Enter sleep */ ESP_PM_TRACE_ENTER(SLEEP, core_id); int64_t sleep_start = esp_timer_get_time(); diff --git a/components/esp_pm/pm_trace.c b/components/esp_pm/pm_trace.c index 756ef40ae3..928ac7211b 100644 --- a/components/esp_pm/pm_trace.c +++ b/components/esp_pm/pm_trace.c @@ -1,10 +1,11 @@ /* - * SPDX-FileCopyrightText: 2016-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2016-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #include "esp_attr.h" +#include "esp_sleep.h" #include "esp_private/pm_trace.h" #include "driver/gpio.h" #include "soc/soc.h" @@ -55,6 +56,10 @@ void esp_pm_trace_init(void) } gpio_set_direction(io - 1, GPIO_MODE_OUTPUT); } +#if SOC_PM_SUPPORT_RTC_PERIPH_PD + /* to force tracing GPIOs to keep state */ + esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); +#endif } void IRAM_ATTR esp_pm_trace_enter(esp_pm_trace_event_t event, int core_id)