esp32/uart: Use xtal as UART clock source on S3 and C3.
Change UART clock source on S3/C3 so the UART can operate when CPU frequency is below 80MHz. This allows the UART to remain operational when using Dynamic Frequency Scaling (DFS). Signed-off-by: Patrick Joy <patrick@joytech.com.au>
This commit is contained in:
parent
05e143dbdd
commit
a802f71908
@ -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,
|
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
||||||
.rx_flow_ctrl_thresh = 0
|
.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
|
// create instance
|
||||||
machine_uart_obj_t *self = mp_obj_malloc(machine_uart_obj_t, &machine_uart_type);
|
machine_uart_obj_t *self = mp_obj_malloc(machine_uart_obj_t, &machine_uart_type);
|
||||||
|
@ -46,6 +46,10 @@ void uart_stdout_init(void) {
|
|||||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
||||||
.rx_flow_ctrl_thresh = 0
|
.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);
|
uart_param_config(MICROPY_HW_UART_REPL, &uartcfg);
|
||||||
|
|
||||||
const uint32_t rxbuf = 129; // IDF requires > 128 min
|
const uint32_t rxbuf = 129; // IDF requires > 128 min
|
||||||
|
Loading…
Reference in New Issue
Block a user