top of page
Writer's picturePoornima Mani

SPI Communication

Updated: Sep 26

Serial Peripheral Interface is a common protocol that is commonly used to transfer data without any interruption.

This is a fast duplex master-slave protocol and is commonly used in interfacing microprocessor and microcontrollers. SPI is commonly used in short distance communication.

Without further ado, let us look in-depth, the details about this communication.


How does SPI work?


This kind of communication is used due to simplicity and flexibility and involves a Master-Slave relationship.

There is only one master, but there are multiple slaves. SPI mainly consists of 4 pins which include MOSI (Master-out Slave-in), MISO (Master-in Slave-out), CS (Chip Select), or SS (Slave Select) and SCLK (Serial Clock).






MOSI: It can be understood from the name itself that the data is sent out by the Master and received by the Slave. So, both these pins are connected.


MISO: In this, the signal is generated by the Slave whereas the line is managed by the Master.

SCLK generates the clock signal and is given to the slave input. Using the Slave Select, the required slave can be chosen.

One master and multiple slaves

The data flow is controlled by the Master to the slave; i.e. during each clock cycle, we can see that one but is transmitted from master to slave and slave to master. SPI is a full-duplex communication as it completes the transfer of 1 byte after 8 clock cycles. Multiple slaves can be connected to a single master and it can generate clock signals according to the need of the slave.


We can see that there are many slaves connected to the master, but only one will be active at a time. The slave is selected using SS (Slave select) also known as CS (Chip select).

This line is active low, i.e. only if the pin is down will the chip be selected.


Modes of Operation


The Master will generate a clock signal and synchronize it with the slaves so that the data can be distributed. There are mainly two features of a clock called, Clock Polarity or Clock Phase that come into play.


Based on the CPOL and CPHA, there are 4 modes of operation, from Mode 0 to 3.

Mode 0: This mode is used when both CPOH and CPOL are zero. This is usually seen in the rising edge of the clock.

Mode 1: This mode occurs when CPOL=0 and CPOH =1. This mode of transmission occurs in the falling edge of the clock.

Mode 2: In this particular model, CPOL=1 and CPOH=0. Mode 2 occurs in the rising clock edge.

Mode 3: Mode 3 occurs when both Clock Polarity and Clock Phase are both HIG


Configuration


SPI devices are connected mainly configured in two ways, Independent Slave Configuration and Daisy Chain Configuration. Let us take a look at these more deeply.


Independent Slave Configuration

Independent Slave Configuration: In this configuration, the MISO and MOSI lines are interconnected and the last slave is connected to the Master's MISO.


Daisy Chain Configuration: Often referred to as the cascaded configuration, the clock and chip select are connected. The data sent from the master returns to it. The output of one slave is connected to the next device.







Advantages of SPI

  1. The hardware interfacing in SPI is very easy to use.

  2. A major advantage is that it supports multiple slaves in a single circuit itself.

  3. SPI enables full-duplex communication that is not available in many other ones.

  4. There is no need for transceivers in an SPI.

Disadvantages of SPI


  1. SPI does not support adding nodes dynamically (hot swapping).

  2. It does contain a protocol to check for errors.


Applications of SPI

Application of SPI

SPI is very often used in peripherals such as sensors, ADC, and DAC. They play a vital role in real-time clocks and video games.

For the purpose of communication, they are used in Ethernet, USART, CAN, etc. Commonly used in memory devices such as Flash, SD card, and MMC, SPI is a very common yet unavoidable mode of communication.


 

See Also:





Order Electronics Projects


Want us to guide you through your project or make the project for you? Click on the button below or reach out to us via Call/WhatsApp at (+91) - 7600948607


You can -


  • Order Basic Electronics Projects

  • Order Embedded Systems Projects

  • Order IoT Projects

  • Order FPGA Projects

  • Order VLSI Projects

  • Order Image Processing Projects

  • Order Matlab Projects

  • Order TinkerCAD Projects

  • Order Proteus Projects


Click on the button below to fill out the project inquiry form -





Create Various Projects


Check out our Free Arduino Projects Playlist - Arduino Projects 

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects 

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects 

Check out our Free IoT Projects Playlist - IoT Projects 

Check out our Free Home Automation Projects Playlist - Home Automation Projects 

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects 


Follow us -


Please do follow us i.e. #learnelectronicsindia to get daily updates about new blogs, videos, courses, products, offers, competitions, quizzes, and Internship Opportunities.




36 views2 comments

Related Posts

See All

2 Comments


Anushka Gupta
Anushka Gupta
Jul 29, 2023

Finally, an article that clears up the confusion surrounding SPI communication! Learn Electronics India deserves all the praise for breaking down the technical jargon into understandable concepts. I now feel more confident in my electronics endeavors, all thanks to this enlightening piece.

Like

ashitanarvekar2002
Jul 21, 2023

Short and effective! LearnElectronics India never disappoints.

Like
bottom of page