Open
Description
Currently the logic for selecting the UART prescaler is very simple. This should be made a lot smarter -- I believe we want to select the smallest prescaler such that (UART source clock freq) / (prescaler) <= (baudrate) * 4096. As for how to determine the UART clock source frequency, see UART_SetConfig()
in the HAL. Also see UARTPrescTable
as a way to map prescaler bitfield values to numbers.
Until this is done, using low baudrates on STM32 can cause problems -- e.g. if LPUART is clocked by HSI on STM32H7, and there is no LSE oscillator, the lowest baudrate that can be used is 15625 baud!