How the baud rate is made
A microcontroller's UART divides its clock down to the baud rate. On AVR chips such as the ATmega328P, the divisor is set in the UBRR register:
- Normal mode:
UBRR = FCPU / (16 × baud) − 1, rounded to a whole number - Double speed mode (U2X = 1):
UBRR = FCPU / (8 × baud) − 1
Rounding means the real baud rate is a little off. The error is actual / wanted − 1. At 16 MHz, 9600 baud needs UBRR = 103 with 0.2 % error, but 115200 needs UBRR = 8, which is 3.5 % slow. Double speed mode brings that down to 2.1 %. These match the tables in the ATmega328P datasheet.
How much error is too much?
The receiver samples each bit in the middle, and an error builds up across the frame until the stop bit. The combined error of both ends must stay small enough that the last bit is still sampled inside its slot. As a rule of thumb, keep each side within about ±2 %. The datasheet gives exact limits for each frame size. A crystal or a clock like 14.7456 MHz, which divides exactly into standard rates, gives 0 % error.
Real throughput
Each byte is wrapped in a frame: a start bit, the data bits, an optional parity bit and one or two stop bits. With the common 8N1 setting, that's 10 bits per byte, so 115200 baud carries at most 11,520 bytes per second.