From 1deec19434a9a9613f2c15e67dc5d1ae05654da6 Mon Sep 17 00:00:00 2001 From: Abanoub Salah Date: Sun, 31 May 2026 09:17:39 +0300 Subject: [PATCH 1/2] uart: fix threshold configuration loss when interrupts are disabled --- components/driver/uart/uart.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/components/driver/uart/uart.c b/components/driver/uart/uart.c index 3f2de258fd0..74b463d196e 100644 --- a/components/driver/uart/uart.c +++ b/components/driver/uart/uart.c @@ -2072,9 +2072,7 @@ esp_err_t uart_set_rx_full_threshold(uart_port_t uart_num, int threshold) return ESP_ERR_INVALID_STATE; } UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock)); - if (uart_hal_get_intr_ena_status(&(uart_context[uart_num].hal)) & UART_INTR_RXFIFO_FULL) { - uart_hal_set_rxfifo_full_thr(&(uart_context[uart_num].hal), threshold); - } + uart_hal_set_rxfifo_full_thr(&(uart_context[uart_num].hal), threshold); UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock)); return ESP_OK; } @@ -2089,9 +2087,7 @@ esp_err_t uart_set_tx_empty_threshold(uart_port_t uart_num, int threshold) return ESP_ERR_INVALID_STATE; } UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock)); - if (uart_hal_get_intr_ena_status(&(uart_context[uart_num].hal)) & UART_INTR_TXFIFO_EMPTY) { - uart_hal_set_txfifo_empty_thr(&(uart_context[uart_num].hal), threshold); - } + uart_hal_set_txfifo_empty_thr(&(uart_context[uart_num].hal), threshold); UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock)); return ESP_OK; } From 9573cefab7c2221e67d68507bea8b7bdd006e986 Mon Sep 17 00:00:00 2001 From: Song Ruo Jing Date: Fri, 3 Jul 2026 15:41:59 +0800 Subject: [PATCH 2/2] fix(stdio): add console input ability when selects ESP_CONSOLE_UART_CUSTOM_NUM_1 --- components/bootloader_support/src/bootloader_console.c | 7 ++++--- components/esp_system/port/cpu_start.c | 3 +++ tools/test_apps/system/build_test/sdkconfig.ci.custom_uart | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/components/bootloader_support/src/bootloader_console.c b/components/bootloader_support/src/bootloader_console.c index 62f4d35b894..45175a84f2b 100644 --- a/components/bootloader_support/src/bootloader_console.c +++ b/components/bootloader_support/src/bootloader_console.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -52,8 +52,9 @@ void bootloader_console_init(void) const int uart_tx_gpio = CONFIG_ESP_CONSOLE_UART_TX_GPIO; const int uart_rx_gpio = CONFIG_ESP_CONSOLE_UART_RX_GPIO; - // Switch to the new UART (this just changes UART number used for esp_rom_printf in ROM code). - esp_rom_uart_set_as_console(uart_num); + // Switch to the new UART + esp_rom_uart_set_as_console(uart_num); // changes UART number used for esp_rom_printf in ROM code + esp_rom_uart_switch_buffer(uart_num); // If console is attached to UART1 or if non-default pins are used, // need to reconfigure pins using GPIO matrix diff --git a/components/esp_system/port/cpu_start.c b/components/esp_system/port/cpu_start.c index 6a8ef21a80d..3496ed39ba5 100644 --- a/components/esp_system/port/cpu_start.c +++ b/components/esp_system/port/cpu_start.c @@ -216,6 +216,9 @@ void IRAM_ATTR call_start_cpu1(void) #else // CONFIG_ESP_CONSOLE_NONE esp_rom_install_uart_printf(); esp_rom_uart_set_as_console(CONFIG_ESP_CONSOLE_UART_NUM); +#if CONFIG_ESP_CONSOLE_UART_CUSTOM + esp_rom_uart_switch_buffer(CONFIG_ESP_CONSOLE_UART_NUM); +#endif #endif #if CONFIG_IDF_TARGET_ESP32 diff --git a/tools/test_apps/system/build_test/sdkconfig.ci.custom_uart b/tools/test_apps/system/build_test/sdkconfig.ci.custom_uart index 80ed1761ac2..56ee759e76b 100644 --- a/tools/test_apps/system/build_test/sdkconfig.ci.custom_uart +++ b/tools/test_apps/system/build_test/sdkconfig.ci.custom_uart @@ -1 +1,2 @@ CONFIG_ESP_CONSOLE_UART_CUSTOM=y +CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1=y