UART Waveform Drawer (Bits, Baud, RS-232 Levels)
Draw the UART bit waveform of text or hex (start, data LSB first, parity, stop) at TTL or RS-232 levels, with frame time and baud from a measured pulse.
The UART frame
- The idle line is 1 (mark). A 0 start bit lets the receiver synchronise, then the data bits arrive LSB (bit 0) first.
- Parity: even (E) makes the count of 1s in data + parity even, odd (O) makes it odd. Mark and space are always 1 and 0.
- Stop bits are 1, lasting 1, 1.5 or 2 bit times. The next start bit may follow the stop bit immediately.
- Frame time = (1 + data + parity + stop) ÷ baud. 8N1 is 10 bits, 8E1 is 11 bits.
TTL vs RS-232 levels
- An MCU UART pin (TTL/CMOS level) has 1 = high (3.3 V or 5 V) and 0 = 0 V.
- RS-232 (TIA/EIA-232) is inverted: 1 (mark) is negative, 0 (space) is positive. Drivers output ±5 to ±15 V; receivers read below −3 V as 1 and above +3 V as 0. An idle RS-232 line is negative and the start bit swings positive.
- Never wire an MCU pin straight to an RS-232 (DB9) port — the voltages and polarity do not match. Use a transceiver such as a MAX232.
- USB-UART adapters come in «TTL» and «RS-232» versions. On a scope, a positive idle level means TTL, a negative one RS-232.
Standard baud rates and bit time
| Baud | 1 bit (µs) | 8N1 frame (µs) |
|---|---|---|
| 300 | 3333.333 | 33333.33 |
| 600 | 1666.667 | 16666.67 |
| 1200 | 833.333 | 8333.33 |
| 2400 | 416.667 | 4166.67 |
| 4800 | 208.333 | 2083.33 |
| 9600 | 104.167 | 1041.67 |
| 14400 | 69.444 | 694.44 |
| 19200 | 52.083 | 520.83 |
| 28800 | 34.722 | 347.22 |
| 38400 | 26.042 | 260.42 |
| 57600 | 17.361 | 173.61 |
| 76800 | 13.021 | 130.21 |
| 115200 | 8.681 | 86.81 |
| 230400 | 4.34 | 43.4 |
| 250000 | 4 | 40 |
| 460800 | 2.17 | 21.7 |
| 500000 | 2 | 20 |
| 921600 | 1.085 | 10.85 |
| 1000000 | 1 | 10 |
FAQ
How do I measure the baud rate with a scope?
Measure the shortest pulse (one bit) and take 1 ÷ width. 104 µs is about 9600 bps, 8.68 µs about 115200 bps. Runs of equal bits are several bits long, so use the shortest.
I get garbled characters
Likely causes: baud, data bits, parity or stop bits differ between the two sides; TTL wired straight to RS-232 (polarity and voltage); clock error. For baud error use the UART Baud Rate Error Calculator.
When are 1.5 stop bits used?
Mainly with 5 data bits (on PC UARTs, choosing «2» with 5 data bits gives 1.5). Rare in current equipment.
For baud error, use the UART Baud Rate Error Calculator; For the Modbus 3.5-character gap, use the Serial Timing Calculator. For SPI, I2C and CAN: SPI Mode Helper · I2C Tools · CAN Frame Decoder
Sources
- Microchip, ATmega328P datasheet (7810D, 01/2015): §19.4 Frame Formats (figure 19-4), §19.4.1 Parity Bit Calculation
- Texas Instruments SLLA037A «Interface Circuits for TIA/EIA-232-F» — electrical specification figure (driver ±5 to ±15 V, receiver ±3 V; mark negative, space positive)
- Microsoft Learn, DCB structure (winbase.h) — ByteSize, Parity (NOPARITY, ODDPARITY, EVENPARITY, MARKPARITY, SPACEPARITY), StopBits (ONESTOPBIT, ONE5STOPBITS, TWOSTOPBITS)