From e96d653c9ecff6d90113bcead8ef003050d87562 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 22 Feb 2017 17:04:11 +0800 Subject: [PATCH] ulp: make sure I_WAKE instruction works with ULP timer disabled Setting ULP_CP_WAKEUP_FORCE_EN forces ULP wakeup to work even if the ULP timer has already been disabled. --- components/esp32/deep_sleep.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/esp32/deep_sleep.c b/components/esp32/deep_sleep.c index aadb6067ec..55e92a05e0 100644 --- a/components/esp32/deep_sleep.c +++ b/components/esp32/deep_sleep.c @@ -126,6 +126,9 @@ void IRAM_ATTR esp_deep_sleep_start() if (s_config.wakeup_triggers & EXT_EVENT1_TRIG_EN) { ext1_wakeup_prepare(); } + if (s_config.wakeup_triggers & SAR_TRIG_EN) { + SET_PERI_REG_MASK(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_WAKEUP_FORCE_EN); + } // TODO: move timer wakeup configuration into a similar function // once rtc_sleep is opensourced.