From a939f7d34bffb3cf8305ba7ec335574c8f723f3f Mon Sep 17 00:00:00 2001 From: Li Shuai Date: Mon, 11 Oct 2021 11:33:36 +0800 Subject: [PATCH] light sleep: add software workaround for esp32s3 gpio reset issue --- components/esp32c3/Kconfig | 19 ------------------- components/esp_hw_support/Kconfig | 19 +++++++++++++++++++ components/esp_hw_support/sdkconfig.rename | 1 + components/esp_system/startup.c | 2 +- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/components/esp32c3/Kconfig b/components/esp32c3/Kconfig index dd6e5543bc..706968f604 100644 --- a/components/esp32c3/Kconfig +++ b/components/esp32c3/Kconfig @@ -192,23 +192,4 @@ menu "ESP32C3-Specific" If enabled, this disables the linking of binary libraries in the application build. Note that after enabling this Wi-Fi/Bluetooth will not work. - config ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND - bool "light sleep GPIO reset workaround" - default y - select PM_SLP_DISABLE_GPIO if FREERTOS_USE_TICKLESS_IDLE - help - ESP32C3 will reset at wake-up if GPIO is received a small electrostatic pulse during - light sleep, with specific condition - - - GPIO needs to be configured as input-mode only - - The pin receives a small electrostatic pulse, and reset occurs when the pulse - voltage is higher than 6 V - - For GPIO set to input mode only, it is not a good practice to leave it open/floating, - The hardware design needs to controlled it with determined supply or ground voltage - is necessary. - - This option provides a software workaround for this issue. Configure to isolate all - GPIO pins in sleep state. - endmenu # ESP32C3-Specific diff --git a/components/esp_hw_support/Kconfig b/components/esp_hw_support/Kconfig index 2d09fa5f12..d0be01aabb 100644 --- a/components/esp_hw_support/Kconfig +++ b/components/esp_hw_support/Kconfig @@ -34,6 +34,25 @@ menu "Hardware Settings" bool default y if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + config ESP_SLEEP_GPIO_RESET_WORKAROUND + bool "light sleep GPIO reset workaround" + default y if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3 + select PM_SLP_DISABLE_GPIO if FREERTOS_USE_TICKLESS_IDLE + help + esp32c3 and esp32s3 will reset at wake-up if GPIO is received a small electrostatic + pulse during light sleep, with specific condition + + - GPIO needs to be configured as input-mode only + - The pin receives a small electrostatic pulse, and reset occurs when the pulse + voltage is higher than 6 V + + For GPIO set to input mode only, it is not a good practice to leave it open/floating, + The hardware design needs to controlled it with determined supply or ground voltage + is necessary. + + This option provides a software workaround for this issue. Configure to isolate all + GPIO pins in sleep state. + config ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND bool "PSRAM leakage current workaround in light sleep" depends on SPIRAM diff --git a/components/esp_hw_support/sdkconfig.rename b/components/esp_hw_support/sdkconfig.rename index efc2e1f820..2a76be137e 100644 --- a/components/esp_hw_support/sdkconfig.rename +++ b/components/esp_hw_support/sdkconfig.rename @@ -6,3 +6,4 @@ CONFIG_TWO_UNIVERSAL_MAC_ADDRESS CONFIG_ESP32_UNIVERSAL_M CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR CONFIG_ESP_SYSTEM_PD_FLASH CONFIG_ESP_SLEEP_POWER_DOWN_FLASH +CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND diff --git a/components/esp_system/startup.c b/components/esp_system/startup.c index e977be4c26..719afd108f 100644 --- a/components/esp_system/startup.c +++ b/components/esp_system/startup.c @@ -434,7 +434,7 @@ IRAM_ATTR ESP_SYSTEM_INIT_FN(init_components0, BIT(0)) { esp_timer_init(); -#if CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND && !CONFIG_PM_SLP_DISABLE_GPIO +#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND && !CONFIG_PM_SLP_DISABLE_GPIO // Configure to isolate (disable the Input/Output/Pullup/Pulldown // function of the pin) all GPIO pins in sleep state esp_sleep_config_gpio_isolate();