SPI-01: Protocol Foundations — VLSI Trainers
SPI Series · Article 1 of 6

SPI-01: Protocol Foundations

Communication channels, synchronous vs asynchronous protocols, and a complete introduction to Serial Peripheral Interface — the four wires, master-slave architecture, and why SPI is everywhere.

📡Communication Channels & Protocols

A communication channel is a physical set of wires that conveys data between two or more entities. The entities could be modules on the same semiconductor chip, separate chips on a PCB, chips connected by cables, or nodes on a network.

A communication protocol is the set of rules governing how that channel operates — who can send data and when, how data is clocked in and out, and whether acknowledgements or error detection are included.

Protocols are designed around specific constraints. The most important two are distance and performance vs cost:

ScopeDistanceExample Protocols
On-chip< 10 mmAXI, Avalon
Chip-to-chip< 1 mPCIe, QPI, RapidIO, SPI
Local area network< 100 mEthernet, InfiniBand
ProtocolBandwidth per channelKey cost factor
PCIe Gen4~4 GB/sPrecise impedance matching required
USB 3.1~10 Gb/sDifferential signalling circuitry
SPI~100 MB/sNo impedance matching required
Key insight: Faster channels are more costly in hardware and power. PCIe channels require precise impedance matching on PCB traces; SPI has no such requirement, making it ideal for low-cost embedded and IoT systems.

⏱️Synchronous vs Asynchronous Protocols

A fundamental challenge in any communication channel is making sure the receiver samples each bit at exactly the right moment — not too early, not too late. This leads to two broad protocol families:

Asynchronous protocols

The clock is not embedded in the channel. Both transmitter and receiver must agree in advance on the clock frequency, or the receiver must extract the clock from the data stream itself.

Synchronous protocols

The transmitter clock is embedded in the channel as a dedicated wire. Transmitter and receiver share the same clock — no clock recovery needed. SPI, I²C, and on-chip protocols like AXI all use a shared clock.

SPI is synchronous: The SCLK wire carries the clock, which the master always drives. This is what makes SPI reliable and simple to implement — there is no ambiguity about when to sample each bit.

🔬Aperture Time & Metastability

Even with a shared clock, there is still a constraint: the transmitter must not change a bit value at the same moment the receiver is sampling it. The window around the sampling edge where data must remain stable is called the aperture time.

Figure 1 — Aperture time and receiver sample times
Transmitter data Bit transitions Receiver clock Sample times 0 1 0 1 aperture time aperture time bit transition sample time

Receiver samples on each rising edge of its clock. The red shaded zones (aperture times) show when data must not change. Bit transitions (purple) occur between clock edges — safely outside the aperture. If a transition fell inside the aperture, metastability could occur.

If a bit transition happens inside the aperture time, the receiver’s flip-flop may capture an indeterminate value — neither a valid 0 nor 1. This is metastability. In synchronous designs, careful timing analysis ensures transitions always land safely between sample edges. SPI addresses this through CPOL and CPHA settings (covered in SPI-02).

🔌SPI — The Four Wires

Serial Peripheral Interface (SPI) is precisely characterised by five properties. Understanding each word in the description is the foundation for understanding the protocol:

PropertyMeaning
BidirectionalData flows simultaneously in both directions — master→slave and slave→master at the same time
Single-endedOne wire per signal (vs differential signalling like LVDS where each signal uses two wires)
Master-slaveOne entity (master) initiates all communication; slaves only respond
SynchronousA clock signal is embedded in the channel — data is sampled on clock edges
SerialBits are transmitted one at a time, not in parallel

The four signal wires

SCLK
Serial Clock. Driven by the master. Only active during an exchange — idles at the level defined by CPOL when the channel is idle.
SS
Slave Select. Active-low, driven by the master. SS=1 means the channel is idle; SS=0 means the master is addressing this slave and an exchange is in progress.
MOSI
Master Out, Slave In. The data wire driven by the master. Carries data from master to slave during an exchange.
MISO
Master In, Slave Out. The data wire driven by the slave. Carries data from slave to master during an exchange.
Signal naming warning: SPI signal names are NOT standardised across datasheets. You will encounter SCLK called “SPC” or “SCK”, SS called “CS” (Chip Select) or “CE”, MOSI called “SDI” (Serial Data In from the slave’s perspective) or “DI”, and MISO called “SDO” or “DO”. Always check the datasheet. The protocol behaviour is the same regardless of naming.
Figure 2 — SPI channel: master, slave, and the four wires
SPI Master (CPU / MCU) SCLK SS MOSI MISO SPI Slave (Peripheral / sensor) SCLK SS MOSI MISO SCLK ▶ SS ▶ MOSI ▶ ◀ MISO Master drives Slave drives Master drives (data)

The four SPI wires. Three are driven by the master (SCLK, SS, MOSI); one is driven by the slave (MISO). MOSI and MISO carry data simultaneously during an exchange.

👑Master-Slave Architecture

SPI is a single-master bus. There is exactly one entity that can initiate communication at any time — the master. Slaves can only respond to requests; they cannot spontaneously send data to the master.

This simplifies the protocol enormously — there is no arbitration, no collision detection, no address negotiation. The master is always in control. The trade-off is that slaves cannot interrupt the master to signal that data is ready (unlike I²C which allows a limited form of this).

The idle state

When no exchange is happening:

Remember: SS is active-low. SS going LOW means the master is starting an exchange. SS returning HIGH means the exchange is over. This is why it is sometimes called Chip Select (CS) or Chip Enable (CE) in datasheets — it “selects” or “enables” the addressed chip.
Figure 3 — SPI idle state (CPOL=0)
SS SCLK MOSI MISO ← IDLE → ← IDLE → don’t care don’t care SS=1 — channel idle, no slave selected SCLK=0 (idle, CPOL=0)

SPI idle state with CPOL=0. SS is high (channel idle), SCLK holds 0 (CPOL=0 idle level), MOSI and MISO are don’t-cares (hatched regions).

🔄The SPI Exchange

The fundamental unit of SPI communication is the exchange. One exchange transfers exactly 8 bits simultaneously in both directions — 8 bits from master to slave (on MOSI) and 8 bits from slave to master (on MISO).

During an exchange:

  1. Master asserts SS → LOW to begin
  2. SCLK pulses exactly 8 times
  3. Each pulse: one MOSI bit shifts out, one MISO bit shifts in
  4. Master deasserts SS → HIGH to end
Both directions simultaneously: SPI is truly full-duplex. While the master is sending a command byte on MOSI, the slave is sending status or data back on MISO at the same time. Both SIPO and PISO shift registers operate in lockstep on the same clock.
Figure 4 — Complete SPI exchange (CPOL=0, CPHA=0, MSB first)
SS SCLK MOSI MISO Idle SS LOW — Exchange Active (8 clock cycles) Idle 1 2 3 4 5 6 7 8 1 0 1 0 0 1 0 1 MOSI = 1010 0101 = 0xA5 0 0 1 1 1 1 0 0 MISO = 0011 1100 = 0x3C Decoded bits (MSB first, sampled on rising edge): MOSI: 1 0 1 0 0 1 0 1 → 0xA5 MISO: 0 0 1 1 1 1 0 0 → 0x3C time = sample points (rising edges)

CPOL=0, CPHA=0, MSB-first SPI exchange. MOSI transmits 0xA5 from master to slave; MISO simultaneously transmits 0x3C from slave to master. Data is sampled on each of the 8 rising clock edges (purple dashed lines). Don’t-care regions shown as hatched.

🔍 Worked Example — Decoding an SPI Exchange

Given: CPOL=1, CPHA=1, MSB-first. The MISO signal shows (left to right, between SCLK edges): 1, 0, 1, 1, 0, 1, 0, 1

Step 1 — Identify the sample edge. CPOL=1 → clock idles HIGH → first edge is FALLING. CPHA=1 → data sampled on the SECOND edge = RISING edge.

Step 2 — Read bits. MSB-first → read left to right: 1, 0, 1, 1, 0, 1, 0, 1

Step 3 — Assemble the byte. 10110101₂ = 0xB5

This is the exact exercise from the textbook on page 7 — the MISO value sent from slave to master is 0xB5.

🔬VLSI Connections

🔬 How SPI maps to VLSI design

Shift registers: The SPI exchange is physically implemented using SIPO and PISO shift registers (from DE-09). The master’s MOSI output feeds the slave’s SIPO shift register; the slave’s PISO shift register drives MISO. Both shift registers clock on the same SCLK — the “handshake” is automatic.

🔬 DFT scan chains = SPI in disguise

Scan chains used in Design for Testability (DFT) are structurally identical to SPI. The scan-in (SI) wire is MOSI, scan-out (SO) is MISO, scan enable (SE) is equivalent to SS, and the test clock (TCK) is SCLK. Both capture and shift-out test patterns using exactly the same shift-register mechanism. Understanding SPI thoroughly means you already understand how scan chains load and unload test data.

🔬 SPI in real SoC designs

SPI peripherals appear in virtually every SoC: boot-ROM configuration, ADC/DAC interfaces, EEPROM programming, FPGA configuration, display driver ICs (MAX7219, ST7735), and power management ICs. Writing a SystemVerilog SPI master is one of the most common RTL interview exercises — it directly tests your understanding of CPOL/CPHA, shift register design, and state machine coding.

Summary — SPI-01 key points: SPI is a 4-wire, synchronous, serial, master-slave, full-duplex protocol. The master drives SCLK, SS, and MOSI; the slave drives MISO. One exchange transfers exactly 8 bits simultaneously in both directions while SS is asserted (LOW). The clock idle level (CPOL) and data phase (CPHA) settings must match between master and slave — these are covered in depth in SPI-02.
Scroll to Top