Skip to content

Commit 59c7a63

Browse files
committed
fix(esp_hw_support): fix soc hang caused by deep sleep digital gpio isolate
1 parent 77a1e29 commit 59c7a63

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

components/esp_hw_support/sleep_gpio.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "esp_log.h"
1515
#include "esp_memory_utils.h"
1616
#include "soc/soc_caps.h"
17+
#include "soc/uart_pins.h"
1718

1819
#include "sdkconfig.h"
1920

@@ -151,6 +152,23 @@ IRAM_ATTR void esp_sleep_isolate_digital_gpio(void)
151152
/* isolate digital IO that is not held(keep the configuration of digital IOs held by users) */
152153
for (gpio_num_t gpio_num = GPIO_NUM_0; gpio_num < GPIO_NUM_MAX; gpio_num++) {
153154
if (GPIO_IS_VALID_DIGITAL_IO_PAD(gpio_num) && !gpio_hal_is_digital_io_hold(&gpio_hal, gpio_num)) {
155+
156+
bool is_mspi_io_pad = false;
157+
esp_mspi_io_t mspi_ios[] = { ESP_MSPI_IO_CS0, ESP_MSPI_IO_CLK, ESP_MSPI_IO_Q, ESP_MSPI_IO_D, ESP_MSPI_IO_HD, ESP_MSPI_IO_WP };
158+
for (int i = 0; i < sizeof(mspi_ios) / sizeof(mspi_ios[0]); i++) {
159+
if (esp_mspi_get_io(mspi_ios[i]) == gpio_num) {
160+
is_mspi_io_pad = true;
161+
break;
162+
}
163+
}
164+
// Ignore MSPI and default Console UART io pads, When the CPU executes
165+
// the following instructions to configure the MSPI IO PAD, access on
166+
// the MSPI signal lines (as CPU instruction execution and MSPI access
167+
// operations are asynchronous) may cause the SoC to hang.
168+
if (is_mspi_io_pad || gpio_num == U0RXD_GPIO_NUM || gpio_num == U0TXD_GPIO_NUM) {
169+
continue;
170+
}
171+
154172
/* disable I/O */
155173
gpio_hal_input_disable(&gpio_hal, gpio_num);
156174
gpio_hal_output_disable(&gpio_hal, gpio_num);

0 commit comments

Comments
 (0)