AVR ATmega328P 16MHz 115200 Baud Rate Error & UBRR Calculator

Check why ATmega328P 16 MHz hits −3.55% error at 115,200 bps in 16x mode and how U2X=1 (8x oversampling) fixes UBRR framing drift.

Jump to results

Inputs

MCU clock & divider
Frame & oscillator budget
Crystal ~20–50 ppm; internal RC ~10,000 ppm (1%).

Results

Estimates
Baud rate timing error-3.549%
Actual synthesized baud
111,111.1 bps
Prescaler register
UBRR = 8 (div 9)
Ideal vs. actual divisor
8.681 → 9
Stop-bit worst-case drift
33.81% of 1 bit
Bit / frame duration
9 µs / 90 µs
Link margin screen
Fail (framing error risk)
Bit-timing & receiver sampling drift (10-bit frame)
ST D0 D1 D2 D3 D4 D5 D6 D7 SP Ideal center tick (dashed) vs. drifted RX sample dot (amber) Baud error: -3.549% · Stop-bit worst-case drift: 33.81% of 1 bit
Standard baud rates at this clock
Target bpsActual bpsRegisterError %Status
9,6009,615.4UBRR = 103 (div 104)+0.16%Pass (reliable)
19,20019,230.8UBRR = 51 (div 52)+0.16%Pass (reliable)
38,40038,461.5UBRR = 25 (div 26)+0.16%Pass (reliable)
57,60058,823.5UBRR = 16 (div 17)+2.12%Marginal
115,200111,111.1UBRR = 8 (div 9)-3.55%Fail (framing error risk)
230,400250,000UBRR = 3 (div 4)+8.51%Fail (framing error risk)
460,800500,000UBRR = 1 (div 2)+8.51%Fail (framing error risk)
921,6001,000,000UBRR = 0 (div 1)+8.51%Fail (framing error risk)

Keep single-side baud error under ±2.0% and total TX+RX stop-bit drift well below 45% of one bit period to prevent UART framing errors.

Solve the classic 16 MHz Arduino / AVR 115,200 baud timing error

On an ATmega328P running at 16 MHz, standard 16× oversampling (U2X0 = 0) gives an ideal divisor of 8.6805. Rounding to integer divisor 9 (UBRR0 = 8) produces 111,111 bps—a −3.55% error that drifts 33.7% of a bit by the stop bit and frequently corrupts serial bytes.

Load the U2X=1 preset (8× oversampling) to see divisor 17 (UBRR0 = 16) synthesize 117,647 bps (+2.12% error), which is why the Arduino HardwareSerial core enables U2X0 automatically.

Formulas

  • UBRR = round(F_osc ÷ (Oversampling × Baud)) − 1
  • 16× mode: 16,000,000 ÷ (16 × 9) = 111,111 bps (−3.55%)
  • 8× mode (U2X=1): 16,000,000 ÷ (8 × 17) = 117,647 bps (+2.12%)

Worked example

At 16 MHz with 16× oversampling, UBRR = 8 yields −3.55% error (Fail). Switching to 8× oversampling (UBRR = 16) drops error to +2.12%, or switching to 57,600 bps (8×) achieves −0.79%.

Frequently asked questions

Which baud rates have 0.00% error on a 16 MHz AVR?

250,000 bps, 500,000 bps and 1,000,000 bps divide 16 MHz with exact integer ratios and 0.00% error—making 250 kbps or 500 kbps ideal for USB-serial debug links.

What crystal frequency gives 0.00% error at 115,200 baud?

A 14.7456 MHz or 18.432 MHz "baud-rate crystal" divides evenly into 9600, 19200, 38400, 57600 and 115200 bps with zero quantization error.

Does U2X=1 reduce noise immunity on long cables?

Slightly, because 8× oversampling gives fewer sub-bit samples for the receiver’s majority-vote detector, though the improved baud accuracy usually outweighs it on short links.