mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(uart): reduce current consumption in sleep mode
This commit is contained in:
@@ -868,8 +868,8 @@ esp_err_t uart_set_pin(uart_port_t uart_num, int tx_io_num, int rx_io_num, int r
|
||||
#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_TX_PIN_IDX)) {
|
||||
if (uart_num < SOC_UART_HP_NUM) {
|
||||
@@ -893,8 +893,10 @@ esp_err_t uart_set_pin(uart_port_t uart_num, int tx_io_num, int rx_io_num, int r
|
||||
#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_RX_PIN_IDX)) {
|
||||
io_reserve_mask &= ~BIT64(rx_io_num); // input IO via GPIO matrix does not need to be reserved
|
||||
|
||||
Reference in New Issue
Block a user