Merge branch 'bugfix/uart_extra_current_consumption_in_sleep' into 'master'

fix(uart): reduce current consumption in sleep mode

See merge request espressif/esp-idf!50416
This commit is contained in:
Song Ruo Jing
2026-08-07 19:07:26 +08:00
3 changed files with 23 additions and 15 deletions
+6 -4
View File
@@ -920,8 +920,8 @@ esp_err_t _uart_set_pin6(uart_port_t uart_num, int tx_io_num, int rx_io_num, int
#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO
// In such case, IOs are going to switch to sleep configuration (isolate) when entering sleep for power saving reason
// But TX IO in isolate state could write garbled data to the other end
// Therefore, we should disable the switch of the TX pin to sleep configuration
gpio_sleep_sel_dis(tx_io_num);
// Therefore, we should enable internal pull-up of the TX pin in sleep configuration
gpio_sleep_set_pull_mode(tx_io_num, GPIO_PULLUP_ONLY);
#endif
if (tx_rx_same_io || !uart_try_set_iomux_pin(uart_num, tx_io_num, SOC_UART_PERIPH_SIGNAL_TX)) {
if (uart_num < SOC_UART_HP_NUM) {
@@ -942,8 +942,10 @@ esp_err_t _uart_set_pin6(uart_port_t uart_num, int tx_io_num, int rx_io_num, int
#if CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO
// In such case, IOs are going to switch to sleep configuration (isolate) when entering sleep for power saving reason
// But RX IO in isolate state could receive garbled data into FIFO, which is not desired
// Therefore, we should disable the switch of the RX pin to sleep configuration
gpio_sleep_sel_dis(rx_io_num);
// Therefore, we should enable internal pull-up of the RX pin in sleep configuration
// Meanwhile, RX pin may be used for wakeup, so configure RX pin as input
gpio_sleep_set_pull_mode(rx_io_num, GPIO_PULLUP_ONLY);
gpio_sleep_set_direction(rx_io_num, GPIO_MODE_INPUT);
#endif
if (tx_rx_same_io || !uart_try_set_iomux_pin(uart_num, rx_io_num, SOC_UART_PERIPH_SIGNAL_RX)) {
io_reserve_mask &= ~BIT64(rx_io_num); // input IO via GPIO matrix does not need to be reserved