The SPI bus is a master/slave, 4-wire serial communications bus. The four signals are Data - master output/slave input (MOSI), master input/slave output (MISO), clock (SCLK), and slave select (SS or CS).
Whenever two devices communicate, one is referred to as the "master" and the other as the “slave”. The master drives the serial clock. Data is simultaneously transmitted and received, making it a full-duplex protocol. SPI uses the SS (or CS) line to specify which device data is being transferred to or from, so each unique device on the bus needs its own SS signal from the master. If there are 3 slave devices, there are 3 SS lines from the master, one to each slave.
To begin communication, the bus master configures the clock, using a frequency supported by the slave device, typically a few MHz or tens of MHz. The master then selects the slave device with a logic level 0 on the select line.
During each SPI clock cycle, a full duplex data transmission occurs. The master sends a bit on the MOSI line and the slave reads it, while the slave sends a bit on the MISO line and the master reads it.
Transmissions involve two shift registers of a given word size, such as eight bits, one in the master and one in the slave. Data is usually shifted out with the most-significant bit first, while shifting a new least-significant bit into the same register. After the register has been fully shifted out the master and slave have exchanged register values. If more data needs to be exchanged the shift registers are reloaded and the process repeats. Transmission may continue for any number of clock cycles. When complete, the master stops toggling the clock signal, and deselects the slave.
The master device must select only one slave at a time. Slave devices on the bus that have not been activated using their chip select line must disregard the input clock and MOSI signals, and must not drive MISO.
To decode SPI data first acquire the packets of interest using PicoScope. Then select Serial Decoding from the Tools menu.
Click Create and select SPI from the list of available protocols.
Select the corresponding PicoScope input channels in the SPI configuration menu for Data (MOSI / MISO), Clock, Slave Select (SS). Set any other parameters as necessary. Click OK to see the decoded SPI packets in the PicoScope graph display.
For more information on PicoScope's serial decoding capabilities, see Serial bus decoding and protocol analysis - overview.