Serial Peripheral Interface. Allows full-duplex serial communication from a master device to one or more slave devices arranged on a bus. Sometimes referred to as a 4-wire bus.
SPI (Serial Peripheral Interface) is used to communicate bi-directionally with other peripherals. The SPI interface normally has the following signals:
- SCK - serial clock, sometimes called CLK - this provides the clock data which controls the rate of data transfer
- MOSI - Master Out, Slave In, sometimes called DO (Data Out) - this is the data from the master to the slave
- MISO - Master In, Slave Out, sometimes called DI (Data In) - this is the data from the slave to the master
- SS - Slave Select - when asserted the slave knows it is being communicated with. When SS is not asserted the slave keeps all signals at high-impedance, so other devices can use the same SCK/MOSI/MISO lines.
The signals SCK/MOSI/SS are outputs on the master end. The MISO signal is an output on the slave side, if SS is asserted.
The signals SCK/MOSI/MISO can be shared between multiple peripheral devices. The "active" one at a particular moment is the one which has SS asserted.
Some peripherals (eg. LED strips, output shift registers) are one-direction only. In that case the MISO signal is not used.