summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/esp32/machine_uart.c4
-rw-r--r--ports/esp32/uart.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/ports/esp32/machine_uart.c b/ports/esp32/machine_uart.c
index 4cfa31b71..8e6e5788d 100644
--- a/ports/esp32/machine_uart.c
+++ b/ports/esp32/machine_uart.c
@@ -319,6 +319,10 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = 0
};
+ #if SOC_UART_SUPPORT_XTAL_CLK
+ // works independently of APB frequency
+ uartcfg.source_clk = UART_SCLK_XTAL; // ESP32C3, ESP32S3
+ #endif
// create instance
machine_uart_obj_t *self = mp_obj_malloc(machine_uart_obj_t, &machine_uart_type);
diff --git a/ports/esp32/uart.c b/ports/esp32/uart.c
index f6493dc79..e871ca1d7 100644
--- a/ports/esp32/uart.c
+++ b/ports/esp32/uart.c
@@ -46,6 +46,10 @@ void uart_stdout_init(void) {
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = 0
};
+ #if SOC_UART_SUPPORT_XTAL_CLK
+ // works independently of APB frequency
+ uartcfg.source_clk = UART_SCLK_XTAL; // ESP32C3, ESP32S3
+ #endif
uart_param_config(MICROPY_HW_UART_REPL, &uartcfg);
const uint32_t rxbuf = 129; // IDF requires > 128 min