Skip to main content

The Serial Peripheral Interface.


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

Popular posts from this blog

Let's Build a Music Player!

Digital Music Player's are one of the many sensational devices that were developed in the 20th century. They have been around for a while now and have become a part of our life. In the last few years, they have been integrated within Smart Phones and hence, have reached the masses. Now, Let us try to dive into knowing how these devices work and I guarantee that we all would be fascinated by the kind of engineering which goes into making these magic boxes. There are various topics which must be covered in order to build our own music player and so there will be several blogs to build a SOUND foundation. Now let us make a list of the required components and then we will walk through each of them in the upcoming blogs. There are 3 basic parts which are required to build a device which can output Audio:- Storage Medium. Micro-controller. Audio Output device. We will store the required music file onto a storage medium as the onboard memory on a microcontroller is low...

SD-CARD

This Post marks the beginning of our quest to develop a simple Music player. SD stands for Secure digital and these small devices have been around for a while now. They contain flash memory and a memory controller which is given instruction by the main MCU. So our main objective here is to understand how sd cards work and how to interface them with a microcontroller. As to understand the working of SD card we need to dive into the world of transistors and bits! The Sd card contains solid-state memory also known as the flash memory which is a type of EEPROM i.e  Electronically Erasable Programmable Read Only Memory .  Flash memory stores information in an array of memory cells made from  floating-gate transistors . These transistors are used in different topologies as to store each bit. We will not program each bit individually as it will be time-consuming as well as an inefficient way to store the data. As to move to a higher level of abstraction, we need a way to ...

Automated Outdoor Lighting

This Project enables a person to make any Outdoor Lighting Automated i.e to switch On/Off according to the sunlight outside. If it is dark outside then the light will turn On and if it is daytime then it will automatically switch Off. This can be very useful for all Outdoor Lighting of various commercial buildings as well as for residential buildings. This can also be implemented in Vehicles which will automatically turn their lights On.  Our aim can be achieved by designing a proper transistor circuit and using a relay with it to control the high voltage network. T he Requirements Are: 1:- Bipolar Transistor(Bc 547) 2:-5/6v Spdt Relay 3:-Resistors(Around 4.5k And 3k Ohm) 4:-Light Dependent Resistor 5:-5v Power Supply 6:-Pcb For Soldering Things Together 7:-Multimeter          CIRCUIT AND EXPLANATION The project involves the use of a transistor as a switch to make the outdoor light on/off. As we know that transistor can be used in three diffe...