Jelajahi Sumber

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

Li Shuai 4 tahun lalu
induk
melakukan
3f17cc2ab8
2 mengubah file dengan 12 tambahan dan 0 penghapusan
  1. 8 0
      components/esp_system/Kconfig
  2. 4 0
      components/esp_system/sleep_modes.c

+ 8 - 0
components/esp_system/Kconfig

@@ -109,6 +109,14 @@ menu "ESP System Settings"
             pull-up, you do not need to select this option, otherwise, you
             should enable this option.
 
+    config ESP_SYSTEM_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.
+
     menu "Memory protection"
 
         config ESP_SYSTEM_MEMPROT_FEATURE

+ 4 - 0
components/esp_system/sleep_modes.c

@@ -29,6 +29,7 @@
 #include "soc/soc_caps.h"
 #include "driver/rtc_io.h"
 #include "hal/rtc_io_hal.h"
+#include "bootloader_common.h"
 
 #include "driver/uart.h"
 
@@ -424,6 +425,9 @@ void esp_sleep_config_gpio_isolate(void)
 #if CONFIG_ESP_SYSTEM_PSRAM_LEAKAGE_WORKAROUND && CONFIG_SPIRAM
     gpio_sleep_set_pull_mode(esp_spiram_get_cs_io(), GPIO_PULLUP_ONLY);
 #endif
+#if CONFIG_ESP_SYSTEM_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)