From 85b18a1c10b3d68c8591bcdb82738062cfadb3b6 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sun, 29 Mar 2020 12:44:32 +0200 Subject: [PATCH] cpu/esp32: fix wake-up sources for sleep modes When entering a sleep mode, all wake-up sources should first be disabled before the wake-up sources required for the sleep mode are then stepwise enabled again. Otherwise, an wake-up configuration of one sleep mode may affect the wake-up within another sleep mode. --- cpu/esp32/periph/pm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpu/esp32/periph/pm.c b/cpu/esp32/periph/pm.c index 6d51baa872..8bcf42074e 100644 --- a/cpu/esp32/periph/pm.c +++ b/cpu/esp32/periph/pm.c @@ -131,6 +131,9 @@ void pm_set(unsigned mode) esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON); } + /* first disable all wake-up sources */ + esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); + /* Prepare the RTC timer if an RTC alarm is set to wake up. */ rtc_pm_sleep_enter(mode);