Unit - III Part - II
Unit - III Part - II
Communication Interface
Communication interface is essential for communicating with various subsystems of the
embedded system and with the external world
For an embedded product, the communication interface can be viewed in two different
perspectives; namely; Device/board level communication interface (Onboard Communication
Interface) and Product level communication interface (External Communication Interface)
Embedded product is a combination of different types of components (chips/devices)
arranged on a Printed Circuit Board (PCB). The communication channel which interconnects
the various components within an embedded product is referred as Device/board level
communication interface (Onboard Communication Interface)
Serial interfaces like I2C, SPI, UART, 1-Wire etc and Parallel bus interface are examples of
‘Onboard Communication Interface’
The ‘Product level communication interface’ (External Communication Interface) is
responsible for data transfer between the embedded system and other devices or modules
The external communication interface can be either wired media or wireless media and it can
be a serial or parallel interface. Infrared (IR), Bluetooth (BT), Wireless LAN (Wi-Fi), Radio
Frequency waves (RF), GPRS etc are examples for wireless communication interface
RS-232C/RS-422/RS 485, USB, Ethernet (TCP-IP), IEEE 1394 port, Parallel port, CF-II Slot,
SDIO, PCMCIA etc are examples for wired interfaces 52
The Typical Embedded System
On-board Communication Interface - I2C
Inter Integrated Circuit Bus (I2C - Pronounced ‘I square C’) is a synchronous bi-directional half
duplex (one-directional communication at a given point of time) two wire serial interface bus
The concept of I2C bus was developed by ‘Philips Semiconductors’ in the early 1980’s. The
original intention of I2C was to provide an easy way of connection between a
microprocessor/microcontroller system and the peripheral chips in Television sets
The I2C bus is comprised of two bus lines, namely; Serial Clock – SCL and Serial Data – SDA.
SCL line is responsible for generating synchronization clock pulses and SDA is responsible for
transmitting the serial data across devices.
I2C bus is a shared bus system to which many number of I2C devices can be connected. Devices
connected to the I2C bus can act as either ‘Master’ device or ‘Slave’ device
The ‘Master’ device is responsible for controlling the communication by initiating/terminating
data transfer, sending data and generating necessary synchronization clock pulses
‘Slave’ devices wait for the commands from the master and respond upon receiving the
commands
‘Master’ and ‘Slave’ devices can act as either transmitter or receiver
Regardless whether a master is acting as transmitter or receiver, the synchronization clock signal
is generated by the ‘Master’ device only
I2C supports multi masters on the same bus
53
The Typical Embedded System
On-board Communication Interface - I2C
SDA
2.2K
Port Pins SCL
Slave 1
SCL I2C Device
Master SDA (Eg: Serial
(Microprocessor/ EEPROM)
Controller)
SCL Slave 2
SDA I2C Device
I2C Bus
54
The Typical Embedded System
On-board Communication Interface - I2C
The sequence of operation for communicating with an I2C slave device is:
1. Master device pulls the clock line (SCL) of the bus to ‘HIGH’
2. Master device pulls the data line (SDA) ‘LOW’, when the SCL line is at logic ‘HIGH’ (This is the ‘Start’
condition for data transfer)
3. Master sends the address (7 bit or 10 bit wide) of the ‘Slave’ device to which it wants to communicate, over the
SDA line. Clock pulses are generated at the SCL line for synchronizing the bit reception by the slave device.
The MSB of the data is always transmitted first. The data in the bus is valid during the ‘HIGH’ period of the
clock signal
4. Master sends the Read or Write bit (Bit value = 1 Read Operation; Bit value = 0 Write Operation) according to
the requirement
5. Master waits for the acknowledgement bit from the slave device whose address is sent on the bus along with the
Read/Write operation command. Slave devices connected to the bus compares the address received with the
address assigned to them
6. The Slave device with the address requested by the master device responds by sending an acknowledge bit (Bit
value =1) over the SDA line
7. Upon receiving the acknowledge bit, master sends the 8bit data to the slave device over SDA line, if the
requested operation is ‘Write to device’. If the requested operation is ‘Read from device’, the slave device sends
data to the master over the SDA line
8. Master waits for the acknowledgement bit from the device upon byte transfer complete for a write operation and
sends an acknowledge bit to the slave device for a read operation
9. Master terminates the transfer by pulling the SDA line ‘HIGH’ when the clock line SCL is at logic ‘HIGH’
(Indicating the ‘STOP’ condition) 55
The Typical Embedded System
Master Out Slave In (MOSI): Signal line carrying the data from master to slave device.
It is also known as Slave Input/Slave Data In (SI/SDI)
Master In Slave Out (MISO): Signal line carrying the data from slave to master device.
It is also known as Slave Output (SO/SDO)
Serial Clock (SCLK): Signal line carrying the clock signals
Slave Select (SS): Signal line for slave device select. It is an active low
signal
56
The Typical Embedded System
MISO
SCL
MOSI MOSI Slave 1
SCL SPI Device
Master
MISO (Eg: Serial
(Microprocessor/
SS\ EEPROM)
Controller)
SS1\
SS2\
MOSI
Slave 2
SCL
SPI Device
MISO
(Eg: LCD)
SS\
SPI Bus 57
The Typical Embedded System
TXD TXD
UART UART
RXD RXD
60
The Typical Embedded System
Vcc
4.7K
DQ Slave 1
Port Pin
1-Wire Device
(Eg: DS2760 Battery
GND
monitor IC )
Master
(Microprocessor/
Controller) DQ Slave 2
1-Wire Device
(Eg: DS2431 1024
GND GND
Bit EEPROM )
62
The Typical Embedded System
65
The Typical Embedded System
D0 to Data Bus
Dx-1 Peripheral Device
RD\ RD\ (Eg: ADC)
WR\ WR\
Host Control Signals CS\
(Microprocessor/
Controller) Chip Select
6 9 14 25
DB-25
DB-9 67
The Typical Embedded System
External Communication Interface – RS-232 C & RS-485
Pin No:
Pin Name (For DB-9 Description
Connector)
TXD 3 Transmit Pin. Used for Transmitting Serial Data
RXD 2 Receive Pin. Used for Receiving serial Data
RTS 7 Request to send.
CTS 8 Clear To Send
DSR 6 Data Set ready
GND 5 Signal Ground
DCD 1 Data Carrier Detect
DTR 4 Data Terminal Ready
RI 9 Ring Indicator
68
The Typical Embedded System
External Communication Interface – RS-232 C & RS-485
RS-232 is a point-to-point communication interface and the devices involved in RS-232
communication are called ‘Data Terminal Equipment (DTE)’ and ‘Data Communication
Equipment (DCE)’
If no data flow control is required, only TXD and RXD signal lines and ground line (GND) are
required for data transmission and reception. The RXD pin of DCE should be connected to the
TXD pin of DTE and vice versa for proper data transmission.
If hardware data flow control is required for serial transmission, various control signal lines of
the RS-232 connection are used appropriately. The control signals are implemented mainly for
modem communication and some of them may be irrelevant for other type of devices
The Request To Send (RTS) and Clear To Send (CTS) signals co-ordinate the communication
between DTE and DCE. Whenever the DTE has a data to send, it activates the RTS line and if the
DCE is ready to accept the data, it activates the CTS line
The Data Terminal Ready (DTR) signal is activated by DTE when it is ready to accept data. The
Data Set Ready (DSR) is activated by DCE when it is ready for establishing a communication
link. DTR should be in the activated state before the activation of DSR
The Data Carrier Detect (DCD) is used by the DCE to indicate the DTE that a good signal is
being received
Ring Indicator (RI) is a modem specific signal line for indicating an incoming call on the
telephone line
69
The Typical Embedded System
External Communication Interface – RS-232 C & RS-485
As per the EIA standard RS-232 C supports baudrates up to 20Kbps (Upper limit 19.2Kbps) The
commonly used baudrates by devices are 300bps, 1200bps, 2400bps, 9600bps, 11.52Kbps and
19.2Kbps
The maximum operating distance supported in RS-232 communication is 50 feet at the highest
supported baudrate.
Embedded devices contain a UART for serial communication and they generate signal levels
conforming to TTL/CMOS logic. A level translator IC like MAX 232 from Maxim Dallas
semiconductor is used for converting the signal lines from the UART to RS-232 signal lines for
communication. On the receiving side the received data is converted back to digital logic level by
a converter IC. Converter chips contain converters for both transmitter and receiver
RS-232 uses single ended data transfer and supports only point-to-point communication and not
suitable for multi-drop communication
RS-422 is another serial interface standard from EIA for differential data communication. It
supports data rates up to 100Kbps and distance up to 400 ft
RS-422 supports multi-drop communication with one transmitter device and receiver devices up
to 10
RS-485 is the enhanced version of RS-422 and it supports multi-drop communication with up to
32 transmitting devices (drivers) and 32 receiving devices on the bus. The communication
between devices in the bus makes use of the ‘addressing’ mechanism to identify slave devices
70
The Typical Embedded System
External Communication Interface – Universal Serial Bus (USB)
75
The Typical Embedded System
The IEEE 1394 connector contains two differential data transfer lines
namely A and B
The differential lines of A are connected to B (TPA+ to TPB+ and TPA- to
TPB-) and vice versa
Unlike USB interface (Except USB OTG), IEEE 1394 doesn’t require a host
for communicating between devices. Example, a scanner can be directly
connected to a printer for printing
The data rate supported by 1394 is far higher than the one supported by
USB2.0 interface
1394 is a popular communication interface for connecting embedded devices
like ‘Digital Camera’, ‘Camcorder’, ‘Scanners’ with desktop Computers for
data transfer and storage
76
The Typical Embedded System
External Communication Interface – Infrared (IrDA)
A serial, half duplex, line of sight based wireless technology for data communication
between devices
Infrared communication technique makes use of Infrared waves of the electromagnetic
spectrum for transmitting the data
IrDA supports point-point and point-to-multipoint communication, provided all devices
involved in the communication are within the line of sight
The typical communication range for IrDA lies in the range 10cm to 1 m
IR supports data rates ranging from 9600bits/second to 16Mbps. Depending on the
speed of data transmission IR is classified into Serial IR (SIR), Medium IR (MIR), Fast
IR (FIR), Very Fast IR (VFIR) and Ultra Fast IR (UFIR)
SIR supports transmission rates ranging from 9600bps to 115.2kbps. MIR supports data
rates of 0.576Mbps and 1.152Mbps. FIR supports data rates up to 4Mbps. VFIR is
designed to support high data rates up to 16Mbps. The UFIR specs are under
development and it is targeting a data rate up to 100Mbps
IrDA communication involves a transmitter unit for transmitting the data over IR and a
receiver for receiving the data. Infrared Light Emitting Diode (LED) is used as the IR
source for transmitter and at the receiving end a photodiode is used as the receiver
77
The Typical Embedded System
External Communication Interface – Bluetooth
Low cost, low power, short range wireless technology for data and voice communication
Bluetooth operates at 2.4GHz of the Radio Frequency spectrum and uses the Frequency Hopping
Spread Spectrum (FHSS) technique for communication.
Bluetooth supports a theoretical maximum data rate of up to 1Mbps and a range of approximately
30 feet for data communication
Bluetooth communication has two essential parts; a physical link part and a protocol part. The
physical link is responsible for the physical transmission of data between devices supporting
Bluetooth communication and protocol part is responsible for defining the rules of communication
The physical link works on the Wireless principle making use of RF waves for communication
Bluetooth enabled devices essentially contain a Bluetooth wireless radio for the transmission and
reception of data
The rules governing the Bluetooth communication is implemented in the ‘Bluetooth protocol
stack’. The Bluetooth communication IC holds the stack
Each Bluetooth device will have a 48 bit unique identification number. Bluetooth communication
follows packet based data transfer
Bluetooth supports point-to-point (device to device) and point-to-multipoint (device to multiple
device broadcasting) wireless communication. The point-to-point communication follows the
master-slave relationship. A Bluetooth device can function as either master or slave
A network formed with one Bluetooth device as master and more than one device as slaves is
78
known as Piconet
The Typical Embedded System
External Communication Interface – Wi-Fi
The popular wireless communication technique for networked communication of devices
Wi-Fi follows the IEEE 802.11 standard
Wi-Fi is intended for network communication and it supports Internet Protocol (IP) based
communication
Wi-Fi based communications require an intermediate agent called Wi-Fi router/Wireless Access
point to manage the communications
The Wi-Fi router is responsible for restricting the access to a network, assigning IP address to
devices on the network, routing data packets to the intended devices on the network
Wi-Fi enabled devices contain a wireless adaptor for transmitting and receiving data in the form
of radio signals through an antenna
Wi-Fi operates at 2.4GHZ or 5GHZ of radio spectrum and they co-exist with other ISM band
devices like Bluetooth
A Wi-Fi network is identified with a Service Set Identifier (SSID). A Wi-Fi device can connect
to a network by selecting the SSID of the network and by providing the credentials if the
network is security enabled
Wi-Fi networks implements different security mechanisms for authentication and data transfer
Wireless Equivalency Protocol (WEP), Wireless Protected Access (WPA) etc are some of the
security mechanisms supported by Wi-Fi networks in data communication
79
The Typical Embedded System
External Communication Interface – Wi-Fi
Wi-Fi Router
Device 1
Device 2 Device 3
80
The Typical Embedded System
External Communication Interface – ZigBee
Low power, low cost, wireless network communication protocol based on the IEEE
802.15.4-2006 standard
ZigBee is targeted for low power, low data rate and secure applications for Wireless
Personal Area Networking (WPAN)
The ZigBee specifications support a robust mesh network containing multiple nodes.
This networking strategy makes the network reliable by permitting messages to travel
through a number of different paths to get from one node to another.
ZigBee operates worldwide at the unlicensed bands of Radio spectrum, mainly at
2.400 to 2.484 GHz, 902 to 928 MHz and 868.0 to 868.6 MHz
ZigBee Supports an operating distance of up to 100 meters and a data rate of 20 to
250Kbps
ZigBee is primarily targeting application areas like Home & Industrial Automation,
Energy Management, Home control/security, Medical/Patient tracking, Logistics &
Asset tracking and sensor networks & active RFID
Automatic Meter Reading (AMR), smoke and detectors, wireless telemetry, HVAC
control, heating control, Lighting controls, Environmental controls, etc are examples
for applications which can make use of the ZigBee technology 81
The Typical Embedded System