2010-08-13 12:48 PM
USART_BRR value calculation
2011-05-17 05:02 AM
In the hardware, as opposed to the docs, the BRG is a simple integer, 16 times the baud rate. Baud rate = input clock / (BRG*16).
2011-05-17 05:02 AM
I think they are just having some fun with fraction numbers using integer math.
As PICGuy notes, If you look at the hardware and know the USARTs internal clock needs to be 16X the baud rate, and the fractional part is 4-bits, you can get to a usable rate by dividing the APB clock for the USART by the baud rate desired and get a 12.4 fixed point representation. Now even if I was worried about the rounding, I can see more elegant ways of achieving this with some 32-bit integer math than the ''beautiful'' ST example.