mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(lp_uart): Fixed LP UART bus clock initialization flow
This MR updates the LP UART bus clock initialization flow to avoid a lock up when accessing the LP UART peripheral.
This commit is contained in:
parent
3cd174ab09
commit
6d73dda897
@ -35,9 +35,6 @@ static esp_err_t lp_core_uart_param_config(const lp_core_uart_cfg_t *cfg)
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* Initialize LP UART HAL with default parameters */
|
||||
uart_hal_init(&hal, LP_UART_PORT_NUM);
|
||||
|
||||
/* Get LP UART source clock frequency */
|
||||
uint32_t sclk_freq = 0;
|
||||
soc_periph_lp_uart_clk_src_t clk_src = cfg->lp_uart_source_clk ? cfg->lp_uart_source_clk : LP_UART_SCLK_DEFAULT;
|
||||
@ -49,9 +46,14 @@ static esp_err_t lp_core_uart_param_config(const lp_core_uart_cfg_t *cfg)
|
||||
|
||||
// LP UART clock source is mixed with other peripherals in the same register
|
||||
LP_UART_SRC_CLK_ATOMIC() {
|
||||
/* Enable LP UART bus clock */
|
||||
lp_uart_ll_enable_bus_clock(0, true);
|
||||
lp_uart_ll_set_source_clk(hal.dev, clk_src);
|
||||
}
|
||||
|
||||
/* Initialize LP UART HAL with default parameters */
|
||||
uart_hal_init(&hal, LP_UART_PORT_NUM);
|
||||
|
||||
/* Override protocol parameters from the configuration */
|
||||
lp_uart_ll_set_baudrate(hal.dev, cfg->uart_proto_cfg.baud_rate, sclk_freq);
|
||||
uart_hal_set_parity(&hal, cfg->uart_proto_cfg.parity);
|
||||
|
Loading…
x
Reference in New Issue
Block a user