/ˌɛs piː ˈaɪ/

noun — "serial protocol for high-speed device communication."

SPI, short for Serial Peripheral Interface, is a synchronous serial communication protocol used to transfer data between a master device, such as a microcontroller or CPU, and one or more peripheral devices, like sensors, memory chips, or displays. It enables high-speed, full-duplex data exchange over a minimal set of wires, making it a common choice in embedded systems and microcontroller-based designs.

Technically, an SPI bus consists of at least four signals:

  • MOSI (Master Out Slave In) – carries data from the master to the slave
  • MISO (Master In Slave Out) – carries data from the slave back to the master
  • SCLK (Serial Clock) – clock signal generated by the master to synchronize data transfer
  • SS or CS (Slave Select / Chip Select) – enables communication with a specific slave device

Additional slaves require separate SS lines or a decoder to manage multiple devices.

 

Data transmission in SPI occurs in **frames of 8 bits or multiples**. Each clock cycle shifts one bit through the data lines. The master generates the clock, ensuring all devices are synchronized. The protocol is full-duplex: while the master sends data on MOSI, the slave simultaneously transmits data on MISO. No addressing is embedded in the protocol; the SS line selects the target slave.


# conceptual SPI transfer
Master: sends byte 0xA5 on MOSI
Slave: simultaneously sends byte 0x3C on MISO
Clock cycles: 8 for full byte transfer

An SPI bus is widely used for EEPROM, flash memory, ADC/DAC converters, sensors, and display controllers. Its advantages include simplicity, high speed, and low latency. However, it does not support inherent error detection or long-distance communication, and multiple slaves require careful SS management.

In embedded workflows, SPI enables devices to exchange data efficiently with predictable timing. Software drivers often provide APIs to read and write bytes or words, configure clock polarity and phase, and manage multiple devices using CS lines. Hardware modules in microcontrollers can perform transfers autonomously using DMA for high-speed applications.

Conceptually, SPI is like a fast, synchronous conversation between a controller and one or more peripherals, with the clock acting as a metronome and the SS lines deciding who speaks when.

See I²C, GPIO, Microcontroller, Embedded Systems.