Skip to content
Snippets Groups Projects
Commit 1191ec6a authored by Tobias Badertscher's avatar Tobias Badertscher Committed by Damien George
Browse files

stmhal/uart.c: Fix wrong baudrate calculation for stm32l4 series.

parent 43c8f545
No related branches found
No related tags found
No related merge requests found
...@@ -579,11 +579,7 @@ STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, mp_uint_t n_args, con ...@@ -579,11 +579,7 @@ STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, mp_uint_t n_args, con
} else { } else {
actual_baudrate = HAL_RCC_GetPCLK1Freq(); actual_baudrate = HAL_RCC_GetPCLK1Freq();
} }
#if defined(MCU_SERIES_L4)
actual_baudrate = (actual_baudrate << 5) / (self->uart.Instance->BRR >> 3);
#else
actual_baudrate /= self->uart.Instance->BRR; actual_baudrate /= self->uart.Instance->BRR;
#endif
// check we could set the baudrate within 5% // check we could set the baudrate within 5%
uint32_t baudrate_diff; uint32_t baudrate_diff;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment