UNIT 10 · MOVING AND PROCESSING DATA
Serial Communication
Move bytes between chips, one bit at a time.
Almost every sensor, memory chip, radio and debug console talks to the microcontroller over a serial link: a UART, SPI or I²C on the board, RS-485 or CAN across a machine. Each one answers the same questions differently: how the receiver finds the bits, who drives which wire, how devices are addressed, and what happens when noise corrupts a byte.
The unit in six ideas
- 1Serial links need few wires; the receiver must recover bit timing and framing from the stream.
- 2Cross TX and RX, share ground, and match logic levels; RS-232 needs a transceiver.
- 3SPI has a controller-driven clock, two data lines and one chip select per device; every clock moves a bit each way.
- 4I²C has two open-drain lines with pull-ups; any device can pull low to acknowledge or stretch the clock.
- 5Single-ended receivers see noise and ground differences directly; differential receivers see only the difference between two wires.
- 6Mark packet boundaries with a length field, a delimiter with escaping (SLIP: C0, DB DC, DB DD) or an idle gap (Modbus t3.5).
Lessons
Serial Data, Framing, and Synchronization
How does the receiver know?
UART and Asynchronous Serial Communication
With no clock wire, how close do two UARTs have to be, and what else can lose a byte?
SPI and Synchronous Serial Communication
What does it take to get it right?
I²C and Two-Wire Addressed Communication
Two wires, dozens of devices, no chip selects: how does I²C work, and how does it fail?
Differential and Multinode Networks
How do industrial and automotive systems run many devices over long, noisy cables?
Packet Design, Checksums, and Timeouts
What turns it into a protocol you can trust?