Paritian

Electricity

UART Baud Rate Calculator (Error, Divisor and Transfer Time)

The divisor to load for a baud rate, the error it leaves with your clock (in normal and double-speed mode), the bits that make up a frame, the real data rate and the time to send a message.

Results

Baud-rate error with the best divisor 0.16 %
Divisor to load (UBRR on AVR) 103
Baud rate you will really get 9615.4 baud
Error in double-speed mode (U2X) 0.16 %
Bits on the wire per byte 10 bit
Share of the line carrying data 80.0 %
Data rate 960.0 B/s
Time to send the message 104.17 ms
How it changes
Baud-rate error with the best divisorBaud rate wanted 1200 – 115,200. Baud-rate error with the best divisor: 0.040016 → -3.54938Baud-rate error with the best divisor-6-4-2024620,00040,00060,00080,000100,000Baud rate wanted (baud)

The dashed line marks the value you entered.

What this tool does

A UART derives its baud rate by dividing the microcontroller clock, which is why not every speed is exact: on an AVR, UBRR = f_osc ÷ (16 × baud) − 1 must be a whole number, so 9600 baud from a 16 MHz clock is really 9615 baud, 0.16 % too fast. Two ends can talk if their combined error stays within a few percent, and a rule of thumb is to keep each under about 2 %. Each byte also costs more than 8 bit times: start and stop bits and an optional parity bit make 10 bits for the common 8N1 format, so 9600 baud carries 960 bytes per second, not 1200.

Formula

UBRR = f_osc ÷ (16 × baud) − 1 (best of the two nearest integers) · error = actual ÷ wanted − 1 · frame = 1 + data + parity + stop bits · time = bytes × frame ÷ baud

Variables

SymbolMeaningUnit
baBaud rate wantedbaud
dbData bitsbit
paParity—
sbStop bits—
nbyMessage lengthB
foMicrocontroller clockMHz
ERBaud-rate error with the best divisor%
UBDivisor to load (UBRR on AVR)—
ABBaud rate you will really getbaud
E2Error in double-speed mode (U2X)%
FRBits on the wire per bytebit
EFShare of the line carrying data%
DRData rateB/s
TMTime to send the messagems

Worked example

  • Baud rate wanted9600 baud
  • Data bits8 bit
  • Parity0
  • Stop bits1
  • Message length100 B
  • Microcontroller clock16 MHz
  • Baud-rate error with the best divisor0.16 %
  • Divisor to load (UBRR on AVR)103
  • Baud rate you will really get9615.4 baud
  • Error in double-speed mode (U2X)0.16 %
  • Bits on the wire per byte10 bit
  • Share of the line carrying data80.0 %
  • Data rate960.0 B/s
  • Time to send the message104.17 ms

Limitations

  • Coverage and consumption figures vary between products. Take the values from the manufacturer's datasheet for the product you are actually using.
  • The result is an estimate based only on the values you type. Real situations often include factors this calculator does not know about.