Communication Protocols are a set of rules that allow two or more communication systems to communicate data via any physical medium. The rules, regulations, synchronization between communication systems, syntax to be followed and semantics are all defined by the term protocol. Protocols can be implemented by both hardware and software or combination of both. Analog and digital communication systems use various communication protocols widely. In addition, each protocol has its own application area.
Table of Contents
- 1 Communication Protocols in Embedded Systems
- 2 Types of Communication Protocols in Embedded Systems
- 3 Inter System Communication Protocols
- 3.1 Types of Inter System Communication Protocols
- 3.2 USB Communication Protocols
- 3.3 UART Communication Protocols
- 3.4 USART Communication Protocol
- 4 Intra System Communication Protocols
- 4.1 Types of Intra System Communication Protocols
- 4.2 I2C Communication Protocols
- 4.3 Serial Peripheral Interface (SPI) Communication Protocols
- 4.4 Controller Area Network (CAN) Communication Protocol
Communication Protocols in Embedded Systems
Embedded System is an electronic system or device which employs both hardware and software. A processor or controller takes input from the physical world peripherals like sensors, actuators etc., processes the same through appropriate software and provides the desired output.
In this case, the components have to communicate with each other to provide the anticipated output. Each communicating entity should agree to some protocol to exchange information. Many different protocols are available for embedded systems and are deployed depending upon the application area.
Fig. 1 – Introduction to Communication Protocols
In general, the communication protocols is associated with physical layer describing the signals incorporated, signal strength, hand shaking mechanism, bus arbitration, device addressing, wired or wireless, data lines etc.
The processes such as system configuration, selection of baud rate and transmitting & receiving data is associated with application layer.
Types of Communication Protocols in Embedded Systems
Communication protocols are broadly classified into two types:
- Inter System Protocol
- Intra System Protocol
Fig 2 – Classification of Communication Protocols
Inter System Communication Protocols
Inter system protocols establish communication between two communicating devices i.e. between PC and microprocessor kit, developmental boards, etc. In this case, the communication is achieved through inter bus system.
Fig. 3 – Inter System Communication Protocols
Types of Inter System Communication Protocols
Inter system protocol can be categorized into:
- USB Communication protocols
- UART Communication protocols
- USART Communication protocols
USB Communication Protocols
Universal Serial Bus (USB) is a two-wired serial communication protocol. It allows 127 devices to be connected at any given time. USB supports plug & play functionality.
USB protocol sends and receives the data serially between host and external peripheral devices through data signal lines D+ and D-. Apart from two data lines, USB has VCC and Ground signals to power up the device. The USB pin out is shown in Figure 4 below.
Fig. 4 – USB Pin Out
Data is transmitted in the form of packets where two devices communicate each other. Data packets compose of 8 bits (byte) with LSB (Least Significant Bit) transmitted first.
USB associates NRZI (Non Return to Zero Invert) encoding scheme to transmit data with sync field to synchronize the host system and receiver clock signals.
In USB, data is transferred in three different speeds such as:
Fig. 5 – USB speeds
Advantages of USB Communication Protocol
The advantages of USB Communication Protocol are as follows:
- Fast and simple.
- It is of low cost.
- Plug and Play hardware.
Disadvantages of USB Communication Protocol
The disadvantages of USB Communication Protocol are as follows:
- Needs powerful master device.
- Specific drivers are required.
UART Communication Protocols
Universal Asynchronous Receiver/Transmitter (UART) is not a communication protocol but just a physical piece of hardware which converts parallel data into serial data. Its main purpose is to transmit and receive data serially.
UART is also two-wired i.e., the serial data is handled by Tx (Transmitter) and Rx (Receiver) pins.
UART transmits data asynchronously, which induces that no clock signal is associated in transmitting and receiving data. Instead of clock signal, UART embed start and stop bits with actual data bits, which defines the start and end of data packet.
When receiver end detects the start bit, it starts to read the data bits at specific baud rate meaning both transmitting and receiving peripherals should work under same baud rate. UART works under half duplex communication mode meaning it either transmits or receives at a time.
Fig. 6 – UART Frame
Example: Emails, SMS
USART Communication Protocol
Universal Synchronous Asynchronous Receiver/Transmitter (USART) is identical to that of UART with only added functionality synchronous. That is, the transmitter will generate a clock signal which will be recovered at the receiver end from the data stream transmitted without knowing baud rate ahead.
UART works under full duplex communication mode meaning it can transmit and receive data at same time.
USART encompass the abilities of UART, which enables application of both depending on the applications area.
Fig. 7 – USART Frame
Advantages of UART/ USART Communication Protocol
The advantages of UART/ USART Communication Protocol are as follows:
- Clock signal is not required
- Cost effective
- Uses parity bit for error detection
- Requires only 2 wires for data communication
Disadvantages of UART/ USART Communication Protocol
The disadvantages of UART/ USART Communication Protocol are as follows:
- Doesn’t support multiple master slave functionality
- Baud rate of communicating UART should be within 10 percent of each other
Intra System Communication Protocols
The Intra system protocol establishes communication between components within the circuit board. In embedded systems, intra system protocol increases the number of components connected to the controller.
Increase in components lead to circuit complexity and increase in power consumption. Intra system protocol promises secure access of data from the peripherals.
Types of Intra System Communication Protocols
Intra system protocol can be categorized into:
- I2C Protocol
- SPI Protocol
- CAN Protocol
I2C Communication Protocols
Inter Integrated Circuit (I2C) is a serial communication protocol developed by Philips Semiconductors. The main purpose of this protocol is to provide easiness to connect peripheral chips with microcontroller. In embedded systems, all peripheral devices are connected as memory mapped devices to the microcontroller.
I2C necessitates two wires SDA (Serial Data Line) and SCL (Serial Clock Line) to carry information between devices. These two active wires are said to be bidirectional.
I2C protocol is a master to slave communication protocol. Each slave is been provided with unique address. In order to establish communication, master device initially sends the target slave address along with R/W (Read/Write) flag. The corresponding slave device will move into active mode leaving other devices in off state.
Once the slave device is ready, communication starts between master and slave devices. One bit acknowledgment is replied by the receiver if transmitter transmits 1 byte (8 bits) of data. A stop condition is issued at the end of communication between devices.
Fig. 8 – Start and Stop Condition of I2C Communication Protocols
Advantages of I2C Communication Protocols
The advantages of I2C Communication Protocols are as follows:
- Provides good communication between onboard devices which are accessed infrequently
- Addressing mechanism eases master slave communication
- Cost and circuit complexity does not end up on number of devices
Disadvantages of I2C Communication Protocols
The biggest disadvantage of I2C Communication Protocols is its limited speed.
Serial Peripheral Interface (SPI) Communication Protocols
SPI (Serial Peripheral Interface) is one of the serial communication protocol developed by Motorola. It is a 4-wire protocol namely MOSI (Master Out Slave In), MISO (Master In Slave Out, SS (Slave Select), and SCLK (Serial Clock).
As I2C protocol, SPI is also a master to slave communication protocol. In SPI, the master device first configures the clock at a particular frequency. Furthermore the SS line is used to select the appropriate slave by pulling the SS line low where it is normally held high.
The communication is established between the selected slave and the master device as soon as appropriate slave device is selected.
SPI is a full duplex communication protocol. SPI doesn’t limit data transfer to 8 bit words.
Fig. 9 – SPI Communication Protocols
Advantages of SPI Communication Protocols
The advantages of SPI Communication Protocol are as follows:
- Faster than asynchronous serial communication protocol.
- Support multiple slaves connectivity.
- Universally accepted protocol and low cost.
Disadvantages of SPI Communication Protocol
The disadvantages of SPI Communication Protocol are as follows:
- Requires more wires than other communication protocols.
- Master device should control all slave communications (slave-slave communication is impossible).
- Numerous slave devices leads to circuit complexity.
Controller Area Network (CAN) Communication Protocol
CAN (Controller Area Network) is a serial communication protocol developed by the Robert Bosch for intra vehicular communication. It requires two wires CAN High (H+) and CAN low (H-) for data transmission.
CAN protocol is based on a message oriented communication protocol.
Advantages of CAN Communication Protocols
The advantages of CAN Communication Protocols are as follows:
- Low cost and reliable
- Shows robust performance
- Secured and fast protocol
Disadvantages of CAN Communication Protocol
The disadvantages of CAN Communication Protocol are as follows:
- Automotive oriented
- Bit complex protocol
Author: B Abinayaa, BE (ECE), ME (Embedded System Technologies)