light sleep: fix Flash leakage when its CS pin has no hardware pullup

pull/7680/head
Li Shuai 2021-09-03 14:30:55 +08:00
rodzic af4f2075ac
commit c5b481c6da
2 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -42,5 +42,13 @@ menu "Hardware Settings"
increase during light sleep. If the CS pin of SPIRAM has an external increase during light sleep. If the CS pin of SPIRAM has an external
pull-up, you do not need to select this option, otherwise, you pull-up, you do not need to select this option, otherwise, you
should enable this option. should enable this option.
config ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND
bool "Flash leakage current workaround in light sleep"
help
When the CS pin of Flash is not pulled up, the sleep current will
increase during light sleep. If the CS pin of Flash has an external
pull-up, you do not need to select this option, otherwise, you
should enable this option.
endmenu endmenu
endmenu endmenu

Wyświetl plik

@ -19,6 +19,7 @@
#include "driver/gpio.h" #include "driver/gpio.h"
#include "esp_private/gpio.h" #include "esp_private/gpio.h"
#include "esp_private/sleep_gpio.h" #include "esp_private/sleep_gpio.h"
#include "bootloader_common.h"
#ifdef CONFIG_IDF_TARGET_ESP32 #ifdef CONFIG_IDF_TARGET_ESP32
#include "esp32/spiram.h" #include "esp32/spiram.h"
@ -64,6 +65,9 @@ void esp_sleep_config_gpio_isolate(void)
#if CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND && CONFIG_SPIRAM #if CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND && CONFIG_SPIRAM
gpio_sleep_set_pull_mode(esp_spiram_get_cs_io(), GPIO_PULLUP_ONLY); gpio_sleep_set_pull_mode(esp_spiram_get_cs_io(), GPIO_PULLUP_ONLY);
#endif #endif
#if CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND
gpio_sleep_set_pull_mode(bootloader_flash_get_cs_io(), GPIO_PULLUP_ONLY);
#endif
} }
void esp_sleep_enable_gpio_switch(bool enable) void esp_sleep_enable_gpio_switch(bool enable)