mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 20:54:32 +02:00
Merge branch 'fix/lp_core_uart_clk_init' into 'master'
fix(lp_uart): Fixed LP UART bus clock initialization flow See merge request espressif/esp-idf!29680
This commit is contained in:
@@ -41,9 +41,6 @@ static esp_err_t lp_core_uart_param_config(const lp_core_uart_cfg_t *cfg)
|
|||||||
return ESP_ERR_INVALID_ARG;
|
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 */
|
/* Get LP UART source clock frequency */
|
||||||
uint32_t sclk_freq = 0;
|
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;
|
soc_periph_lp_uart_clk_src_t clk_src = cfg->lp_uart_source_clk ? cfg->lp_uart_source_clk : LP_UART_SCLK_DEFAULT;
|
||||||
@@ -55,9 +52,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 clock source is mixed with other peripherals in the same register
|
||||||
LP_UART_SRC_CLK_ATOMIC() {
|
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);
|
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 */
|
/* Override protocol parameters from the configuration */
|
||||||
lp_uart_ll_set_baudrate(hal.dev, cfg->uart_proto_cfg.baud_rate, sclk_freq);
|
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);
|
uart_hal_set_parity(&hal, cfg->uart_proto_cfg.parity);
|
||||||
|
Reference in New Issue
Block a user