Serial Peripheral Interface - SPI

Print
Serial Peripheral Interface - SPI
(adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-9050238130712788", enable_page_level_ads: true }); Serial Peripheral Interface Bus
The Serial Peripheral Interface (SPI) bus is a synchronous serial communication interface specification used for short distance communication, primarily in embedded systems. The interface was developed by Motorola and has become a de facto standard. Typical applications include Secure Digital cards and liquid crystal displays.

SPI devices communicate in full duplex mode using a master-slave architecture with a single master. The master device originates the frame for reading and writing. Multiple slave devices are supported through selection with individual slave select (SS) lines.


(adsbygoogle = window.adsbygoogle || []).push({});

Sometimes SPI is called a four-wire serial bus, contrasting with three-, two-, and one-wire serial buses. The SPI may be accurately described as a synchronous serial interface,[1] but it is different from the Synchronous Serial Interface (SSI) protocol, which is also a four-wire synchronous serial communication protocol, but employs differential signaling and provides only a single simplex communication channel.



Single Master Multi Slave



Interface ->
SCLK   -> Clock from master to slave
MOSI   -> Master Out Slave In
MISO   -> Master In Slave Out
SS       -> Slave Select

Data Transmission 

To initiate a transaction, Master first assert slave select line to select the slave.Typical data transmission size is 8-bit , but it can be specific to it's usage and bit size can be anything (Application specific , Master and Slave will have to re-design to support odd size of transaction).

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. This sequence is maintained even when only one-directional data transfer is intended.

Transmissions normally involve two shift registers of some given word size, such as eight bits, one in the master and one in the slave; they are connected in a virtual ring topology. Data is usually shifted out with the most-significant bit first, while shifting a new least-significant bit into the same register. At the same time, Data from the counterpart is shifted into the least-significant bit register. After the register bits have been shifted out and in, 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 typically deselects the slave.


SPI MODE

1. At CPOL=0 the base value of the clock is zero,i.e. the active state is 1 and idle state is 0.
2. At CPOL=1 the base value of the clock is one (inversion of CPOL=0), i.e. the active state is 0 and idle state is 1.

A Summary table is given below.



(adsbygoogle = window.adsbygoogle || []).push({}); Advantages

Disadvantages
Last Updated ( Saturday, 25 September 2021 14:07 )