Wiki · Read the guide: UART baud rate error

UART Baud Error

Check a UART configuration: from the peripheral clock and the desired baud get the divisor, actual baud and percentage error, and see at a glance which standard bauds are "clean" at that clock. Demonstration tool.

1 · Peripheral

Clock
Baud

Result

Error vs target —
— — bps actual
Ideal divisor —
Integer divisor —

Generator error: low below 2%, moderate at 2–3%, high above 3%. These bands do not verify the link; clock, line and receiver limits must be included.

Standard bauds at this clock

Baud Divisor Actual baud Error Status

How does a UART generate the baud?

In the tool model, baud equals peripheral clock divided by oversampling and the representable divisor. The result shows error relative to the requested baud, assuming the entered clock is exact. Device registers, prescalers and limits require its manual.

A UART has no baud-rate oscillator of its own: it divides the peripheral clock. A generator samples each bit several times (oversampling, typically 16× or 8×) and a divisor brings the clock down to the baud rate:

div=fperiphoversampling⋅baudtarget\text{div} = \dfrac{f_{\text{periph}}}{\text{oversampling} \cdot \text{baud}_{\text{target}}}baud=fperiphoversampling⋅divint\text{baud} = \dfrac{f_{\text{periph}}}{\text{oversampling} \cdot \text{div}_{\text{int}}}errore=baudreale−baudtargetbaudtarget⋅100\text{errore} = \dfrac{\text{baud}_{\text{reale}} - \text{baud}_{\text{target}}}{\text{baud}_{\text{target}}} \cdot 100

Why does the error appear?

Rounding the divisor can shift baud: at 16 MHz, 115200 baud and S=16, integer divisor 9 gives about 111111 baud, error −3.549%. The effect on reception also depends on the other endpoint and receiver limits.

Calculate nominal error for the actually representable divisor. Comparing two baud rates on the same clock requires recalculating both: the same oscillator’s relative tolerance does not itself change between 9600 and 115200.

Generator error and receiver margin

In the geometrical model illustrated in the wiki, (0.5−2/S)/(n−0.5) gives about 3.95% for a 10-interval frame and S=16. It is an approximation allowing three samples within the window, not a universal majority-vote tolerance. Actual limits depend on receiver and configuration.

16× vs 8× oversampling

In the STM32F4 USARTs documented by RM0090, OVER8 selects 16 or 8 intervals per bit and ONEBIT selects a central sample or three-sample voting. Tolerance also depends on format and divisor fraction: oversampling alone does not determine it.

What is the fractional divisor?

The tool’s fractional grid has step 1/16. At 16 MHz and 115200 baud, d=8.6875 gives about −0.080%. In STM32F4 RM0090 the step is 1/16 with OVER8=0 and 1/8 with OVER8=1: the tool model does not replace that encoding.

Divisor 1.5 at 48 MHz, 2 Mbaud and S=16 is exactly 24/16: nominal error is zero. A worst-case quantization bound is not this configuration’s error; the wiki distinguishes the exact bound from its approximation.

Choosing the right clock

The clocks suited to serial are multiples of the baud times the oversampling: at 16× a clock like 14.7456 MHz gives zero error across the whole 9600–921600 family, because 14.7456e6 / 16 = exactly 921600. This is why crystals like 14.7456 MHz exist. If the clock is constrained elsewhere, the fractional divisor is the cure.

What are the tool’s limitations?

Only nominal generator error is calculated, with a 1/16 fractional grid. Actual clocks, jitter, line behaviour and receiver tolerance are not modelled. Colours indicate error guidance bands, not communication-verification outcomes.

  • The tool’s fractional grid is 1/16; STM32F4 USARTs in RM0090 require 1/8 and the corresponding BRR encoding when OVER8=1.
  • It considers only the baud-generator error: it does not model the source-clock tolerance (crystal/PLL) nor jitter, which contribute to the mismatch between endpoints.
  • Demonstration tool: real configuration relies on the UART reference manual and the peripheral registers.