Skip to content

Commit 9c42149

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'bugfix/pm-300' into 'master'
fix some esp32c5 and esp32c61 light sleep wakeup issues Closes PM-297, PM-300, and PM-212 See merge request espressif/esp-idf!36013
2 parents 6692748 + 248b61e commit 9c42149

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

components/esp_hw_support/sleep_gpio.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,6 @@ void esp_sleep_config_gpio_isolate(void)
6161
gpio_sleep_set_pull_mode(gpio_num, GPIO_FLOATING);
6262
}
6363
}
64-
#if CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND && CONFIG_SPIRAM
65-
int32_t mspi_io_cs1_io_num = esp_mspi_get_io(ESP_MSPI_IO_CS1);
66-
if (GPIO_IS_VALID_GPIO(mspi_io_cs1_io_num)) {
67-
gpio_sleep_set_pull_mode(mspi_io_cs1_io_num, GPIO_PULLUP_ONLY);
68-
}
69-
#endif // CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND && CONFIG_SPIRAM
70-
71-
#if CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND
72-
int32_t mspi_io_cs0_io_num = esp_mspi_get_io(ESP_MSPI_IO_CS0);
73-
if (GPIO_IS_VALID_GPIO(mspi_io_cs0_io_num)) {
74-
gpio_sleep_set_pull_mode(esp_mspi_get_io(ESP_MSPI_IO_CS0), GPIO_PULLUP_ONLY);
75-
}
76-
#endif // CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND
7764

7865
#if CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU
7966
gpio_sleep_set_pull_mode(esp_mspi_get_io(ESP_MSPI_IO_CLK), GPIO_PULLUP_ONLY);
@@ -102,6 +89,21 @@ void esp_sleep_enable_gpio_switch(bool enable)
10289
ESP_EARLY_LOGI(TAG, "%s automatic switching of GPIO sleep configuration", enable ? "Enable" : "Disable");
10390
for (gpio_num_t gpio_num = GPIO_NUM_0; gpio_num < GPIO_NUM_MAX; gpio_num++) {
10491
if (GPIO_IS_VALID_GPIO(gpio_num)) {
92+
/* If the PSRAM is disable in ESP32xx chips equipped with PSRAM, there will be a large current leakage. */
93+
#if CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND && CONFIG_SPIRAM
94+
if (gpio_num == esp_mspi_get_io(ESP_MSPI_IO_CS1)) {
95+
gpio_sleep_sel_dis(gpio_num);
96+
continue;
97+
}
98+
#endif // CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND && CONFIG_SPIRAM
99+
100+
#if CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND
101+
if (gpio_num == esp_mspi_get_io(ESP_MSPI_IO_CS0)) {
102+
gpio_sleep_sel_dis(gpio_num);
103+
continue;
104+
}
105+
#endif // CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND
106+
105107
if (enable) {
106108
gpio_sleep_sel_en(gpio_num);
107109
} else {
@@ -190,13 +192,9 @@ void esp_deep_sleep_wakeup_io_reset(void)
190192
#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO
191193
ESP_SYSTEM_INIT_FN(esp_sleep_startup_init, SECONDARY, BIT(0), 105)
192194
{
193-
/* If the TOP domain is powered off, the GPIO will also be powered off during sleep,
194-
and all configurations in the sleep state of GPIO will not take effect.*/
195-
#if !CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
196195
// Configure to isolate (disable the Input/Output/Pullup/Pulldown
197196
// function of the pin) all GPIO pins in sleep state
198197
esp_sleep_config_gpio_isolate();
199-
#endif
200198
// Enable automatic switching of GPIO configuration
201199
esp_sleep_enable_gpio_switch(true);
202200
return ESP_OK;

components/hal/esp32c61/include/hal/uart_ll.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extern "C" {
3030
// Get UART hardware instance with giving uart num
3131
#define UART_LL_GET_HW(num) (((num) == UART_NUM_0) ? (&UART0) : (((num) == UART_NUM_1) ? (&UART1) : (&UART2)))
3232

33-
#define UART_LL_MIN_WAKEUP_THRESH (2)
33+
#define UART_LL_MIN_WAKEUP_THRESH (3)
3434
#define UART_LL_INTR_MASK (0x7ffff) //All interrupt mask
3535

3636
#define UART_LL_FSM_IDLE (0x0)

0 commit comments

Comments
 (0)