Merge branch 'bugfix/esp_idf_ulp_wakeupcauses_record_v5.5' into 'release/v5.5'

fix(ulp): record wakeup causes before lp core request sleep v5.5

See merge request espressif/esp-idf!49121
This commit is contained in:
Jiang Jiang Jian
2026-06-03 10:51:04 +08:00
26 changed files with 252 additions and 22 deletions
+13
View File
@@ -73,6 +73,9 @@
#include "hal/touch_sens_hal.h"
#endif
#include "hal/mspi_ll.h"
#if SOC_LP_CORE_HW_AUTO_CLRWAKEUPCAUSE
#include "hal/lp_aon_hal.h"
#endif
#include "sdkconfig.h"
#include "esp_rom_uart.h"
@@ -1064,6 +1067,7 @@ static esp_err_t SLEEP_FN_ATTR esp_sleep_start(uint32_t sleep_flags, uint32_t cl
rtc_hal_ulp_wakeup_enable();
#elif CONFIG_ULP_COPROC_TYPE_LP_CORE
pmu_ll_hp_clear_sw_intr_status(&PMU);
pmu_ll_hp_clear_lp_cpu_exc_intr_status(&PMU);
#else
rtc_hal_ulp_int_clear();
#endif
@@ -2367,6 +2371,15 @@ uint32_t esp_sleep_get_wakeup_causes(void)
uint32_t wakeup_cause_raw = rtc_cntl_ll_get_wakeup_cause();
#endif
#if SOC_LP_CORE_HW_AUTO_CLRWAKEUPCAUSE
/* LP store register to read wakeup cause saved by LP core.
* Must match the register used in lp_core_utils.c */
uint32_t lp_core_wakeup_cause_status0 = lp_aon_hal_load_wakeup_cause();
if ((wakeup_cause_raw == 0) && (lp_core_wakeup_cause_status0 != 0)) {
wakeup_cause_raw = lp_core_wakeup_cause_status0;
}
#endif
if (wakeup_cause_raw & RTC_TIMER_TRIG_EN) {
wakeup_cause |= BIT(ESP_SLEEP_WAKEUP_TIMER);
}