Skip to content

Commit ac623a9

Browse files
committed
soc/rtc: restore dbg attenuation when waking from sleep
This fixes inability to enter deep sleep after waking up from light sleep
1 parent d38b22b commit ac623a9

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

components/soc/esp32/include/soc/rtc_cntl_reg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@
10701070
#define RTC_CNTL_DBG_ATTEN_M ((RTC_CNTL_DBG_ATTEN_V)<<(RTC_CNTL_DBG_ATTEN_S))
10711071
#define RTC_CNTL_DBG_ATTEN_V 0x3
10721072
#define RTC_CNTL_DBG_ATTEN_S 24
1073-
1073+
#define RTC_CNTL_DBG_ATTEN_DEFAULT 3
10741074
#define RTC_CNTL_REG (DR_REG_RTCCNTL_BASE + 0x7c)
10751075
/* RTC_CNTL_FORCE_PU : R/W ;bitpos:[31] ;default: 1'd1 ; */
10761076
/*description: RTC_REG force power up*/

components/soc/esp32/rtc_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void rtc_init(rtc_config_t cfg)
3030
REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_XTL_BUF_WAIT, cfg.xtal_wait);
3131
REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, cfg.ck8m_wait);
3232

33-
REG_SET_FIELD(RTC_CNTL_BIAS_CONF_REG, RTC_CNTL_DBG_ATTEN, 0x3);
33+
REG_SET_FIELD(RTC_CNTL_BIAS_CONF_REG, RTC_CNTL_DBG_ATTEN, RTC_CNTL_DBG_ATTEN_DEFAULT);
3434
SET_PERI_REG_MASK(RTC_CNTL_BIAS_CONF_REG,
3535
RTC_CNTL_DEC_HEARTBEAT_WIDTH | RTC_CNTL_INC_HEARTBEAT_PERIOD);
3636

components/soc/esp32/rtc_sleep.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,8 @@ uint32_t rtc_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt)
219219
uint32_t reject = REG_GET_FIELD(RTC_CNTL_INT_RAW_REG, RTC_CNTL_SLP_REJECT_INT_RAW);
220220
SET_PERI_REG_MASK(RTC_CNTL_INT_CLR_REG,
221221
RTC_CNTL_SLP_REJECT_INT_CLR | RTC_CNTL_SLP_WAKEUP_INT_CLR);
222+
223+
/* restore DBG_ATTEN to the default value */
224+
REG_SET_FIELD(RTC_CNTL_BIAS_CONF_REG, RTC_CNTL_DBG_ATTEN, RTC_CNTL_DBG_ATTEN_DEFAULT);
222225
return reject;
223226
}

0 commit comments

Comments
 (0)