From 1fa59c442b1af5e3645f54092ce5a4aab5f7e9d2 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Wed, 17 Apr 2024 13:44:46 +0800 Subject: [PATCH] fix(ulp): fixed lp-core not booting during sleep LP core was unable to boot when system was in deepsleep. This was due to lp uart init in LP rom using XTAL as clk source, which is normally powered down during sleep. This would cause lp uart to get stuck while printing ROM output, and the app would never boot. Also fixed wrong wakeup cause used by HP core for ULP wake up --- .../port/esp32p4/private_include/pmu_bit_defs.h | 4 ++-- components/esp_rom/include/esp32p4/rom/rtc.h | 7 +++++++ components/ulp/lp_core/lp_core.c | 10 ++++++++++ .../ulp/lp_core/lp_core/include/ulp_lp_core_print.h | 2 ++ components/ulp/test_apps/lp_core/main/test_lp_core.c | 8 ++++++-- docs/en/api-reference/system/ulp-lp-core.rst | 4 ++-- examples/system/.build-test-rules.yml | 10 ---------- examples/system/ulp/lp_core/gpio/README.md | 4 ++-- .../system/ulp/lp_core/lp_uart/lp_uart_echo/README.md | 4 ++-- .../system/ulp/lp_core/lp_uart/lp_uart_print/README.md | 4 ++-- .../rtc_mem_reserve/main/rtc_mem_reserve_test_main.c | 2 +- 11 files changed, 36 insertions(+), 23 deletions(-) diff --git a/components/esp_hw_support/port/esp32p4/private_include/pmu_bit_defs.h b/components/esp_hw_support/port/esp32p4/private_include/pmu_bit_defs.h index 0dc0f1bd0c..19c94de993 100644 --- a/components/esp_hw_support/port/esp32p4/private_include/pmu_bit_defs.h +++ b/components/esp_hw_support/port/esp32p4/private_include/pmu_bit_defs.h @@ -11,7 +11,7 @@ extern "C" { #endif #define PMU_SDIO_WAKEUP_EN BIT(0) -#define PMU_SW_WAKEUP_HP_EN BIT(1) +#define PMU_LP_CORE_WAKEUP_EN BIT(1) #define PMU_GPIO_WAKEUP_EN BIT(2) #define PMU_USB_WAKEUP_EN BIT(3) #define PMU_UART4_WAKEUP_EN BIT(4) @@ -26,7 +26,7 @@ extern "C" { #define PMU_LP_TIMER_WAKEUP_EN BIT(13) #define PMU_BOD_WAKEUP_EN BIT(14) #define PMU_VDDBAT_UNDERVOLT_WAKEUP_EN BIT(15) -#define PMU_LP_CORE_WAKEUP_EN BIT(16) +#define PMU_LP_CORE_TRAP_WAKEUP_EN BIT(16) #define PMU_ETM_WAKEUP_EN BIT(17) #define PMU_LP_TIMER1_WAKEUP_EN BIT(18) #define PMU_LP_I2S_WAKEUP_EN BIT(19) diff --git a/components/esp_rom/include/esp32p4/rom/rtc.h b/components/esp_rom/include/esp32p4/rom/rtc.h index aa45a97d01..6eccaa9ba5 100644 --- a/components/esp_rom/include/esp32p4/rom/rtc.h +++ b/components/esp_rom/include/esp32p4/rom/rtc.h @@ -50,6 +50,9 @@ extern "C" { * RTC_CNTL_STORE5_REG APB bus frequency * RTC_CNTL_STORE6_REG FAST_RTC_MEMORY_ENTRY * RTC_CNTL_STORE7_REG FAST_RTC_MEMORY_CRC + * LP_SYS_LP_STORE8_REG sleep mode and wake stub address + * LP_SYS_LP_STORE9_REG LP_UART_INIT_CTRL + * LP_SYS_LP_STORE10_REG LP_ROM_LOG_CTRL ************************************************************************************* */ @@ -75,6 +78,10 @@ extern "C" { #define RTC_SLEEP_WAKE_STUB_ADDR_REG LP_SYSTEM_REG_LP_STORE8_REG #define RTC_SLEEP_MODE_REG LP_SYSTEM_REG_LP_STORE8_REG +// lp uart init status, 0 - need init, 1 - no init. +#define LP_UART_INIT_CTRL_REG LP_SYSTEM_REG_LP_STORE9_REG +#define ROM_LOG_CTRL_REG LP_SYSTEM_REG_LP_STORE10_REG + typedef enum { AWAKE = 0, //