Decode a serial (UART) signal with an oscilloscope: an XBee radio, step by step
A serial port sends one bit after another on a single wire. An oscilloscope shows those bits and turns them back into the characters that were sent. Here is how, with a real radio, from the wiring to the decoded answer.
CH1What you need
An oscilloscope with a serial (RS232 or UART) decoder.
Something that talks serial: we use a Digi XBee-PRO S3B radio on a USB adapter. No radio? Try an ESP32's boot message.
A terminal program on the PC (PuTTY, screen, minicom).
CH2What a serial character looks like
The line rests high (3.3 V on an XBee). A character starts with a start bit (low), then 8 data bits, lowest first, then a stop bit (high): "8N1", 10 bit times a character.
The letter A (0x41, binary 01000001) as 8N1: the start bit, then D0 to D7 lowest bit first, then the stop bit.
One bit lasts 1 / baud rate: 17.4 µs at 57,600 baud. There is no clock wire: the receiver times every bit from the start bit's falling edge, so the scope triggers on that edge and both ends must agree on the rate. Don't know it? Find the baud rate.
CH3Step by step
Connect the probe. Probe tip on the radio's DOUT (pin 2 on a through-hole XBee) for its replies, ground clip on GND (pin 10). Open a terminal on the PC at the radio's baud rate: ours is 57,600, a new XBee 9600.
Set the channel. CH1 at 1 V/div, DC coupling, probe 10× (the probe's switch at 10× too). Move the trace down so 0 to 3.3 V is on screen.
Trigger on the start bit. Edge trigger, source CH1, slope Falling, level 1.6 V (half the swing): every character starts by pulling the line low.
Pick a time base. 500 µs/div at 57,600 baud (2 ms/div at 9600), the trigger point toward the left edge.
Turn on the decoder. The scope's serial (RS232/UART) decoder: source CH1, threshold 1.6 V, the line idling high, 57,600 baud, 8 data bits, no parity, 1 stop bit, ASCII.
Capture the radio's OK. Press Single, type +++ in the terminal (no Enter) and wait. The radio answers OK, decoded under its bits.
Capture a real answer. Press Single and, within 10 seconds, type ATVR and Enter. The radio answers with its firmware version.
The XBee takes commands only in command mode: one second of silence, +++, another second of silence, and it answers OK. Commands are AT plus two letters, ended by Enter (Digi's XBee-PRO S3B user guide, 90002173). Other devices: send them any text.
CH4Both directions at once
Probe each direction on its own pin: CH1 on DOUT as the decoder's Tx, CH2 on DIN as its Rx, both at 1.6 V, and trigger on CH2. The decoder shows your command, then the radio's answer.
On Digi's XBee Grove Development Board, probe header J3 (Digi's user guide 90001457):
Probing both directions on Digi's XBee Grove Development Board: CH1 on J3 pin 2 (DOUT), CH2 on J3 pin 3 (DIN), both ground clips on J3 pin 10 (GND), the P11 jumper on UART.
If the decode looks wrong
What you see
What to change
"Waiting for a trigger"
Nothing was sent while armed, or the level is outside the swing. Arm first, then send (why).
Wrong characters, error marks
The baud rate is wrong: measure it, or use the decoder's Auto setting if it has one.
Every character wrong at the right rate
Inverted polarity. Logic-level UART idles high (Positive); a real RS-232 port idles negative (Negative, threshold near 0 V).
Garbled at a slow time base
Too few samples a bit: use a faster time base or deeper memory.
A small 60 Hz wave, no characters
The probe is not on the line, or the device is off: that is mains hum.
Questions
Can any oscilloscope decode UART?
Any scope shows the bits, and you can read them by eye from the start bit, lowest bit first. A serial decoder writes the characters for you.
What is the difference between UART, TTL serial and RS-232?
A UART on a circuit board swings between 0 V and 3.3 V or 5 V and rests high (TTL serial). RS-232 is a cable standard whose resting line is negative. Same characters; different polarity and threshold.
Which pin do I probe, TX or RX?
The TX of the device you want to read. On a through-hole XBee that is DOUT, pin 2.