Check MCU UART prescaler quantization and stop-bit sampling drift
Asynchronous UART receivers resynchronize on the falling edge of the Start bit and then sample each subsequent bit near its midpoint using an internal clock divided from F_osc. Because baud prescalers have finite integer or fractional resolution, the synthesized baud rate often deviates slightly from the standard rate.
Accumulated clock error grows across every bit in the frame. By the time the receiver samples the center of the Stop bit (9.5 bit times into an 8N1 frame), combined TX + RX baud error plus crystal or RC oscillator tolerance must remain well below ±50% of one bit period—typically budgeted at ≤2.0% per side.
Formulas
Divisor_ideal = F_osc ÷ (Oversampling × Target_Baud)Baud Error (%) = 100 × (Actual_Baud − Target_Baud) ÷ Target_BaudStop-bit drift (%) = (|Baud_Error%| + 2 × Osc_Tolerance%) × (Frame_Bits − 0.5)
Worked example
An AVR ATmega328P at 16 MHz with 16× oversampling targeting 115,200 bps computes ideal divisor 8.68, rounding to integer 9 (UBRR = 8). That yields 111,111 bps (−3.55% error), which risks framing errors unless switched to 8× mode (U2X = 1, +2.12% error) or a 14.7456 MHz crystal.