From 73384adfbe3a4365fb8fefdae9b1f9df4e509635 Mon Sep 17 00:00:00 2001 From: houwenxiang Date: Fri, 17 Apr 2020 22:20:10 +0800 Subject: [PATCH] driver(Ledc): fix the bug that ledc low-sleep channel can not work when chip in light-sleep mode `esp_light_sleep_start` will disable the RTC8M_CLK, which will cause the LEDC low-speed channel to not work in light-sleep mode --- components/soc/src/esp32/rtc_sleep.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/soc/src/esp32/rtc_sleep.c b/components/soc/src/esp32/rtc_sleep.c index d903dc70ab..9264c5d5e0 100644 --- a/components/soc/src/esp32/rtc_sleep.c +++ b/components/soc/src/esp32/rtc_sleep.c @@ -201,6 +201,11 @@ void rtc_sleep_init(rtc_sleep_config_t cfg) } else { REG_CLR_BIT(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_CK8M_FORCE_PU); } + //Keep the RTC8M_CLK on in light_sleep mode if the ledc low-speed channel is clocked by RTC8M_CLK. + if (!cfg.deep_slp && GET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_CLK8M_EN_M)) { + REG_CLR_BIT(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_CK8M_FORCE_PD); + REG_SET_BIT(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_CK8M_FORCE_PU); + } /* enable VDDSDIO control by state machine */ REG_CLR_BIT(RTC_CNTL_SDIO_CONF_REG, RTC_CNTL_SDIO_FORCE);