Communication Protocol in an Embedded System

Embedded System is an electronic system/device that employs both hardware and software. A processor or the 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 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.

In general, communication protocols are associated with a physical layer describing the signals incorporated, signal strength, handshaking 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 are associated with the application layer.

Some important BUS protocol are:- SPI, I2C, USB, UART, CAN, Ethernet.

SPI:-  4-wire serial bus, can move data rapidly, handshake with a particular device and stream the data, Master-slave communication, single master mode.

For example; Exchanging data as in an SD card and controllers. For this, we generally use SPI(Serial Peripheral Interface protocol developed by Motorola Corp). They are relatively very fast and have no upper cut-off for data rate. It's commonly used in interfacing SD cards and some LCD modules. Some commonly available accelerometers and sensors are interfaced through SPI.

I2C:- 2-wire signals: clock and data, EEPROM control byte now talks with EEPROM and stream data supports multiple masters, talk node to node.

For example; Real-time clocks that display the current date and time one such commonly available IC is DS1307 provides an I2C( Inter integrated circuit protocol - Philips ), Control signals sent from a controller to DS1307 to set the date and time and retrieval of date and time all are set through I2C. Some external EEPROMS which are used to store data also comes with I2C. 

CAN:- limited to the amount of data, one location to another location, quick messages, Many computers talking to each other on one bus- info back and forth, Uses differential signals.

The multi-master type system, Broadcast type of bus Any nodes can be a master,  Messaging type system Everyone on a bus can hear, and anybody that is interested can respond, Termination resistor to reduces reflection at end of the bus. Used for a network of controllers usually used in automobiles

Why do we have different communication protocol:

In an embedded system, microcontrollers or processors, various sensors, displays, and finally some memory units (EEPROMS or SD cards ) need to interact with each other, exchange data, and to issue commands. We can do this by wiring up each and every component with a dedicated set of duplex lines( analogous to a mesh topology).

That would increase the number of pins required to a very large number. The solution is to use shared wires connected to each device and only one device can use these data lines at a time (bus topology).

Image source: http://howtomechatronics.com/tutorials/arduino/how-i2c-communication-works-and-how-to-use-it-with-arduino/


This poses a new problem. Who will use the bus first, What if two devices attempt to access the data at the same time? How will we address a particular device? How can we ask others to wait? That's where different communication protocols come in.

You can think of them as a set of rules defining the following:

  • How can I address(select) a particular device?
  • What is the maximum and minimum data rate possible through this bus?
  • What should be signalling scheme( like +5 for to represent a bit one and 0 volt to represent a bit zero eg. NRZ , bipolar, Manchester encoding)?
  • Is it possible to have more than one master node?
  • What are the control signals. Is it synchronous or Asynchronous, clock rate?

Now controllers and devices have these standards implemented in hardware. We just have to configure them according to our purpose. Standards are maintained by all manufacturers in their products. So wiring them up together is really fast and easy.



Comments

Popular posts from this blog

FPGA In Layman''S Terms

BOARD BRING-UP

High Speed Digital Design Considerations