---
title: Serial Bus Protocols
url: https://doc.liz6.com/en/hardware/06-interfaces-and-communication/02-serial-bus-protocols
locale: en
area: hardware
tags:
- hardware
- interfaces-and-communication
date: 2026-06-30
modified: 2026-07-16
description: 'Serial Bus Protocols Parallel vs. Serial --- UART (Universal Asynchronous Receiver-Transmitter) Basic Concepts UART: Asynchronous Full-Duplex, Baud Rates of Tra…'
---

# Serial Bus Protocols

## Parallel vs. Serial

```
Parallel: Multiple lines transmit multiple bits simultaneously (8/16/32 bits at once)
          Fast but requires many wires; clock skew limits speed

Serial: Single line transmits bits sequentially
          Fewer wires, supports higher frequencies → Modern high-speed interfaces are all serial
```

---

## UART (Universal Asynchronous Receiver-Transmitter)

### Basic Concepts
<svg viewBox="0 0 720 300" xmlns="http://www.w3.org/2000/svg" font-family="-apple-system,'Source Han Sans CN','Microsoft YaHei',sans-serif" role="img" aria-label="UART Connection and Frame Format: Asynchronous Full-Duplex, TX and RX cross-connected">
  <defs>
    <marker id="uah" markerWidth="10" markerHeight="8" refX="8" refY="3" orient="auto"><path d="M0,0 L8,3 L0,6 Z" fill="#475569"/></marker>
  </defs>
  <rect width="720" height="300" fill="#ffffff"/>
  <text x="360" y="28" text-anchor="middle" font-size="17" font-weight="700" fill="#1f2933">UART: Asynchronous Full-Duplex, Baud Rates of Transmitter and Receiver Must Match</text>
  <text x="40" y="54" font-size="12" font-weight="700" fill="#1f2933">Connection: TX and RX are cross-connected (Full-Duplex simultaneous transmission and reception)</text>
  <rect x="40" y="64" width="130" height="56" rx="8" fill="#eef2ff" stroke="#c7d2fe"/>
  <text x="105" y="97" text-anchor="middle" font-size="13" font-weight="700" fill="#3730a3">MCU_A</text>
  <rect x="550" y="64" width="130" height="56" rx="8" fill="#eef2ff" stroke="#c7d2fe"/>
  <text x="615" y="97" text-anchor="middle" font-size="13" font-weight="700" fill="#3730a3">MCU_B</text>
  <line x1="170" y1="80" x2="550" y2="80" stroke="#475569" stroke-width="1.6" marker-end="url(#uah)"/>
  <text x="360" y="74" text-anchor="middle" font-size="11" fill="#64748b">TX → RX</text>
  <line x1="550" y1="108" x2="170" y2="108" stroke="#475569" stroke-width="1.6" marker-end="url(#uah)"/>
  <text x="360" y="124" text-anchor="middle" font-size="11" fill="#64748b">RX ← TX</text>
  <text x="40" y="150" font-size="12" font-weight="700" fill="#1f2933">Frame Format: Timing Structure of a Data Frame</text>
  <rect x="40" y="160" width="85" height="30" rx="5" fill="#e2e8f0"/>
  <text x="82" y="180" text-anchor="middle" font-size="10" fill="#475569">Idle (High)</text>
  <rect x="133" y="160" width="65" height="30" rx="5" fill="#4f46e5"/>
  <text x="165" y="180" text-anchor="middle" font-size="10" font-weight="700" fill="#ffffff">Start=0</text>
  <rect x="206" y="160" width="230" height="30" rx="5" fill="#0d9488"/>
  <text x="321" y="180" text-anchor="middle" font-size="11" font-weight="700" fill="#ffffff">D0 D1 D2 D3 D4 D5 D6 D7</text>
  <rect x="444" y="160" width="90" height="30" rx="5" fill="#cbd5e1" stroke="#94a3b8" stroke-dasharray="3 2"/>
  <text x="489" y="180" text-anchor="middle" font-size="10" fill="#475569">Parity? (Optional)</text>
  <rect x="542" y="160" width="75" height="30" rx="5" fill="#4f46e5"/>
  <text x="579" y="180" text-anchor="middle" font-size="10" font-weight="700" fill="#ffffff">Stop=1</text>
  <rect x="40" y="222" width="640" height="56" rx="8" fill="#eef2ff" stroke="#c7d2fe"/>
  <text x="54" y="244" font-size="12.5" fill="#3730a3">Baud Rate (9600 / 115200 / 921600…) must be identical on both sides, with error &lt; ±2%;</text>
  <text x="54" y="264" font-size="12.5" fill="#3730a3">Asynchronous without an independent clock line; relies on both sides aligning each bit according to the agreed baud rate.</text>
</svg>

### Parameters
| Parameter | Common Values |
|------|--------|
| Baud Rate | 9600, 19200, 38400, 57600, 115200 |
| Data Bits | 8 (most common), 7 |
| Stop Bits | 1, 2 |
| Parity | None, Even, Odd |
| Flow Control | None, RTS/CTS (Hardware) |

### Applications
```
Debug Serial Port (printf output to PC)
GPS/Bluetooth Modules (AT Commands)
Legacy Peripheral Communication

Pros: Simple, cheap, reliable
Cons: Point-to-point only, low speed, no standard application layer
```

---

## I2C (Inter-Integrated Circuit)

### Basic Concepts
```
Synchronous, Half-Duplex, Multi-Master Multi-Slave
2 Wires: SCL (Clock) + SDA (Data)

    Vcc
     │
    Rp  Rp          ← Pull-up Resistors (Required!)
     │   │
     ├───┼────────── SDA
     │   │
    ┌┴┐ ┌┴┐
    │Mst│ │Slv1│ │Slv2│ ...
    └─┘ └─┬┘ └─┬┘
          │    │
          ├────┼──── SCL
          │    │
         GND  GND

SCL: Clock provided by Master
SDA: Bidirectional Data (Open-Drain, Wired-AND)
Each Slave has a unique 7-bit (or 10-bit) address
```

### Communication Process
```
Start Condition: SDA↓ while SCL is High
  Send: 7-bit Address + R/W bit → Slave responds with ACK
  Transfer: 8-bit Data + ACK ... (can be continuous)
Stop Condition: SDA↑ while SCL is High

ACK: SDA=0 on the 9th clock cycle (Receiver Acknowledges)
NACK: SDA=1 on the 9th clock cycle (No Acknowledge)

Speed Modes:
  Standard: 100 kHz
  Fast:     400 kHz  (Most Common)
  Fast+:    1 MHz
  High Speed: 3.4 MHz
```

### Applications
```
Sensors (Temperature/Humidity/IMU/Light...)
EEPROM/FRAM Memory
RTC (Real-Time Clock Chips)
PMIC (Power Management ICs)
OLED Displays
Almost all low-speed peripherals

Pros: Only 2 wires, multiple devices share bus
Cons: Slow speed, pull-up design issues (power consumption), address conflicts
```

### Pull-up Resistor Selection
```
R too small → High power consumption (large sink current)
R too large → Slow rising edge → Speed limited

Rule of Thumb:
  100kHz: 4.7kΩ
  400kHz: 2.2kΩ
  1MHz:   1kΩ or smaller

Calculation: Rmax = tr / (0.8473 × Cbus)
     tr = 300ns (for 100kHz mode)
     Cbus = Bus Capacitance (Chip + PCB Traces)
```

---

## SPI (Serial Peripheral Interface)

### Basic Concepts
<svg viewBox="0 0 720 340" xmlns="http://www.w3.org/2000/svg" font-family="-apple-system,'Source Han Sans CN','Microsoft YaHei',sans-serif" role="img" aria-label="SPI Connection Diagram: Synchronous Full-Duplex, Master drives clock and chip select, four signal lines">
  <defs>
    <marker id="spah" markerWidth="10" markerHeight="8" refX="8" refY="3" orient="auto"><path d="M0,0 L8,3 L0,6 Z" fill="#475569"/></marker>
  </defs>
  <rect width="720" height="340" fill="#ffffff"/>
  <text x="360" y="28" text-anchor="middle" font-size="17" font-weight="700" fill="#1f2933">SPI: Synchronous Full-Duplex, Master exclusively controls clock and chip select (at least 4 wires)</text>
  <rect x="40" y="50" width="130" height="180" rx="8" fill="#eef2ff" stroke="#c7d2fe"/>
  <text x="105" y="134" text-anchor="middle" font-size="13" font-weight="700" fill="#3730a3">MCU</text>
  <text x="105" y="152" text-anchor="middle" font-size="11" fill="#4f46e5">(Master)</text>
  <rect x="550" y="50" width="130" height="180" rx="8" fill="#f0fdfa" stroke="#99f6e4"/>
  <text x="615" y="134" text-anchor="middle" font-size="13" font-weight="700" fill="#115e59">Peripheral</text>
  <text x="615" y="152" text-anchor="middle" font-size="11" fill="#0f766e">(Slave)</text>
  <line x1="170" y1="85" x2="550" y2="85" stroke="#4f46e5" stroke-width="1.6" marker-end="url(#spah)"/>
  <text x="360" y="78" text-anchor="middle" font-size="11" font-weight="700" fill="#4f46e5">SCK · Clock (Master→Slave)</text>
  <line x1="170" y1="125" x2="550" y2="125" stroke="#4f46e5" stroke-width="1.6" marker-end="url(#spah)"/>
  <text x="360" y="118" text-anchor="middle" font-size="11" font-weight="700" fill="#4f46e5">MOSI · Master Out, Slave In</text>
  <line x1="550" y1="165" x2="170" y2="165" stroke="#0d9488" stroke-width="1.6" marker-end="url(#spah)"/>
  <text x="360" y="158" text-anchor="middle" font-size="11" font-weight="700" fill="#0f766e">MISO · Slave Out, Master In</text>
  <line x1="170" y1="205" x2="550" y2="205" stroke="#64748b" stroke-width="1.6" marker-end="url(#spah)"/>
  <text x="360" y="198" text-anchor="middle" font-size="11" font-weight="700" fill="#475569">CSn · Chip Select (One per Slave)</text>
  <text x="40" y="248" font-size="12" font-weight="700" fill="#1f2933">Connecting Multiple Slaves: Two Methods</text>
  <rect x="40" y="256" width="310" height="34" rx="6" fill="#eef2ff" stroke="#c7d2fe"/>
  <text x="54" y="277.5" font-size="11.5" fill="#3730a3">Independent CSn: One chip select line per slave, sharing SCK/MOSI/MISO</text>
  <rect x="370" y="256" width="310" height="34" rx="6" fill="#f0fdfa" stroke="#99f6e4"/>
  <text x="384" y="277.5" font-size="11.5" fill="#115e59">Daisy Chain: Slave MISO → Next Slave MOSI in series, sharing one CSn</text>
  <rect x="40" y="300" width="640" height="34" rx="8" fill="#eef2ff" stroke="#c7d2fe"/>
  <text x="54" y="321.5" font-size="12.5" fill="#3730a3">Master exclusively controls clock and chip select; no addressing mechanism, slaves distinguished by CSn.</text>
</svg>

### Clock Modes (CPOL, CPHA)
```
CPOL=0: SCK Idle Low
CPOL=1: SCK Idle High
CPHA=0: Sampling on first edge
CPHA=1: Sampling on second edge

Most Common: Mode 0 (CPOL=0, CPHA=0) and Mode 3 (CPOL=1, CPHA=1)

Both sides must match! Otherwise communication will fail.
```

### Characteristics
```
Pros:
  ✓ Full-Duplex (Simultaneous TX/RX)
  ✓ High Speed (Tens of MHz, even 100MHz+)
  ✓ No Address Mechanism → No Overhead
  ✓ Flexible (Arbitrary frame length)

Cons:
  ✗ Many Wires (n Slaves = n+3 wires)
  ✗ No Standard Protocol Layer (Only Physical/Data Link defined)
  ✗ No Slave Flow Control (ACK)
  ✗ Short Distance (PCB-level)

Applications: Flash (NOR/NAND), ADC/DAC, Displays, Ethernet PHY
```

---

## Comparison of the Three Buses

| Feature | UART | I2C | SPI |
|------|------|-----|-----|
| Wires | 2 (TX+RX) | 2 (SCL+SDA) | 4 (SCK+MOSI+MISO+CS) |
| Communication | Asynchronous | Synchronous | Synchronous |
| Duplex | Full-Duplex | Half-Duplex | Full-Duplex |
| Speed | < 1Mbps | < 3.4Mbps | Tens of Mbps |
| Multi-Slave | No | Yes (Address) | Yes (CSn) |
| Distance | Long (RS-232) | PCB/Short | PCB |
| Complexity | Simplest | Medium | Relatively Simple |
| Flow Control | None/Hardware | ACK/NACK | None |
| Typical Use | Debug/Wireless Modules | Sensors | Flash/Display/High-Speed |

---

## Quick Reference: When to Choose What

```
Sensor Reading (Low Speed, Many Devices) → I2C
High-Speed Data Transfer (Flash/SD/Display) → SPI
Debug Info, Wireless Modules → UART
Multi-byte Register Read/Write → I2C (Address+Data) or SPI
Battery Powered (Lowest Power) → I2C (Near-zero static power)
Anti-Interference (Long Distance Differential) → RS-485 (Physical Layer Variant of UART)
```

---
*Keywords: UART, I2C, SPI, Baud Rate, SCL, SDA, MOSI, MISO, CS, Pull-up Resistor, ACK*
