The Serial Peripheral Interface (SPI) is a synchronous bi-directional (full duplex) serial data protocol used by microcontrollers to enable communication between one or more peripheral devices that are all of short distances to one another. Furthermore, it can also be used for communication between two microcontrollers; with particular interest between Arduino boards and Multiwii flight controllers.
In general, an SPI data link consists of one master; typically a microcontroller which controls one or more peripheral devices known as slaves. Both the master and the slaves share three common lines which include; MISO (Master In Slave Out) which is responsible for transferring data from the slave to the master; MOSI (Master Out Slave In) which is responsible for transferring data from the master to the slaves; and SCK (Serial Clock) which is created by the master and is responsible for synchronising the transmission of data between master and slave in respect clock pulses. There is also SS (Slave Select) line that is specific to a pin on each slave device and in which the master can use to enable and disable specific slave devices. In the case a slave device's SS pin is low, communication is enabled with the master. However in the case it is high, communication is disabled with the master. This allows multiple devices using SPI to share common MISO, MOSI, and CLK lines.
Full duplex data transmission occurs during each clock cycle generated by the master in which the master