Skip to content
Tactiverge

Computer engineering · also Electrical engineering

Serial communication: UART, I2C and SPI

Chips exchange data serially, one bit after another. A UART sends bytes framed by start and stop bits at an agreed baud rate, with no shared clock. I2C connects many devices to two shared wires, using addresses to say who is being spoken to and pull-up resistors on its open-drain lines. SPI uses a clock, separate data lines in each direction and a chip-select line for each device, which makes it faster but needs more wires. On top of any link, a message protocol adds start markers, lengths and checksums so that corrupted messages can be detected.

Why it mattersA robot's microcontroller typically reads its motion sensor over I2C or SPI and talks to a larger computer over a serial link.

Learn it

  1. 1Serial communication and UARTEmbedded Systems · Embedded communication
  2. 2I2C: many devices on two wiresEmbedded Systems · Embedded communication
  3. 3SPI: fast transfers with chip selectEmbedded Systems · Embedded communication
  4. 4Designing a message protocolEmbedded Systems · Embedded communication