UART Baud Error
Pick a clock and a baud rate to get the register value, the actual baud and the percent error. Then check it against the receiver's tolerance budget, with both ends' dividers and both clocks counted.
1 · Peripheral
2 · Link
3 · Clock tolerances
Result
Link budget
Error vs peripheral clock
This model and baud, swept across clocks. Zero-error clocks are integer multiples of the baud × oversampling. The dashed lines are the per-side allowance.
Standard bauds at this clock
| Baud | Register | Actual | Error | Status |
|---|
Clocks for this baud
Common MCU and serial-friendly crystal frequencies, best first.
| Clock | Register | Actual | Error | Status |
|---|
Where baud error comes from, and how much the receiver tolerates
A UART baud generator divides the peripheral clock. The divisor has to be an integer, or an integer plus a few fractional bits, so the actual rate is rarely the one you asked for:
The receiver resynchronizes on every start-bit edge and then free-runs. By the time it samples the last bit, the first stop bit, any rate mismatch has built up over n − 0.5 bit times. That sample must still land inside the bit, less the uncertainty of where the start edge was detected:
That figure is the total for the link. Your divider error, the far end's divider error and both clock tolerances all spend it. A crystal at ±50 ppm costs 0.005 % per end, so it barely registers. An internal RC oscillator at ±1–2 % can use half the budget on its own, which is why UARTs run from an uncalibrated HSI fail intermittently on cold mornings.
Register models
- STM32 USART: with OVER8=0,
BRR = round(f/baud). With OVER8=1,USARTDIV = round(2f/baud),BRR[2:0] = USARTDIV[3:0] » 1and BRR[3] is clear, so bit 0 is lost and the actual rate uses the even value. F1/F4 parts with mantissa and fraction produce identical numbers. - STM32 LPUART:
BRR = round(256·f/baud)(20 bits, ≥ 0x300). This lets a 32.768 kHz LSE run 9600 Bd in Stop mode. - AVR:
UBRR = round(f/(16·baud)) − 1. U2X=1 halves the oversampling to 8. - Generic: a 16550-style integer divisor, or an integer plus a 4-bit fraction (1/16 steps), as on many MCUs.
Limits
- This models the baud generator and clock tolerance only. Edge jitter, slow RC edges on long cables and isolator skew also eat into the budget.
- The STM32 prescaler (PRESC on G0/G4/H7/U5) is not modelled. Divide f_clk by your prescaler before entering it. Vendor reference manuals tabulate slightly tighter tolerance figures that include their own sampling details, so for production margins use the reference manual's table.
References
- STMicroelectronics, STM32 reference manuals: USART "Baud rate generation" and "Tolerance of the USART receiver to clock deviation" (e.g. RM0360, RM0351, RM0433).
- Microchip, ATmega328P datasheet: USART0 "Baud Rate Generation" and the UBRRn example tables.
- Maxim Integrated (Analog Devices), Application Note 2141, Determining Clock Accuracy Requirements for UART Communications.
Bringing up a board that won't talk?
Kyros does embedded bring-up for a living: clocks, UART/CAN/SPI timing, and the firmware that has to survive temperature and production tolerance.
