Topics
Serial Peripheral Interface

Serial Peripheral Interface

SPI is a synchronous, serial communication protocol. Devices communicating via SPI are said to be in a master-slave relationship. The master is the controlling device (usually a microcontroller), while the slave is a component (a sensor, display, or memory chip) takes instruction from the master. The simplest configuration of SPI is a single master-single slave system, but one master can control more than one slave. Multiple slave devices are supported through selection with individual slave select (SS), sometimes called chip select (CS), lines.

One advantage of SPI over UART is that data can be transferred without interruption. Any number of bits can be sent or received in a continuous stream. With UART, data are sent in packets, limited to a specific number of bits with start and stop conditions defining the beginning and end of each packet which results in data interruption during transmission.

The SPI protocol specifies four logic signals, and devices communicating using this protocol have four pins:

  • MOSI (Master Out/Slave In): SIgnal for the master to send data to the slave.
  • MISO (Master In/Slave Out): Signal for the slave to send data to the master.
  • SS (Slave Select): Signal for the master to select which slave to send data to in a multi-slave configuration. The master can choose which slave it wants to send data to by setting the CS/SS pin for that slave to a low voltage level keeping the other CS/SS pins at a high voltage level.
  • SCLK/SCK (Clock): Signal for the clock signal. The clock signal (SCLK) synchronizes the transmission of data between master and slave. One bit of data is transferred in each clock cycle, thus the speed of data transfer is determined by the frequency of the clock signal.

New names for logic signals

It has been agreed by the industry and community to discontinue the use of the terms MOSI, MISO, and SS and in their place use SDO, SDI, and CS as explained below:

  • SDO – Serial Data Out: An output signal on a device where data is sent out to another SPI device.
  • SDI – Serial Data In: An input signal on a device where data is received from another SPI device.
  • CS – Chip Select: Activated by the controller to initiate communication with a given peripheral.

Alternative terms for SDO and SDI are:

  • PICO (Peripheral In/Controller Out): For devices that can be either a controller or a peripheral, the signal on which the device sends output when acting as the controller, and receives input when acting as the peripheral.

  • POCI (Peripheral Out/Controller In): For devices that can be either a controller or a peripheral, the signal on which the device receives input when acting as the controller, and sends output when acting as the peripheral.

  • SLCK/SCK: Remain in use.

Since this change is relatively new, you may find microcontrollers and components using either set of terms.

Serial Peripheral Interface