Skip to content

Commit 87a5d73

Browse files
committed
fix(uart): Permit UART speeds over 460800 on ESP32 Arduino 3.0 and later.
- UART speeds above 460800 were functional on ESP32 Arduino 2.0. - b1ackviking: Console sets UART clock source to REF_TICK on ESP32 and ESP32S2 by default, however, APB clock frequency does not change when power management is disabled. Using APB clock source allows higher baud rates for UART console. - Merge espressif/esp-idf PR#8572: "fix(console): use apb clock source for uart when power management is disabled"
1 parent 3bfa3e0 commit 87a5d73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/esp32/esp32-hal-uart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,11 @@ uart_t *uartBegin(
507507
// therefore, uart clock source will set to XTAL for all SoC that support it. This fix solves the C6|H2 issue.
508508
#if SOC_UART_SUPPORT_XTAL_CLK
509509
uart_config.source_clk = UART_SCLK_XTAL; // valid for C2, S3, C3, C6, H2 and P4
510-
#elif SOC_UART_SUPPORT_REF_TICK
510+
#elif defined(CONFIG_PM_ENABLE) && SOC_UART_SUPPORT_REF_TICK
511511
if (baudrate <= 250000) {
512512
uart_config.source_clk = UART_SCLK_REF_TICK; // valid for ESP32, S2 - MAX supported baud rate is 250 Kbps
513513
} else {
514-
uart_config.source_clk = UART_SCLK_APB; // baudrate may change with the APB Frequency!
514+
uart_config.source_clk = UART_SCLK_APB; // if power management is enabled baudrate may change with the APB Frequency!
515515
}
516516
#else
517517
// Default CLK Source: CLK_APB for ESP32|S2|S3|C3 -- CLK_PLL_F40M for C2 -- CLK_PLL_F48M for H2 -- CLK_PLL_F80M for C6

0 commit comments

Comments
 (0)