The Spi is one of the most popular communication protocol in the MCU’s. Many of the available components such as an SD card and TFT displays drivers such as ST7735 can be interfaced by using it. This blog will not be centered around any MCU rather it would be just a general overview of the process of data transfer.
As discussed in the earlier section, the high-speed data transfer often requires a Sync between the receiver and the transmitter. So this peripheral also requires one line to be the clock. Here it is referred to as the Serial Clock(SCL) line. In every MCU which supports Spi, there will be an SCL line for each of the available Spi’s.
Now since we have given a common reference to the MCU’s, we need to have dedicated lines for the data transfer. The Spi is a Full-Duplex communication protocol i.e there are dedicated lines for transferring data as well as receiving it and both transfer and receiving can be done at the same time. It also supports other modes such as the half-duplex. The data lines in Spi are known as MOSI and MISO.
Now before knowing about these acronyms, we need to look at one of the important concepts which you will often come across in MCU’s.In a complex embedded system, there will be many MCU’s constantly transferring data between each other. One of them will always be the dominant one or the one which is controlling all others or giving them instructions. For example, In a music player, there may be a storage device where all the mp3/wav files are kept such as an SD card which consists of an MCU and there can be a TFT display for interfacing which also contains an MCU.So here we will control these two MCU’s by a microcontroller which will take the files from the SD card and will show some information on the TFT. We will often come across these scenarios and commonly we refer the controlling MCU as the master and all others as the slaves.
So the data line MOSI refers to MASTER OUT SLAVE IN. Through this line, we transfer data from the master to the slave. The MISO stands for MASTER IN SLAVE OUT and is used to transfer the data from the slave to the master.
Until now we have covered 3 lines of the Spi namely SCL, MOSI, and MISO. The fourth line is the Slave Select which is used to select the slave MCU to which the data is to be transferred. This line is driven low if the master needs to start the transmission to the slave. So a standard SPI wiring is done as follows
Since the hardware wiring is completed, now we need to shift our focus to the software part. In the next section, we will discuss the driver development for this protocol and many other important concepts such as using polling and interrupts.


Comments
Post a Comment