Skip to content

Commit a9082d4

Browse files
authored
fix(uart): uses REF_TICK for ESP32/S2
1 parent 357db7c commit a9082d4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cores/esp32/esp32-hal-uart.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -507,9 +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
511+
uart_config.source_clk = UART_SCLK_REF_TICK; // valid for ESP32, S2
510512
#else
511513
// 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
512-
uart_config.source_clk = UART_SCLK_DEFAULT; // valid for ESP32 and S2
514+
uart_config.source_clk = UART_SCLK_DEFAULT; // baudrate may change with the CPU Frequency!
513515
#endif
514516

515517
UART_MUTEX_LOCK();

0 commit comments

Comments
 (0)