2022-04-16 08:47 AM
USART baud rate related stuff has a long history of errors in both the STM32 documents and sample code. Looks like in the past 4 years some of the problems were corrected but there are still some strange and incorrect pieces.
STM32F10x manual, RM0008 Rev 2, page 799 contains the old, overwhelmingly complex formula for BRR instead of the simple one found in newer manuals for F0 and L4 series.
My proposal is to unify the text in all the manuals, to correctly state the BRR value as ROUNDED result of division usart_input_clock / baud_rate, equivalent to (usart_input_clock + baud_rate / 2) / baud_rate in integer arithmetic. Even the new manuals don't say a word about rounding, which is quite important for minimizing baud rate errors.
STM32L4 manual RM0394 Rev 4, page 1211: the table at the bottom of the page seems to be incorrect. Here is my version of the relevant entries with differences marked in red:
STM32F0 manual, RM0081 Rev9, page 704 - probably similar problem: