Baud-rate divisor, error and frame time
In asynchronous serial communication (UART) no clock is sent: transmitter and receiver agree on a speed in baud and each one generates it by dividing its own clock. Since the division is rarely exact, the actual speed deviates a little. If the difference between both ends is too large, the receiver reads the last bits of each byte at the wrong place.
Green: error up to 1 %. Yellow: up to 2 %, works if the other end is exact. Red: unreliable.
The receiver synchronises with the start-bit edge and samples each bit at its centre. With 10 bits per frame, the last one is sampled about 9.5 bits after the edge; if the sum of both ends’ errors exceeds half a bit width over that time (≈ 5 %), the byte is lost. Allowing margin for noise and edge shape, a total error of up to 2 to 3 % is considered safe, i.e. around 1 to 1.5 % at each end.
With a 16 MHz crystal, 115,200 baud gives a 3.5 % (U2X: 2.1 %) error on an AVR. That is why “baud-rate” crystals exist, such as 1.8432, 7.3728, 11.0592 or 14.7456 MHz: they are exact multiples of 115,200 × 16 and every common rate comes out with zero error. Microcontrollers with fractional divisors solve the problem without changing crystal.
| Standard | Levels | Distance | Notes |
|---|---|---|---|
| TTL / CMOS | 0 V and 3.3 or 5 V; idle high | A few centimetres to 1 m | The one at the microcontroller pins |
| RS-232 | ±3 to ±15 V, inverted: logic 1 is negative | Up to about 15 m | Needs a MAX232 or similar; point to point |
| RS-485 | Differential, ±1.5 to ±5 V between A and B | Up to 1200 m | Several nodes on a bus; half-duplex with two wires |
Related: RS-485 and CAN buses, crystal oscillator, logic level shifting and parity and CRC.