Kyros Engineering Engineering Tools
Home › Tools › UART Baud Error
// Embedded tools Proto v0.1STM32AVR8N1 budget

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.

Runs entirely in your browser. Nothing is uploaded.

1 · Peripheral

Hz

2 · Link

Bd

3 · Clock tolerances

±ppm
±ppm
±%

Result

Error vs target
—
Actual baud
—
Ideal divisor
—
Divisor used
—
Register
—

Link budget

Receiver tolerance
—
Used (both ends)
—
Margin
—
—

Init snippet


      

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

BaudRegisterActualErrorStatus

Clocks for this baud

Common MCU and serial-friendly crystal frequencies, best first.

ClockRegisterActualErrorStatus
// How it works

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:

ideal divisor D = f_clk / (OS · baud) actual baud = f_clk / (OS · D_quantized) error % = (actual − target) / target · 100

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:

|e|max = (0.5 − q) / (n − 0.5) n = start + data + parity + 1 stop (8N1 → n = 10) q = 1/OS (single sample) or 2/OS (majority of three) 8N1, 16× majority → 3.95 % 8N1, 16× single → 4.61 % 8N1, 8× majority → 2.63 %

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

Limits

References

  1. STMicroelectronics, STM32 reference manuals: USART "Baud rate generation" and "Tolerance of the USART receiver to clock deviation" (e.g. RM0360, RM0351, RM0433).
  2. Microchip, ATmega328P datasheet: USART0 "Baud Rate Generation" and the UBRRn example tables.
  3. 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.

Talk about your project →