From 64f8e61b170b36bc97f8ff9c3c54b4aab7f42108 Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Fri, 11 Aug 2023 19:36:10 +0800 Subject: [PATCH 1/2] fix(esp_system): fix cannot pd cpu and rc fast at the same time during light sleep --- components/esp_system/sleep_modes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_system/sleep_modes.c b/components/esp_system/sleep_modes.c index 2f43a34584..24aacb410d 100644 --- a/components/esp_system/sleep_modes.c +++ b/components/esp_system/sleep_modes.c @@ -651,7 +651,7 @@ static uint32_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags) if (!s_ultra_low_enabled) { sleep_flags |= RTC_SLEEP_NO_ULTRA_LOW; } - if (rtc_dig_8m_enabled()) { + if (periph_using_8m) { sleep_flags |= RTC_SLEEP_DIG_USE_8M; } From 1ba2ac83e6419ef383570df516109d605b1ef0f7 Mon Sep 17 00:00:00 2001 From: Li Shuai Date: Fri, 16 Jul 2021 17:44:03 +0800 Subject: [PATCH 2/2] fix rtc register read error and add workaround for rtc bus isolate issue --- components/esp_system/Kconfig | 5 +++++ components/esp_system/sleep_modes.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/components/esp_system/Kconfig b/components/esp_system/Kconfig index db8c818451..ed9b30d004 100644 --- a/components/esp_system/Kconfig +++ b/components/esp_system/Kconfig @@ -117,6 +117,11 @@ menu "ESP System Settings" pull-up, you do not need to select this option, otherwise, you should enable this option. + config ESP_SYSTEM_SLEEP_RTC_BUS_ISO_WORKAROUND + bool + default y if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + + menu "RTC Clock Config" # This is used for configure the RTC clock. config RTC_CLOCK_BBPLL_POWER_ON_WITH_USB diff --git a/components/esp_system/sleep_modes.c b/components/esp_system/sleep_modes.c index 24aacb410d..408174ca1e 100644 --- a/components/esp_system/sleep_modes.c +++ b/components/esp_system/sleep_modes.c @@ -831,6 +831,10 @@ esp_err_t esp_light_sleep_start(void) // Decide which power domains can be powered down uint32_t pd_flags = get_power_down_flags(); +#ifdef CONFIG_ESP_SYSTEM_SLEEP_RTC_BUS_ISO_WORKAROUND + pd_flags &= ~RTC_SLEEP_PD_RTC_PERIPH; +#endif + // Re-calibrate the RTC Timer clock #if defined(CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS) || defined(CONFIG_ESP32S2_RTC_CLK_SRC_EXT_CRYS) || defined(CONFIG_ESP32C3_RTC_CLK_SRC_EXT_CRYS) if (rtc_clk_slow_freq_get() == RTC_SLOW_FREQ_32K_XTAL) {