For example, in UART communication, both sides are set to a pre-configured baud rate that dictates the speed and timing of data transmission. There are also asynchronous methods that don’t use a clock signal. SPI is a synchronous communication protocol. SPI communication is always initiated by the master since the master configures and generates the clock signal.Īny communication protocol where devices share a clock signal is known as synchronous. One bit of data is transferred in each clock cycle, so the speed of data transfer is determined by the frequency of the clock signal. The clock signal synchronizes the output of data bits from the master to the sampling of bits by the slave. SPI, I2C, and UART are ideal for communication between microcontrollers and between microcontrollers and sensors where large amounts of high speed data don’t need to be transferred. SPI, I2C, and UART are quite a bit slower than protocols like USB, ethernet, Bluetooth, and WiFi, but they’re a lot more simple and use less hardware and system resources. In the next article, we’ll discuss UART driven communication, and in the third article, we’ll dive into I2C. First, we’ll begin with some basic concepts about electronic communication, then explain in detail how SPI works.
#SPI SERIAL COMMUNICATION PROTOCOL SERIES#
In this series of articles, we will discuss the basics of the three most common protocols: Serial Peripheral Interface (SPI), Inter-Integrated Circuit (I2C), and Universal Asynchronous Receiver/Transmitter (UART) driven communication. Luckily for us, there are only a few communication protocols we need to know when building most DIY electronics projects. In electronics, these languages are called communication protocols. Both sides need to speak the same language.
When you connect a microcontroller to a sensor, display, or other module, do you ever think about how the two devices talk to each other? What exactly are they saying? How are they able to understand each other?Ĭommunication between electronic devices is like communication between humans.