Baud Rate / UART Register Calculator
USART BRR (STM32, over-sampling 8/16) and UBRR (AVR) register values with actual baud error %.
STM32 USART (BRR)
| Mode | Mantissa | Fraction | BRR (hex) | Actual baud | Error (%) |
|---|
AVR USART (UBRRn)
| Mode | UBRR | Actual baud | Error (%) |
|---|
How it works
STM32 USART baud rate is derived from the peripheral clock through the
16-bit BRR register, split into a mantissa and a fraction:
baud = fCK ÷ (8 × (2 − OVER8) × USARTDIV)
With over-sampling by 16 the fraction is 4 bits (/16 steps); with over-sampling
by 8 the fraction is 3 bits (/8 steps, stored left-shifted by one bit in the
register). Over-sampling by 8 allows higher baud rates for a given clock at the cost of noise
immunity.
AVR USARTs use a simpler 12-bit UBRRn divider:
UBRR = fOSC ÷ (8 or 16 × baud) − 1
Setting U2X = 1 (double speed) halves the divisor, trading accuracy for range
the same way STM32's over-sampling-by-8 does.