Communication Protocols in Embedded Systems

P. Phani Anirudh
5 min readMar 6, 2024

--

Introduction:

This blog helps you understand the various communication protocols that we use in embedded systems for the data transfer and communication between two or more electrical components/devices.

Communication protocols in embedded systems are essential for enabling devices to exchange data efficiently. They ensure seamless communication between components such as microcontrollers, sensors, actuators, and other peripherals. Examples of common communication protocols include UART, SPI, I2C, CAN, etc..

Types of communication Protocols:

There are mainly two types of communications: 1) Synchronous communication and 2) Asynchronous communication

Synchronous Communication: There is a notification between the transmitter and receiver about the data being transferred. Just like two workers exchanging bricks with each other in coordination (real life example).

  • A common clock speed must be maintained between both the receiver and transmitter.
  • Examples are UART, SPI, CAN, etc…

Asynchronous Communication: There is no notifying of the data transfer, but the data is transferred directly to the receiver. Just like, two workers each standing on two different floors of a building and passing bricks to each other from their respective places, with a certain frequency of bricks ( technically speaking about baud rate).

  • No common clock is needed between the receiver and transmitter. A certain delay is maintained.
  • Examples: USART, USB, RS-232, etc..

Types of Arrangement of Communication protocols:

The electronic components are of two types: Master and Slave.

Master component gives the instructions/data to the slave components and sometimes vice versa.

  1. Bus Topology:
  • One or more Master components controlling many Slave components.
  • All the slaves must have a common clock speed.
  • Even though one slave is deactivated, there is no problem for the communication system.
  • Example: I2C, CAN, etc..

2) Star Topology:

  • Single Master, many slave components.
  • If the Master is disconnected, then the communication cannot happpen.
  • Example: SPI communication

3) Ad-HOC Topology:

There is one transmitter and one receiver and the communication takes place between them.

Example: UART

UART Protocol:

  • Universal Asynchronous TX and RX
  • UART follows both synchronous and asynchronous communication protocols.
  • A common clock must be maintained.
  • It is a two-wire communication system.

Data Frame of UART:

  • It is a standard 8–9 bits data frame.
  • For industry level applications, we use 32-bit data frame which has a very high operation power.

UART Peripheral:

Inside the UART peripheral, the communication between various components takes place in the above mentioned manner
  • A common Clock speed must be set by the programmer.
  • The data is transferred bit by bit.

Applications of UART:

  • Printers: Printers use RS-232 communication protocol (RS abrivates to Recommended Standard)
  • Bluetooth Modules, GSMs, etc.. use UART protocol.

I2C Protocol:

  • Inter Integrated Circuit.
  • In this protocol, single or many masters can be connected to multiple slaves.
  • This is a single wire communication.
  • It requires a common clock.
  • This uses Synchronous communication method.
  • This protocol can be used in mobile phones and mobile displays, etc..

I2C Data Frame:

  • To trigger the slave, master sends slave data.
  • ACK refers to Acknowledgement i.e. one component sends a confirmation to the other component that data is received successfully.

Disadvantages of UART: Through UART, only two devices can be connected and data is transferred only between them.

SPI Protocol:

  • Serial Peripheral Interface
  • This follows Star Topology
  • There are a few pin configurations present on the components for the implementation of SPI protocol namely;

MOSI(Master In Slave Out): The data is sent from master to slave

MISO(Master Out Slave In): The data is sent from slave to master

CLK(Clock): For adjusting clock speed between the components

CS(Chip Select): For the selection of particular slave components for particular tasks.

And other pin configurations. They may vary from device to device.

SPI Peripheral:

The data is transferred bit by bit.

Daisy Chain Method:

In the daisy chain configuration, multiple SPI devices are connected in series, with the output of one device connected to the input of the next. This creates a chain-like structure, hence the term “daisy chain.” When data is transmitted, it passes through each device in the chain, allowing communication with all connected devices using a single SPI bus.

CAN protocol:

  • Control Area Network
  • This follows Bus Topology
  • In this protocol, all the devices are connected to one another, but only the targetted devices respond to the particular task and all the other components remain silent.
  • Example, in cars. In cars, when we use the protocol for lowering the windows, the informtion is sent to even other components like radio, AC, etc..but they remain silent and only the windows are communicated.
  • In this protocol, there is no master and there are no slaves. The particular component responds to a particular task.

CAN Peripheral:

The CAN Controller processes the data

The Tranciever helps for data transfer from one component to another.

Microcontroller helps in performing the required tasks.

Data receiving and transmitting:

What is Halfduplex?

Half-duplex is a communication channel or system that allows for bidirectional communication, but not simultaneously.

When one party is transmitting data, the other party is in the receiving mode, and then they can switch roles. This switching between transmission and reception is coordinated to ensure that both parties can communicate effectively.

What is Fullduplex?

In a full-duplex system, data can be transmitted and received at the same time, enabling more efficient and continuous communication between two parties. This is in contrast to half-duplex communication, where data can only be transmitted or received at any given time.

Full-duplex communication is commonly used in various modern communication technologies, such as telephony, networking, and wireless communication, where the ability to transmit and receive data simultaneously is essential for efficient and real-time communication

--

--