Serial Communication Protocols: The Basics - JohnHau/mis GitHub Wiki
Before we delve into the technicalities of serial communication protocols, let’s talk about communication in general. We already know that communication involves the exchange of information between two or more individuals. Communication can take place in various ways – through written documents, spoken words, audio tapes, video lessons and more.
However, what does “communication” mean in embedded systems? Well, the answer is fairly easy! It is simply an exchange of data between two microcontrollers (embedded devices) in the form of bits. The exchange of data (bits) in embedded systems is governed by a set of rules known as communication protocols.
In digital communication, there are two types of data transfer:
Serial Communication Parallel Communication To keep things simple, we will focus this article on the basics of serial communication protocols.
Serial Communication
In serial communication, the data bits are transmitted one at a time in a sequential manner over the data bus or communication channel. In order to understand this properly, let us consider this situation:
Imagine you are shooting at a target with a bow and arrow. How do the arrows fly from the bow? One at a time, right? This is exactly the case with serial communication; the data bits travel from one embedded device to another one at a time, serially.
Now that we’ve covered the basics of serial communication in embedded systems, let’s move ahead and discuss the various types of serial communication protocols.
CAN Protocol
The CAN or Controller Area Network protocol was conceived by Robert Bosch (of GmbH) in the 1980s. Previously during the late 70’s, manufacturers started using advanced features in their automobiles, such as anti-lock braking systems, air conditioners, central door locks, airbags, gear control, engine management systems and so on.
Even though drivers (consumers) loved these new features, they came with some downsides too. These advancements required the addition of heavy and bulky wires, expensive mechanical parts and complex designs, which led to a rise in both the costs and complexity of the in-vehicle electrical and mechanical systems. Fortunately, Robert Bosch made life easier for the engineers by introducing the CAN protocol. The CAN protocol changed the management of electronic sub-systems and the communication between intelligent sensors– a simpler, cheaper method that did all that with a single cable
The widespread popularity of the CAN protocol led to its standardization as the ISO 11898 in 1993. Today, the application of CAN protocol spans the embedded systems spectrum from industrial automation to commercial restaurant fryers and beyond.
The development of these CAN applications ranges from fairly simple to extremely complex. The devices that rely on this protocol are substantial. If not designed, developed, and tested properly can cause severe damage. It is very important to make sure development is well monitored and tested. One easy and important development and test tool for CAN applications is the protocol analyzer.
Uses of the CAN Protocol:
The CAN protocol is often used for in-vehicle networking of electronic components. It is also used in aerospace applications for in-flight analysis and networking of components such as fuel systems, pumps and more. Manufacturers of medical equipment often use CAN for creating an embedded network within medical devices. The CAN products offered by Total Phase:
Komodo Solo CAN Interface Komodo Duo CAN Interface I2C Protocol
I2C (pronounced “I two C”) or Inter-Integrated Circuits protocol was originally invented by Philips Semiconductor. It is also known as IIC (pronounced I-I-C) and I2C (pronounced I-squared-C). Although this technology is over three decades old, the I2C protocol is widely used today. In fact, it supports a vast number of embedded systems.
The I2C protocol allows embedded engineers to connect multiple slave devices with one or more master. Similar to the SPI protocol, it is intended primarily for short-distance communication within two ICs (Integrated Circuits) on the same printer circuit board (PCB).
It requires only two bi-directional wires for transmitting and receiving data bits. In terms of data rates, the I2C protocol supports speed up to 3.4 Mbps - which is pretty fast.
Here are some of the important advantages of using the I2C protocol:
Flexibility of using multiple master devices to speed up communication and improve the design functionality Chip addressing eliminates the need of CS (Chip Select) Lines Supports a robust error handling mechanism with the ACK/NACK feature. However, there are some limitations. For example, it takes up much more real estate on a PCB as it uses pull-up resistors.
Uses of the I2C Protocol:
Changes the various color setting, such as hue, on a monitor. Controls the LED/LCD displays in cell phones Helps switching on /off the power supply of internal components The I2C products offered by Total Phase:
Aardvark I2C/SPI Host Adapter Beagle I2C/SPI Protocol Analyzer Promira Serial Platform SPI Protocol
Serial Peripheral Interface, which is commonly known as S-P-I or “spy” is one of the most popular interface specifications used in embedded systems. Since its introduction in the late 1980’s by Motorola, the SPI protocol has been widely used for short distance communication in embedded systems.
Through the SPI protocol, devices communicate with each other using master-slave architecture. Although multiple slave devices can be supported by SPI, the number of master devices is limited to one. SPI is known as four-wire serial bus because it consists of four signals:
master out slave in (MOSI) master in slave out (MISO) serial clock (SCK), slave select (SS) In full duplex mode, data rates over 1Mbps can be achieved - this is one of the main advantages of the SPI bus. Compared to I2C, SPI also supports using simple hardware interfacing and provides a higher throughput.
However, the SPI protocol also has some drawbacks – the lack of error-checking mechanism and slave acknowledgment feature are some of the major disadvantages.
Uses of the SPI Protocol:
Apply for communication with temperature, pressure sensors, and video game controllers Interface with LCDs and SD cards Communicate with FLASH and EEPROM memory Read data from a real time clock. SPI products offered by Total Phase:
Aardvark I2C/SPI Host Adapter Beagle I2C/SPI Protocol Analyzer Cheetah SPI Host Adapter Promira Serial Platform USB Protocol
It isn’t a secret that USB, the Universal Serial Bus protocol, is by far the most common protocol in use. You can probably find a dozen USB cables and connectors lying around in your home. Originally developed in the 1990s, it was intended to standardize the connection of a number of peripheral devices to a computer. Today, you can connect almost anything from external hard drives to printers to your laptop/computer through USB cables.
USB protocol was designed for two specific purposes:
Communicate with peripheral devices
Supply power to the connected devices if applicable
There are many variations of USB connectors - the standard USB that you find on keyboards, mice, and printers. Micro USB and USB Type-C are used mostly with cell phones - however, their popularity in other devices is growing.
When a device communicates with another device through USB protocol, data travels in the form of packets. All the data packets are composed of 8-bit bytes (or multiples of 8-bit bytes, depending on the supported bitrate), where the LSB or Least Significant Bit is transmitted first. If you are building an embedded system that involves USB, make sure you use a USB protocol analyzer to monitor the data on the bus.
Uses of the USB Protocol:
Connect peripheral devices such as keyboards, mouse, printers, etc. to a computer Supply power to the peripheral devices Charge accessories such as power banks and devices like cell phones and Bluetooth speakers directly from the power outlet or from computers The USB products offered by Total Phase:
Beagle Protocol Analyzer Models: USB 12, USB 480, and 5000 v2 Advanced Cable Tester v2 USB Power Delivery Analyzer eSPI Protocol
eSPI was developed by the Intel Corporation as the successor to the Low Pin Count (LPC) bus. eSPI stands for Enhanced Serial Peripheral Bus Interface - its primary function is to reduce the number of pins as compared to LPC.
Uses of the eSPI Protocol:
Reduce the number of pins required on the motherboard Used in applications where real time flash sharing is required eSPI products offered by Total Phase:
Promira Serial Platform Total Phases offers products that support all of the above listed protocols. Our range of protocol analyzers and host adapters help with the test and development of almost any embedded device using CAN, I2C, SPI, USB and/or eSPI. Click below if you would like to learn more, or have a personal demo designed to specifically address your needs.