0% found this document useful (0 votes)
74 views31 pages

Ertc Unit 1 - Part2

Uploaded by

saranlovely433
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views31 pages

Ertc Unit 1 - Part2

Uploaded by

saranlovely433
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Chapter 6

Communication Interfaces
CHAPTER OBJECTIVES
Afier reading this chapter, you will be able to:
Appreciate the need for communication interfaces
e Learn the details of various serial communication interfaces

Understand the Ethernet and wireless LAN interfaces


S Grasp the details of IEEE 1394 interface

Gain knowledge of infrared and Bluetooth wireless interfaces


be
Most of the embedded systems have to interface with the external world. This requirement maydata.
system for sharing the
to transmit the data to a PC or workstation, or to interact with another
communication interfaces.
To meet this requirement, the embedded systems need to be provided with that can be provided to
In this chapter, we will study the various standard communication interfaces
RS422/RS485, IEEE 1394.
the embedded sys tems. We will discuss the details of RS232/UART, IEEE 802.11 and
Universal Serial Bus (USB), Ethernet as well as wireless interfaces such as IrDA,
Bluetooth.

6.1 Need for Communication Interfaces


arises due to the following
The need for providing communication interfaces
reasons:

host will
The embedded system needs to send data to a host (a PC or a workstation). The
analyse of data and present the data through a Graphical User Interface.
. The embedded system may need to communicate with another embedded system to transmit/
receive data. Providing a standard communication interface is preferable rather han providing
proprietary interface.
Network interfaces
. A number of embedded systems may need to be networked to share data.
need to be provided in such a case.
150

so that anyone can access the


Cmbedded system may need to be connected to the Internet
real-time weather monitoring system. The weather moni
oedded systemn. An example is a HIP server.
toring system can be Internet-enabled usino TCP/IP protocol stack and
other devices such as
Mobile devices such as cell phones and nalmtons need to interact withensure that the address
s and laptops for data synchronization Eor
instance. vou need to
When the palmtop comes near the
your palmtop is the same as that on your laptop.
laptop, automatically the two can form a network to exchange data.
after it is installed in the field.
rOr sOme embedded systems, the software may need upgradation
The sofrware can be upgraded through communícation interfaces.
Due to these reasons, providing communication interfaces based on standard protocols 1s a must. Not
Surprisingly, many micro-controllers have on-chip communication interfaces such as a serial interface
to meet these requirements. Now, we will discuss the following communication interfaces.
RS 232/UART
In Brief... " RS 422, RS 485
Universal Serial Bus
Embedded systems are provided
with communication interfaces " Infrared
for monitoring and control by a IEEE 1394 Firewire
host system or a node on a
network. Through these Ethernet
interfaces, an enmbedded system IEEE 802.11 wireless interface
can also be accessed over the
internet.
Bluetooth

For each of these interfaces, we will discuss the hardware details and the protocol stack that needs to
be implemented in software.

6.2 RS232/UART
nco22i a srandard developed by Electronic Industry Association (ELA). This is one of the oldest and
er widely used communication interfaces. The PC will have two RS232 ports designated as COM1
and COM2. Most of the micro-controllers have an on-chip serial interface. The evaluation boards of
the processors are also connected to the host system using RS232
pS222 is used to connect a DIE (Data lerminal Equpment) to a Data Circuit Terminating Equipment
(DCE). A DTE can be a PC,
be anodem, mouse, digitizer orserial printer or a plotrer. DCE can
a scanner. RS232
In Brief... the physical layer interface only. The interface specifies
ohysical, mechanical, elecrical, and specifications describe the
standard
RS232Communicationis used for serial communication. procedural characteristics for
serial between
RS 232 is a standard for
to serial
two devices for speeds up
up to rransmitted serially. The comnmunication, i.e. the bits are
115.2 Kbps over distances
full duplex, i.e. the data communication between rwo devices is in
100 mneters. ransfer can take place in both
directions.
Communication Interfaces
151

A21RS232 Communication Parameters


When two devices have to communicate through RS232. the sending device sends the data
character
by character. The bits cotresponding to the character are called data bits. The data bits are prefixed
with a bit called start bit, and suffixed with one or wo bits called stop bits. The receiving
device
decodes the data bits using the start bit and stop bits. This mode of communication" is called
asynchronous communication because no clock signal is transmitted. In addition to start bit and stop
bits, an additional bit called parity bit is also sent. Parity bit is used for error derection at che receiving
end.
For two devices to communicate with each other using RS232, the communication pararmeters have
to be set on both the systems. And, for a meaninginful communication, these parameters have to be
the samne. The various communication parameters are listed below:

Data rate: The rate at which data communication takes place. The PC supports various data rates such
as 50, 150, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600 and 115200 bps. The oscillator
in the RS232 circuitry operates at 1.8432 MHz and it is divided by 1600 to obtain the 15280 data
rate.
Data bits: Number of bits transmitted for each character. The character can have 5 or 6 or 7 or 8
bits. If you send ASCII characters, the number of bits is 7.
Start bit: The bit that is prefixed to the data bits to identify the beginning of the character.
Stop bits: These bits are appended to the data bits to identify che end of character. If the data bits
are 7 or 8, one stop bit is appended. If the data bits are 5 or 6, two stop bits are appended.
Parity: The bit appended to the character for error checking The parity can be even or odd. For even
parity, the parity bit (1 or 0) will be added in such a way that the total number of bits will be even.
For odd parity, the parity bit will make the total number of bits odd. If the parity is set to none
che Darity bit is ignored. For example, if the data bits are 1010110, the parity bit is Oif even parity
is used; and the parity bit is 1 if odd parity is used. At the receiving end, the device will calculate
the parity bit and if the received parity bit matches with the calculated parity bit, it can be assumed
thar rhe dara is without errors. But thiS IS not the reality. If two bits are in error, the receiver cannor
derect that there is an error!
Flow Control: If one of the devices sends data at a very fast rate and the other device cannot absorb
the data at that rate, flow control is used. Flow control is a protocol to stop/resume data transmission.
This protocol is also known as handshaking. If you are sure thar
there will be no flow control problem, there is no need for
In Brief... handshaking. You can do hardware handshaking in RS232 using two
signals: Request to Send (RTS) and Clear to Send (CTS). When a
The communication parameters device has data to send, it asserts RTS and the receiving device
to be set for serial asserts CTS. You can also do sofrware handshaking a device can
Communication are: data rate, send a request to suspend data transmission by sending the character
number of data bits, number of Control S(0x13). The signal to resume data transmission is sent
stop bits, parity and flow using the character Control Q (Ox1). This software handshaking is
control. also known as XON/XOFE
152

Notes.
be transmitted
Communication using RS232 involves lot of overhead due to the additional bits to and
for 7-bit data, the additional bits to be transmitted are 1 start bit, 1stop bit 1 parity bit.

6.2.2 RS 232 Connector Configurations


connector. In the
RS232 standard specifies wO ypes of connectors: 25-pin connector and 9-pin
these pins is given in lable 6.1.
Dpin contiguration, only a ew pins are used. The description of
Pin number Function (abbreviation)
1 Chassis ground
2 Transmit data (TXD)
Receive data (RXD)
4 Request To Send (RTS)
5 Clear To Send (CTS)
6 Data Set Ready (DSR)
7 Signal Ground (GND)
8 Carrier Detect (CD)
20 Data Terminal Ready (DTR)
22 Ring Indicator (Rl)

Table 6.1: 25-pin Connector Pin Details


For the 9-pin connector, the pin details are given in Table 6.2.
Pin number Function (abbreviation)
1 Carrier Detect (CD)
Receive Data (RXD)
3 Transmit Data (TXD)
4 Data Terminal Ready (DTR)
5 Signal Ground (GND)
6 Data Set Ready (DSR)
7 Request to Send (RTS)
Clear to Send (CTS)
Ring Indicator (RI)
Table 6.2: 9-pin Connector Pin Details

For transmission of l's


and 0's, the voltage levels are defined in the standard. The
different for control signals and data signals. These voltage levels are given in Table voltage
6.3.
levels are
level is with reference to
the local ground and hence RS232 uses The voltage
unbalan ced transmission.
CommunicationIntertaces 153

Signal Voitage Level


Data input +3 volts and above for 0-3 volts and below for 1
Data output +5 volts and above for 0-5 volts and below for 1
Control input +3 volts and above for 1 (ON)-3 volts and below for 0 (OFF)
(OFF)
Control output +5 volts and above for 1(ON)-5 volts and below for 0
Table 6.3: Voltage Levels for Data and Control Signals
from voltage
Note that the voltage levels used in RS232 are different 5 volts and
use
In Brief.. levels used in embedded systems (as most chips
below only). Another problem is that the processor gives out the data
These problems are overcome
in parallel format, not in serial format.Asynchronous
Two types of connectors are Receive Transmit)
used in RS232-25-pin through the use of UART (Universal
connector and 9-pin connector. chips.
The three important pins are-2 Notes.
for transmit, 3for receive and 7
for signal ground in a 25-pin voltage levels
RS232 uses unbalanced transmission i.e., the
ground. Hence,
connector.
are measured with reference to the local
this transmission is susceptible to noise.

6.2.3 UART
format, not in serial
The processors process the data in parallel Universal
In Brief.. format. To bridge the processor and the RS232 port, UART has
Asynchronous Receive Transmit (UART) chip is used.
section. Receive section
Universal Asynchronous Receive [wo sections: receive section and transmit
format and
Transmit (UART) chip converts receives the data in serial format, converts it into parallel
section takes the data in
the parallel data received from gives it to the processor. The transtmit
serial format.
the processor into serial
format parallel format from the processor and converts it into
The UART chip also adds the start bit, stop bits and parity bit.
and sends it to RS232 level necessarv
shifter. It also takes the serial
RS23) level shifter Many micro-controllerS have on-chip UART. However, the
data from the conversion has to be done to meet the voltage levels of
voltage level
and converts into parallel
RS232. This is achieved using a level shifrer as shown in Fig. 6.1.
format.

RS232
Level
UART Shifter Connector

Fig. 6.1: Hardware for RS 232 Interface


shifter
chip operates ar 5 Volts. The level conversion to the desired voltages is done by the level
UART on to the RS232 connector.
and then the signals are passed
154

to T00
hoD2 standard specifies a distance of 19.2 meters, However, vou can achieve distances up
meters using RS232 cables. The data rates supported will be dependent on the UART chip and the
clock used.
such as MAX
iMOst ofthe processOrs including Digital Sienal Processors have on-chip UART. Cs
3222, MAX 324l of Maxim can be used as level shifters.

6.2.4 Null Modem Cable Connection


KS2)2 ports
IT you want to connect two DTEs such as rwo PCs. vOu need to interconnect the rwo
Using a null modem cable. The null modem cable connections are shown in Fig. 6.2. Fig. 6.2(a) shows
the connections for 25-pin connectors and Fig. 6.2(b) shows the connections for 9-pin connectors.
However, the minimal connections required are for TD, RD and GND. If you are using pirn
connector, it is sufticient if you connect pin 2 to pin 3, pin 3 to pin 2 and pin 7 to pin/. Ihis Is
the minimal configuration.
1

2
2

5
6

7 7

8
20e 20

(a) (b)
Eig A2 Null Modem Cable Connections: (a) 25-pin Connectors (b) 9-pin Connectors
To make rwo devices communicate with each other using KS232 interface, vou need to connecr the
rNO PCs using a null modem cable and set the communicatton parameters on both the devices you
Can experiment with vartous parameters for serial communtcatton using the HyperTerminal programn
n Windows. Fig. 6.3 shows the screenshot to set the serial
sCreen, you need to do thecommunication
following:
parameters. To obrain thiN
" Click on Start Menu
In Brief..
. Go to Programs
and
Using a null modem cable . Go to Accessories
Hyperlerminal program, you .
can establish serial
Go to Communications
Communication between two . Go to HyperTerminal
Windows
machines running the . Double click on
operaling system. HYPERTRM.EXE
156

int port open (vo id)

int fd;
fd = Open(/dev/ttyS0",0 RDWR | o NOCTTYONDELAY) ;
if (fd -1)

perror ("Unable to open the port: /dev/tty0");


else

fcntl (fd, F SETFL, 0);

return (fd) ;

VOid port config (int fd)

struct termios settings;

tcgetattr (fd,&settings) ;
cfsetispeed (&settings, B9600); // Set baud rate to 9600
cfsetospeed ( &settings, B9600);

settings.c cflag - ( CLOCAL CREAD);// set to local mode


settings.c cflag &= -PARENB; / /no parity bit
settings.c cflag &=-CSTOPB; // tWO stop bits
settings.c cflag &= -CSI ZE; //bit mask for data bits
settings.c cflag = CS8; //8 data bits

tcsetattr (fd, TCSANOW, &settings);

Void write data (int fd, char *C)

int n;
n
write (fd, C, strlen (c) );
if (n<0)

fputs("write() of data failed!


\n",stderr) ;
comunicationInterfaces
157

read data (int fd)


roid

char array [255);


char *ptr;
int nbytes ;

ptr = array i
while( (nbytes read (fd, ptr, array + sizeof (array) -ptr-1)) > 0)

ptr += nbytes;
if((ptr[-1] ==
\n') | (ptr[-1] ==
\r'))
break;

*ptr = \0';
printf ("Received String: %s",array) ;

vOid port close (int fd)

close (fd) ;

lnt ma in (void)

int fd;
fd port open();
port Config (fd) ;
World") ;
Write data(fd, " Hello
read data (fd);
port close ( fd) ;
return 0;

can find
opens che serial port. /dev/ttyS0 is the device file, You
The function port open (void)installation in the /dev directory and use that file name instead of
Linux
out the device file of your
ldev/ttyS0. is to contigure the port parameters.
fd)
Ihe function port config (int fd, char *c) is to write data onto the port. The pointer to a
(int
The function write data this function.
is passed from
character array'
158

The function read data (int fd) is to read the data from the port.
The function port close (int fd) closes che port.
The main(void) function calls the functions to open rhe port, configure the port paratmeters, wTIte the
data, read the data and then close the port.
You can compile this program using the following shell command.
Note that the $ sign is the system prompt.
In Brief... $gcc serialcom.c

Serial communication The file a.out will be created. You can execute this file by giving the
command
programming involves opening
the device file, configuring the $./a.out
port by setting the
Communication parameters, The message "Hello World" will be displayed on che Windows system.
reading/writing data and then You can type some text on the Windows system and it will be
closing the port. displayed on che Linux system.

6.3 RS422/RS485
RS422 standard for serial communication is used in noisy environments. Using this standard interface,
the distance berween two devices can be up to 1200 meters. Twisted copper cable is used as the
transmission medium. Unlike RS232 in which the voltage levels are measured with reference to local
ground, in RS422, voltage difference between the two copper wires represents the logic levels. Hence,
RS422 uses balanced transmission. Two channels are used for transmit and receive paths. As compared
to RS232, RS422 is better suited to work in noisy environments over
In Brief... longer distan ces because of balanced transtmission.
RS485 is a variation of RS422 to connect a number of devices in
In RS422 and RS485, twisted a network. An RS485 controller chip is used on each device. A
copper pair is used as network using RS485 protocols operates in a Master/Slave
transmission medium. The configuration. Up to 512 devices can be networked. Using one twisted
voltage difference between the pair, half-duplex communication can be achieved and using two tWisted
two wires represents logic levels, pairs, full-duplex communication can be achieved.
i.e. balanced transmission is
used and hence this Chips such as MAX3488 are used for RS422. MAX 3483 is an RS
transmission is immune to 485 controller for half-duplex communication and MAX 3491 is for
noise. full-duplx communication.
6.4 USB
Universal Serial Bus has gained im1nense popularity in recent years. Desktops, laptops, printers, display
asiiees video cameras, hard disk drives, CDROM drives, audio equipment etc. are now
ISB interface. Using USB, a number of devices can be networked using Master/Slaveavailable with
A bosr such as the PC, is desigrnated as a master. As showWn in Fig. 6.4, a number ofarchitecture.
nam of 127, can be connected in the form of an inverted tree. On the host.
devices, up
such as a PC.
Communication Interfaces
159

In Brief... there will be a host controller a combination of hardware and


software to control all the USB devices. Devices can be connected
Universal Serial Bus (USB) is a to the host controller cither directly or through a hub. Ahub is also
serial communication protocol a USB device that cxtends the number of ports from 2 to 8

to connect up to 127 devices to to connect other USB devices. A USB device can be self-powered,
a host. A USB device can be or powered by the bus. USB can supply 500 mA current to the
self-powered, or it can be devices.
powered by the bus.

USB
Host
Controller

USBY
USB

Printer
Keyboard
USB Hub

USB

USB

Digital Camera

Scanner

Fig. 6.4: USB Device Connection Hierarchy

6.4.1 USB Physical Interface


Ashielded 4-wire twisted copper cable is used with the pin connections
In Brie. as shown in Table 6.4. Data is transmitted over a differential rwisted
pair of wires labeled D and D
USB uses a twisted pair of wires
as the medium. Data is Pin number Function (abbreviation)
transmitted over the twisted pair
using differential data lines and +5 V Power (VBUS)
hence balanced communication Differential data line (D+)
is used.
3 Differential data ine (D-)
4 Power and Signal ground (GND)
Table 6.4: Pin Connections for USB Intertace
160

6.4.2 Features of USB


Data rates: USB 1.1 standard supports 12 Mbps data rate, and 1.5 Mbps for slower peripherals.
USB2.0 supports data rates up to 480 Mbps.
Special features: USB supports plug and play, i.e. you can connect USB devices to the hub or the host
without any need for configuration sertings.The host will detect and identify the device by exchanging
a set of packets. This is known as "Bus Enumeration". The devices are hot-pluggable, 1.e. there Is no
need to switch off the power to connect the device.
Communication protocol: The communication berween che host and the devices is in the form of
packets. When a device is connected, the host obtains the configuration and properties of the device
and assigns a unique ID to identify the device in che nerwork. When a device is removed, the hub
intorms the host. Short data packets are exchanged for handshaking, acknowledgements, and for
Informing the capabilities of the devices. Packets of the size up to 1023 bytes are exchanged for data
transfer. When a device is plugged in, the host automatically gets the complete information about the
device, either directly or through the hub. An ID is assigned to that device and the communication
can start.

Device classes: Each USB device has a unique ID (between 1and 127) and a device descriptor that
provides information about the device class and its properties. The
device classes are display, communication, audio, mass storage and
In Brief human interface (such as keyboards, front panel knobs, control pancls
in VCR, data gloves etc.).
USB1.1 supports data rates of Providing aUSB interface to an embedded system is just to integrate
12 Mbps and 1.5 Mbps. a USB chip such as USS-820D of Agere Systems. Maxim's MAX
USB2.0 supports 480 Mbps 3450E, 3451E and 3452E are some of the USB transceivers.
data rate. Communication is in
the form of packets. USB USB is a powerful, versatile and simple communication interface.
supports plug and play feature So, not surprisingly, many peripherals are now provided with a USB
as well as hot insertion.
interface. RS232 will be confined to the technology museums.
6.5 Infrared
Infrared interfaces are used in remote control units of TV, VCR, air-conditioner, etc. However rhese
interfaces are all based on proprietary protocols. Infrared Data Association (IrDA a non-profit
industry association (www.irda.org) founded in T993, released the specifications for low-cost infrared
communication between devices. Intrared nterfaces are now commonplace for a number of devices
Such as palmtops, cell phones, digital cameras, printers, keyboards, mice, LCD projectors. ATM
entds erc Infrared interface provides a loW-COSt, Short range,
berween two devices. The only drawback point-to-point communication
onerares in line of sight with infrared is thar it
In Brief.. through walls. It supportscommunication
only dara.
mode and it cannot penetrate
The block diagram of IrDA module is
Infrared is a low-cost, point
to-point communication protocol architecture is shown in Fig.shown in Fig. 6.5(a) and rhe
mechanism for short ranges.
6.5(a), the device will have an infrared 6.5 (b). As shown in Fig.
transceiver. The transmirter
Communication Interfaces 161

is a LED and the receiver is a photodiode. Agilent's HSDL-1001 can be used as a transceiver. For
low data rates, the processor of the embedded system itself can be used whereas for high data rates,
aifferent processor may be needed.
The data to be sent on the infrared link is packetized and encoded as per the IrDA protocols and sent
over the air to the other device. The receiving device will detect the signal, decode and depacketize
the data.

Transceiver
Processor UART / Packetizer Encoder I Decoder LED, Photodiode

(a) IrDA Module

Higher Layers
(Application, IrCOMM)

Link Man agement Protocol


(IrLMP)
Link Access Protocol
(irLMP)

Physical Layer
(IrLMP)

(b) Protocol Architecture


Fig. 6.5: Infrared Interface

As shown in Fig. 6.5(b), for communication through infrared interface, the


physical layer (IrPHY) and
through IrLMP. above
data link laver (IrLAP) are specified in the standards. Link Management is done
which the applicatrion layer protocols will be running.
communication. IrDA has rwo
Physical layer: IrPHY specifies the data rates and the mode of with bi-directional
SDecifications viz.. IrDA Data and lrDA control. IrDA Data has a range of 1meter
(FIR) supports data
communication. Serial IR (SIR) supports data rate up to 115 Kbps and Fast IRcommunication
bi-directional speed
rates up to 4 Mbps. IrDA Control has a range of 5 meters with
n to 7s Kbps. A host such as PC can communicate with 8 peripherals using IrDA protocols.
protocol. Master/
Data link layer: The data link layer is called the IrLAP. IrLAP is based on HDLC communication
starts the
Slave protocol is used for communication between two devices. The device chat
is the master. The master sends the command and the slave sends a response.
of other devices. It also
Link management layer: This layer facilitates a device to query the capabilities
provides the software capability to share IrLAP between multiple tasks.
Higher layers: The higher layer protocols are application specific. IrCOMM protocol emulates the
fitted with infrared
standard serial port. When two devices such as palmtop and mnobile phone both
interface come face to face, they can exchange the data (say, the address book) using the application
laver protocols.
162

In spite of its limitations such as short rane. low data rates and point-to-point communication,
Intrared IS a very popular communication interface for consumer items and office automation equlpment
because of its low cost.
Notes..
Intrared communication using irDA standards provides interoperability between IR ports suppled
by different manufacturers. The present IR ports of TVs, air-conditioners etc. do not suppon tiese
standard protocols.

6.6 IEEE 1394 Firewire


interconnect consumer devICes
APple Computers Inc. initiated the development of a mechanism to
such as PC, printer. TV, VCR, digital camera, CD plaver using a serial bus known as Fireware. Later
on, it led to the development o the standard IEEE 1394. As shown in Fig. 6.6(a),
the consumer
devices can be connccted using this serial bus. The cable length can be up to 4.5 meters. The only
restriction is that the devices cannot be connected in loops. IEEE 1394 provides plug and play
is active.
capab1l1ty and hot insertion capability. You can insert or remove a device even when the bus
there,
Another feature is that peer-to-peer communication is supported and hence even if the PC is not
any two devices can be connected.

Printer TV VCR CD Player


PC

Digital
Cemera

(a) Cosnnecting Devices through lEEE 1394 Bus

Transaction Layer
Bus Management

Resource
Data Link layer Management
Node Control

Physical Laver

(6) Protocol Architecture


Fic o6 iEEE 1364
Communication Interfaces 163

Each device is given a 6-bit identification number and hence a


In Brief... maximum of 63 devices can be interconnected on a single bus.
Using bridges, multiple buses can be connected. Each bus is given
IEEE 1394 Firewire is a standard a 10-bit identification number and hence 1023 buses can be
for interConnecting consumer interconnected. The standard specifies copper wire or optical fiber
electronic devices using a serial as the transmission medium with data rates 100, 200, 400, 800,
bus. Each bus can support 63
devices.
1600 and 3200 Mbps.
The protocol architecture for the communication between devices is
shown in Fig. 6.6(b). The functionality of various layers is as follows:
Physical layer: This layer specifies the clectrical and mechanical connections. Bus initialization and
arbitration are the functions of chis layer. These functions ensure that only one device transmits data
at a time.

Data link layer: The layer takes care of packet delivery, acknowledgements and addressing of the
devices.
Transactiòn layer: This layer handles the writing and reading of the data from the devices.
Management protocols: These protocols are used to manage the bus and chey run on each of the
devices. These protocols do the necessary resource management and control the nodes.
Many consumer appliances are being provided with IEEE 1394 interface. Note that this interface itself
is an embedded system.

6.7 Ethernet
Ethernet interface is now ubiquitous. It is available on every desktop and laptop. With the availability
of low-cost Ethernet chips and the asso ciated protocol stack, providing an Echernet interface is very
easy and useful to the embedded system. Through the Ethernet interface, the embedded system can
be connected to the LAN. So, a number of embedded systems in a man ufacturing unit can be
connected as a LAN; and, another node on the LAN, a desktop computer, can monitor all these
embedded systems. The data collected by an embedded system can be transferred to a database on che
LAN.
The Ethernet interface provides the physical layer and data link layer functionality. Above the data link
layer, the TCP/IP protocol srack and the application layer protocols will run. This protocol architecture
is shown in Fig. 6.7.
164

Application Layer
(SMTP FTP HTTP)

TCP Layer

IP Layer

Logical Link Control


Data Link Layer
Medium Access Control

Physical Layer

Fig. 6.7: Ethernet LAN Protocol Architecture


Physical layer: The Ethernet physical layer specifies a RJ 45 jack using which the device is connected
to the Local Area Network. Unshielded twisted pair or coaxial cable can be used as the medium. Two
pairs of wires are used for transmission, one for transmit path and one for receive path. Ethernet
transmits balanced differential signals. In each pair, one wire carries signal voltage between 0 to +2.5
volts and the second wire carries signals with voltage between -2.5 volts and O volts, and hence the
signal differen ce is 5 volts. The various pin connection details of RÊ 45 connector are given in Table
6.5. Speeds of 10 Mbps and 100 Mbps are supported.
Pin number Function (abbreviation)
1 Transmit Data (TD+)
2 Transmit Data (TD-)
3 Receive Data (RD+)
4 No connection (NC)
5 io connection (NC)
6 Receive Data (RD-)
7 No Connection (NC)
No Connection (NC)
Table 6.5. Pin Connections for Ethernet Interface
Doe iok layer: The data link layer is divided into Medium Access Conrol (MAC) laver and Logical
Conrrol (LLC) layer. The MAC layer uses the Carrier Sense Multiple Access/Collision Detection
CAiCD) protocol to access he shared medium. The LLC layer specifies the protocol for logical
ion cstablishment, flow control, error control and acknowledgements. Each Ethernet interface
48 bits
will have a unique Etthernet address of
availability of low-cost Ethenet chips (uch as CS 8900A of Cirrus Logic), with lirtle
lcost. an embedded system carn be proVided with Ethernet connectivity. Even 8-bir micro
Communication Interfaces
165

controller based embedded systems can be provided che Ethernet


In Brief.. interface. To make the embedded system network-enabled, as shown
In Fig. 6.7, the upper layer protocols viz., TCP/IP stack has to run
Ethernet standard specifies the above the Ethernet. The TCP/IP stack has to be embedded along
physical layer and data link with the Operating Svstem and application software in the firmware.
layer standards to connect
devices in a Local Area If the er'edded syst :m has to send mails, Simple Mail Transfer
Network. Above the Ethernet ProtoSMTD) has to run. To support ile transter application, File
protocols, TCP/IP protocol has Transte1 Prote (FTP) software has to be ported. If the embedded
to be run to make the system has to work as a web server, the HTTP server sofrware has
embedded system Internet to run on the system.
enabled.

Notes.
In Ethernet, the data link layer is divided into two sub-layers-Medium Access Control (MAC)
sub-layer and Logical Link Control (LL) sub-layer. MAC sub-layer faciltates muliple nodes lo
access the medium using CSMA/CD protocol. LLC sub-layer defines the protocols for link
establishment, flow control and error ontrol.

6.8 IEEE 802.11


IEEE 802.11 family of standards is for Wireless Local Area Nerworks and Personal Area Networks.
These standards cover the physical and_ MAC layers of Wireless LANs. The LLC layer is same as for
the Ethernet LAN. The architecture of lEEE 802.11 standard for Wireless LAN is shown in Fig. 6.8.
Each wireless LAN node has a radio and an antenna. All the nodes running the same MAC protocol
and competing to access the same medium will form a Basic Service Set (BSS). This BSS can interface
to a backbone LAN through Access Point (AP). The backbone LAN can be a wired LAN such as
Ethernet LAN. Two or more BSSs can be interconnected through the backbone LAN. In trade
magazines, the Access Points are referred as "Ho tspots".

AP
Motupot
Backbone
Network

AP
BSS
AP
Hotspot
BSS
Hotspot

Laptop

Fig. 6.8: IEEE 802.11 Wireless LAN


166

I he physical medium specifications for 802.11 WLANS are:


Dmused Intrared with anto operating wavelength between 850 and 950 nm. The data rate
suPported using this medium is 1 Mbps. 2 Mbps data rate is optional.
Direct Sequence Spread Spectrum operaring in 2.4 GHz ISM band. Up to 7 channels each with
a data rate of l Mbps or 2 Mbps can be used.
yeny hopping spread spectrum operating in 2.4 GHz ISM band with 1Mbps data rate
2 Mbps data rate is optional.
ISM (Industrial, Scientific and Medical) band is a free' band and hence no government approvals are
g a to operate radio systems in this band. ISM band frequency range is 2400 - 2483.5 MHz.
Extensions to IEEE 802.11 have been developed to support higher data rates. 802.11b standard has
been developed which supports data rates up-o 2 Mbps at 2.4 GHz, with a range of 100 meters,
Another extension, 802.1la, operates in che 5 GHz frequency band and can support data rates up to
54 Mbps, with a range of 100 meters. 802.1lg supports 54 Mbps data rates in the 2.4 GHz band.

Random
backoff
DIFS
Medium Busy Frame

SIFS

DIFS

Fig. 6.9: CSMA/CA protocol


The MACprotocol used in 802.11 is called CSMA/CA (Carrier Sense Multiple Access with Collision
Avoidance). The CSMA/CA operation is shown in Fig. 6.9. Before transmitting, a node senses the
radio medium and if the channel is free for a period longer than a pre-defined value (known as
Distributed Inter Frame Spacing or DIFS), the node transmits immediately. If che channel is busy, the
node keeps sensing the channel and if it is free for a period of DIFS, the node waits for some more
period called random back-oft interval and then transmits its frame. When the destinationf receives che
frame, it has to send an acknowledgement (ACK). To send the ACK, the destination will sense the
medium and if it is free for a pre-defined short time (known as Short Inter Frame Space or SIFS),
the ACK is sent. If the ACK does not reach the station, the frame has to be retransmirred using che
eocedure. A maximum of 7retransmissions are allowed after which the frame is discarded. This
procedure is known as CSMA/CA.
Communication Interfaces 167

Access
Point

Laptop Laptop Laptop Laptop

(a) Communication through Access Point (b) Direct Communication


Fig. 6.10: Communication between nodes in Wireless LAN
An important feature of IEEE 802.11 wireless LAN is that two or more nodes can communicate
directly also without the need for a centralized control. The two configurations in which the wireless
LAN can operate are shown in Fig, 6.10. In Fig. 6. 10(a), the configuration uses the Access Point as
described earlier. In Fig. 6. 10(b), direct communication between
two devices is shown. When two or more devices form a network
In Brief... without the need or centralized control, they are called ad hoc
networks. For instance, a mobile phone can form a network with a
IEEE 802.11 family standards laptop and synchronize data automatically.
specify the physical and data
link layer protocols for Embedded systems are now being provided with wireless LAN
providing wireless connectivity connectivity to exchange data. The main attraction of wireless
to devices. infrared and ISM connectivity is that it can be used in environments where running
bands are used for transmission. a cable is difficult such as in shop floors of manufacturing units.
Notes.
IEEE 802.11b ispopularly known as Wifior Wireless Fidelity. if Wifi Access Points are installed,
say all over the city, wireless Internet access can be provided to people on the move.
To provide wireless Internet access to mobile devices, a special protocol called Mobile IP has
to run on the mobile devices.

6.9 Bluetooth
A [ypical office cabin or a home or even a car is equipped with a number of electronic gadgets such
desktop, laptop, printer, modem, mobile phone, etc. These devices are interconnected through wires
for using a service (e.g. a print service) or for sharing information (e.g. transferring a file from desktop
to laptop). These devies form a Personal Area Network (PAN). When we bring two devices, say a
laptop and a mobile phone, close to cach other, these two can automatically form a network and
168

xchange data. For example, we can transfer the address book from the mobile phone to the laptop.
termed as ad-hoc
are
ne networks, formed spontaneously by comine closer of two or more devICes, any timne are not fixed
nerworks. In an ad-hoc nerwork. the topology and the nunber of nodes at
of nodes in the network may also
the topology may change dynamically with time: and the nunber such networks can be avoided if
Change With timc. All the headaches associated with administeringalso if one device can find out the
these devices are made to communicate throuch radio links and
can discover other devices). The
presence of othet devices and thcir capabilities (i.e. if one device
need for such PANs is evervwhere-in office cabins, at homes arnd also in cars.
Notable among them are Bluetooth, IrDA
A number of technologies have been proposed for PANS. wireless connectiVity to
and TEEE 802.ll. Bluetooth holds a great promise because it can provide
embedded systems at a very low cost.
The salient features of Bluetooth technology are:
as a cable connection. Since most of
" lt is a low-cost technology-its cost will soon be as low
the Bluetooth-enabled devices have to operate through a battery, the power consumption is also
verv low.
not controlled by any
" lt is based on radio transmission in the ISM band. ISM band is
Bluetootin radio systems.
government authority and hence no special approval is required to use
meters, though with
" It caters to short ranges. The range of a Bluetooth device is typically 10
higher power, the range can be increased to 100 meters.
large number of
" It is based on open standards formulated by a consortium of industries and a
equipment vendors are committed to this technology.
Bluetooth Special Interest Group (SIG) founded in February 1998 by Ericsson, Intel, IBM, Toshiba and
Nokia released version 1.0 of Bluetooth specifications in July 1999. Version 1.1 of Bluetooth
specifications was released in February 2001.
Most of clectronic devices can be Bluetooth-enabled. These include a PC, laptop, PDA, digital camera.
mobile phone, pager, MP3 player, headset, printer, keyboard, mouse, LCDprojector, domestic appliances
such as TV, microwave oven, music players etc. To make a device Bluetooth-enabled, a module
containing the Bluetooth hardware and firmware is attacked to the device. And, a piece of software
is run on the device. A Bluetooth-enabled device communicates with another Bluetooth-enabled device
over the radio medium to exchange information or transfer data.
Communcation Interfaces 169

Desktop
Call Phone
PM3 Player

Digital
Camera

Microwave Oven

Laptop

Fig. 6.11: Wireless Personal Area Network


the radio
form a Personal Area Network if they are in
As shown in Fig. 6.11, a set of devices can another
radius). When a device comes in the vicinity of
vicinity of each other (typically 10 meters a network. A
device, Bluetooth protocols facilitate their forming
the other device and
device can find out what services are offered by
In Brief. discover the
then obtain that service. For example, a laptop canSuch networks
service.
printer automatically and then obtain the print
Bluetooth is a low-cost wireless formed on the fly and
are called ad-hoc networks as the network is
technology to develop Personal longer here.
Area Networks. Various devices once the device gets out of sight, the network is no cars and also
within a vicinity of about 10 Such networks can be formed in office, at home, in
meters can form a network in public places such as shopping malls, airports etc.
using Bluetooth wireless link.
Specifications
6.9.1 Bluetooth System
Bluetooth system are as follows:
The specifications of the 2400
Frequency of operation: Bluetooth deviCes operate in the lSM band in the frequency range
guard band
each of 1 MHz bandwidth, with a lower
2483.5 MHz. This band consists of 79 channels frequency
upper guard band of 3.) MHz. When a deVice transmits its data, it uses
of 2 MHz and
transmits each packet in a different channel. The receiving device has ro switch
hopping, i.e. the device radio design becomes complex when frequency
to char channel to receive that packet. Though the secure communication. Nominal frequency hop rate
hopping is used, the advantage is that It provides
is 1600 hops persecond. as the modulation technique. Binary l
Modulation: Gausian Frequency Shift Key1ng (GFSK) is usednegative frequency deviation. The radio
positive frequency eviation and 0 by
is represented by a away that the Bit Error Rate (BER) of
minimum 0.1% is ensured,
receiver has to be designed in such
170

.e. the radio should provide a link which ensures rhar rhere will not be more than I error for every
1000 bits transmitted.
Operating range: Three classes of devices are defined in Bluetooth specifications:
devices Is T00 meters.
Class I devices transmit maximum of 100 mW The range of such
Class 2 devices transmit 10 mW. The range is 50 meters.
Class 3 devices transmit 1 mW. The range is l0 meterS.
Most of the commercially available devices have a transmittino power of l milliwatt and hence a range
of 10 meters.

Services supported: Both data and voice services are supported by Bluetooth devices. For vo1ce
communication, Synchronous Connection Orien ted (SCo links are used which support circuit switching
operation. For data communication, Asynchronous Connection Less (ACL) links are used which use
packet switching. The SCO links carry voice. TwO types of voice coding are defined in the specifications:
Pulse Code Modulation (PCM) based on G.71l standard at 64 Kbps and Continuously Variable Slope
Delta Modulation (CVSD) technigque also at 64 Kbps. There is no retransmission of votce packets it
they are lost or received in error.
For data services, devices exchange data in the form of packets. The receiving device acknowledges
errors, the packet
the packet or reports that the packet is received in error. If a packet is received with
is retransmited. It is also possble to broadcast packets by one device to al the other devices in the
network. However, in broadcast mode there is no acknowledgement or indication that the packet is
received with errors. The broadcasting device informs the receiving devices how many times a broadcast
packet will be transmitted so that at least once every device will receive the packet without errors.
Data rates: A Bluetooth device can support three synchronous voice channels and one asynchronous
data channel. For voice communication, 64 Kbps dara rate is used in both directions. For asynchronous
links, two types of channels are defined with different data rates. In asymmetric channel, data rates
are 723.2 Kbps in one direction and 57.6 Kbps in the other direction. In symmetric channel, data
rate is 433.9 Kbps in both directions.
Network topology: In a PAN, a set of devices form a small network called piconet. In a piconet, there
will be one Master and one or more Slaves. All the Slaves tune to the Master. The Master decides
che hop frequency sequence and all the Slaves tune to these frequencies to establish communication
links. Any device (desktop, mobile phone etc.) can be a Master or Slave. The Master/Slave terminology
is only for the protocols, the device capabilities are not defined by this terminology. It is also possible
for aMaster and Slave to switch roles--a Slave can become a Master. A piconet can have maximum
number of seven slaves which can actively communicate with the Master. In addition to these active
slaves, apiconet can contain many Slaves that are in parked mode. These parked devices are synchronized
wich che Master, bur Division
chey are not active on the channel. The communication berween the Master and
Duplex (TDD).
the Slave uses Time
:s 62shows the various topologies of a Bluetooth piconet. In Fig. 6.12(a), a piconet is
shown with
Master and one Slave. lt is a point-to-point communication mode. In Fig. 6.12(b), the piconet
iers of aMaster and a number of Slaves. It Is a point-to-multipoint
communication mode. Fig.
12 shows a scatternet which IS rorimea by a number of piconets. In this scatterner,
each piconer
OMasrer and a number of Slaves. 1he Master of a piconet can be a Slave in another piconet.
Communication Interfaces 171

Each piconet in the scatternet will have its own frequency hopping sequence and hence there will be
interference between two piconets. In a scatternet, even if the coverage areas of two plconets
overlap, there will be no interference.

M
M

(a) Point-to-point Communication between (b)Point-to-multijpoint Communication


Master and Slave between Master and Multiple Slaves.
M/S

Piconet

Piconet

Piconet

(c) Scatternet
Fia. 6.12: Bluetooth Piconet &
Scatternet
Communication between Master and Slave: The Master and Slave
communicate in the form of packets. Each packet is transmitted in
In Brief.. a time slot. Each time slot is of 625 microseconds duration. These
slors are numbered from 0 to 22-1. Master starts the transmission
Bluetooth-enabled devices form the slave
in even slots by sending apacket addressed to a slave and
a network known as piconet. in sends the packets in odd numbered slots. A packet generally occupies
a piconet, there will be one extends
master and up to seven active one time slot, but can extend up to five slots. If a packet
the entire
slaves. Communication between more than one slot, the hop frequency will be che same for
the master and slaves can be Dacket. If che Master starts the transmission in slot 0 using frequencv
point-to-point or point-to f1, the slave transmits in slot l using frequency f2, master transmirs
multipoint. in slot 2 using frequency f3, and so on.
172

STANDBY

PAGE INQUIRY
PAGE INQUIRY SCAN
SCAN

MASTER SLAVE INQUIRY


RESPONSE RESPONSE RESPONSE

CONNECTION

Fig. 6.13: Bluetooth State Transition Diagram


A Bluetooth device can be in different states as shown in Fig.
6.13. To start with, an application
program in a Bluetooth device can enter the inquiry state to enquire about other devices in the
To respond to an inquiry, the devices should periodically enter vicinity.
into inquiry scan state and when the
inquiry is successfully completed, they enter the inquiry response state.
connected to another device, it enters the page state. In this state, the When a device wants to get
device will become the Master
and page for other devices. The command for this paging
has to
In Brief.. come from an application program running on this Bluetooth device.
When the device pages for the other device, the other device
respond and the Master enters the master response may
Communication between the state. DeviCes
master and slaves is achieved should enter the page scan state periodically to check
using packet transmission. Each devices are paging for them. When device whether other
device sends its packets using packet, it enters the slave response receives the page scan
frequency hopping. Master state.
Once paging of devices is
Sends the packets in even completed, the Master and the Slave
establish a connection. Thereafter,
numbered slots and the slaves the connection is in active
send the packets in
odd during which the packet state,
numbered slots. can also be put in one of transmission takes place. The connection
the three modes: 'hold' or
sniff or park
Communication Interfaces 173

modes. In hold mode, the device will stop receiving the data traffic for a specific amount of time
that other devices in the piconet can use che channel. Afer the cxpiry of the specific time, the
device will start listening to tratfic again. In sniff mode, aslave will be given an instruction like listen
with slot number S every T slots for a period of N slots. So, the device need not listen to
starting
all the packets, but only as specifird through the above parameters called sniff paraneters. The
connection can be in park mode when the device only listens to a beacon signal from the Master
occasionally, and it synchronizes with the Master but does not do any data transmission.
Atypical procedure for setting up a Bluetooth link can be:
The device sends an inquiry using a special inquiry hopping sequence.
contains the
e Inquiry scanning devices respond to the inquiry by sending a packet. This packet
information needed to connect to it.
responded to the inquiry.
The inquiring device requests a connection to the device that
Paging is used to initiate the connection with the selected device.
" The selected device that has entered the page scan state responds to the page.
synchronizes with the Master's timing and
" If the responding device accesses the connection, it
frequency hopping sequence.
given a 48-bit address containing
Bluetooth Addressing: Each Bluetooth module (the radio transceiver) ispart (UAP) with 8 bits and Non
address
three fields: LAP (Lower Address Part) with 24 bits, Upper
assigned by the manufacturer of the Bluetooth
Significant Address Part with 16 bits. This address is
assigned number. This address is unique to every
module and consists of company ID and company address is referred to as BD_ADDR.
Bluetooth device. In Bluetooth specifications, this active
3-bit address. In addition to the maximum of 7
Each active member in a piconet will have a
mode. The parked members also need to have
members, many more devices can be in 'parked exchange of packets. Parked member address
master can make them active for
addresses so that the
the BD ADDR of 48 bits or an 8-bit parked member address denoted by PM ADDR.
is either dors.
profiles: To ensure interoperability between devices mnanufactured by different ven
Bluetooth define the precise characteristics and protocols
Bluetooth SIG released the Bluetooth profiles' which
are-defined for headset, cordless phone, fax machine.
supported by these devices. The Blueooth profiles networking, file transfer, synchronization of data
dial-up
LAN Access Point, serial communication,
between two devices, etc.
Notes.
Bluetooth profles
interoperability of Bluetooth modules of different manufacturers,
To achieve devices and services.
are defined for different

Architecture
6.9.2 Bluetooth Protocol
comnplete protocol stack of Bluetooth system is given in Fig. 6.14.
The
174

Audio
SDP RFCOMM TCS

Voice
LMP L2CAP

SCO
ACL

Baseband & RF

Fig. 6.14: Bluetooth Protocol Architecture

Baseband and RF
The baseband layer is for establishing the links between devices based on the type of service required
ACL for data services and SCO for voice services. This layer also takes care of addressing and
managing the different states of the Bluetooth device. The RF portion provides the radio interface.

Link Manager Protocol (LMP)


The Link Manager Protocol (LMP) is used to ser up and control links. The three layers-RE Link
controller and the Link manager--willbe on the Bluetooth module attached to che device. The link
manager on one device exchanges messages with the link manager on the other device. These messages,
known as LMP messages, are not sent to higher layers. Link messages have higher priority
to data. LMP messages are sent as single slot packets, with a header of 1byte. compared
The functions of the
LMP are as follows:
Authentication: When two devices have to
orber device. So, one device is called verifiercommunicate with each other, one has to verify the
and the other is called claimant. The verifier sends
a message, a packet containing a random number, which is
calculates the response which is afunction of challenge and sends called a challenge. The claimant
Bluetooth address (48-bit address) and secret key. This is known as the response along with its
vou throw a challenge and check whether the other device can
challenge.
Challenge-Response scheme
correctly respond to that
Eocrvption: To mintain confidentiality of data over the radio
Master sends a key with which the data is encrypted to all the link, the data is encrvpted. The
slaves, through an LMP
Clock ofset request: Synchronizing the clocks between the
Master and the message.
proper exchange of data. If che clock has to be offset, the LMP Slaves is a must for
clock synchronization. exchanges messages to ensure
Communication Interfaces 175

Timing accuracy intormation request: To ensure synchronization, the master can request the
slaves for timing accuracy information.
LMP lo
. LMP version: It needs to be ensured that both the devices use the same version of
achieve this, version number of the LMP protocol is exchanged.
Type of packets supported: As different Bluetooth-enabled devices may support different fea
tures, LMP features request and response are exchanged between the devices.
other devices will
Switching Master/Slave role: In apiconet, a device will act as a Master and messages.
the LMP
act as Slaves. The Master and the Slave in a piconet can switch roles using
The Master or the Slave can initiate the switching operation.
user-friendly name having a maximum of 248 bits
" Name request: Each device can be given a
through an LMP message and obtain the
in ASCII format. A device can request for the name
response.
" Detach: Messages exchanged to close a connection.
specified time when there is no data to send. This
" Hold mode: To place ACL link in hold for a
feature is mainly to save power.
not participate in data exchange.
" Park mnode: To be in synchronization with the Master but
Power control: To request for transmitting less power. This is useful particularly for class 1
"
devices which are capable of transmitting 100 mW power.
" Quality of Service (QoS) parameters exchange: In applications
that require good quality transmission link, quality of service
In Brief. parameters can be specified. These parameters include number
Link of repetitions for broadcast packets, delay and bandwidth allo
The important functions of
cation.
Management Protocol are: link
establishment and " Request SCO link: To request for an SCO link after the ACL
disconnecion, switching link is established.
between master and slave roles,
authentication, encryption and Multi-slot packet control: To control the procedure when data is
controlling quality of service sent in consecutive packets.
parameters. Link supervision: To monitor link when device goes our of range
(through a time-out mechanism).
completed, to establish the connection.
" Connection establishment: After pag1ng is successtully
ABluetooth device will implement the base band, RF and LMP/
layers in a hardware/firmware combination. A 16-bit processor
In Brief.... based system is used to implement these three layers of protocols.
However, to reduce the cost, single chip solutions are now available
To Bluetooth-enable a device, a which will reduce che cost to make a device Bluetooth-enabled.
Bluetooth module is attached to
the device. This module These three layers ensure establishment of a connection and managing
cortains the hardware and the connection for transfer of voice or data. But to ensure that the
-firmware that implements the whole application runs as per user requirements. we need lot of
baseband, RF and link other protocols.
management protocols.
176

Logical Link Control and Adaptation Protocol (L2GAP)functionality. L2CAP layer is only
link layer
LaCAP runs above the bascband and carties Aur the data
L2CAP data packets can be up to 64 Kilobytes long. L2CAP protocol runs on hosts
nut inks.
such as laptop, cellular phone or other wireless devices. ACL link is already
When L2CAP messages are exchanged berween two devices, it assumes that an
sequence. LZCAP does
established between wo devices. It also assumes that packets are delivered in
not support SCO links for volce communtcation.
not doany checksum calculation, Note thar I 2CAP does
L2CAP does not support multicasting
The functions of L2CAP layer are:
L2CAP a number of
P'rotocol multiplexing: In the protocol stack given in Fig, 6.14, above
be passed onto the correct
to
other protocols can be running. A packet received by L2CAP has
higher layer. This is protocol multiplexing.
Segmentation and reassembly: Baseband packets are limited in size. Large L2CAP packets are
segmented into small baseband packets and sent to the baseband layer. Similarly, the small
packets received from the baseband laver are reassembled and sent to higher layers.
Quality of Service: Quality of Service (QoS) parameters such as
delay can be specified, and this layer ensures that the QoS
In Brief... constraints are honored.

The functions of Logical Link L2CAP layer sends connection request and Q0S request messages
Control and Adaptation Protocol from the application programs chrough the higher layers. It receives
(L2CAP) are protocol from the lower layers the responses for these requests. The responses
multiplexing, segmentation and can be: connection indication, connection confirmation, connect
reassembly and ensuring that confirmation negative, connect confirmation pending, disconnection
the quality of service paramelers indication (from remote), disconnect confirmation, timeout indicarion
are honored.
and quality of service violation indication.

Service Discovery Protocol (SDP)


The Service Discovery Protocol (SDP) provides the Bluetooth environment the capability to create ad
hoc nerworks. This protocol is used for discovering the services ofered by a device. SDP ofers the
following services:
.A device can search for the service needed by it in the piconert.
. A device can discover a service based on a class of services (e.g. A laptop wants a
print service,
and it can find out the dfferent printers avalable n the piconet-dot matrix printer, laser
printer etC., and subsequently select the desired print service).
Browsing of services.
. Discovery of new servICeS whel devices enter in che radio range of other devices
onism to find out when a service becomes unava1lable when the device goes
our of radio
range.
sils of services such as classes of services and the artributes of services.
Ta discover services on oet evice without consulting the third devica
Communication Interfaces
177

When a device wants to discover a service, the application software initiates the request (which is the
client) and the SDP client sends SDP request to the server (the device which can provide the required
service). SDP lient and server exchange SDP messages. Note that the server and client can be any
two devices-the server is the device that can provide the service being requested by the client.
The server maintains list of service records. Each record is identified by a unique 32-bit number.
Service record will have a number of attributes. The attributes can be service class ID list (type of
service), service ID, protocol description list (protocol used for using the service), provider name, Icon
URL (an iconic representation of the service), service name and service description. Each attribute will
have two components: attribute ID and attribute value.
For instance, consider a device (a laptop) that requires a print service. The laptop is a client looking
for a print service in a Bluetooth environment. The procedure for obtaining this service is as follows:
" Client sends a service search request specifying the print service class ID to che Server.
" provided.
Server sends a service search response to the client indicating that two print services are
" Client sends a service attribute request, protocol descriptor list to the server, asking for the
details of the service.
Server sends the response to the client indicating that PostScript
print service is provided.
In Brief... " If the client wants to use the service, it sends a command to
print the desired document.
Service Discovery Protocol (SDP)
provides the capability to
The SDP is the heart of the Bluetooth system as it provides the
discover the availability of capability to discover availability of services and the derails of the
services in aBluetooth network services along with the necessary information such as protocols to
and to access these services. access the service.

Notes..
Service Discovery Protocol (SDP) is the heart of any network that supports ad-hoc networking
of computers/devices. Sun Microsystems' Jini technology also has SDP that facilitates development
of 'administration-free' networking of devices.
RFCOMM
RFCOMM is a transport protocol to emulate serial communication (RS232 serial port) over L2CAP
Through RFCOMM,two devices can communicate using serial communication proto cols over Bluetooth
radio. To achieve this, RFCOMM emulates the 9 signals of RS 232. These signals are:
102 Signal Ground (GND)
103 Transmit Data (TD)
104 Received Dara (RD)
105 Request to Send (RTS)
106 Clear to Send (CTS)
178

107 Data Ser Ready (DSR)


108 Data Terminal Ready (DTR)
In Brief.. 109 Data Carrier Detect (DTR)

RFCOMM emulates serial 125 Ring Indicator (RI)


for Mobile
communication protocol, i.e. RFCOMM is derived from the GSM (Global Systememulation. It
using radio as the transmission Communications) specifications TS 07. 10 for serialcommunication
medium, data can be are
supports two types of devices. Type 1 devices
transmitted using the serial part
communication protocol such end-points such as computers and printers. Type 2 devices are
as RS232 standard. of communication segment such as modems.

Telephony Control Protocol Specifications (TCS)


links
lo establish voice communication between two Bluetooth devices, we need the SCO links. SCO
are not handled by L2CAP protocol. However, L2CAP handles the signaling required for establishing
voice connections through Telephony Control Protocol Specification abbreviated TCS. Note that it is
not abbreviated as TCP:TCP stands for Transmission Control Protocol
used in the Internet protocol architecture. TCS defines call control
In Brief... signaling for establishing speech and data calls between Bluetooth
devices and mobility management procedures. This protocol is based
Telephony Control Protocol on che International TelecommunicationsUnion (ITU) standard Q.931,
Specification (TCS) handles
signaling information to establish which is the standard for signaling in Integrated Services Digital
voice and data calls between Network (ISDN). TCS messages are exchanged between devices to
Bluetooth devices. This protocol establish and release connections and to provide supplementary services
is based on Q.931 standard such as calling line identification (to identify the telephone number
using in ISDN. of the calling subscriber).

Host Control Interface


If we have to Bluetooth-enable a laptop computer, we can connect a small Bluetooth module to the
USB port of the laptop and run che protocol stack on the laptop (called the host). Bluetooth device
will have two parts: a module implementing the lower layers (LMP and below) and a software moduie
implementing higher layers stack (L2CAP and above). The software module runs on che laptop (the
host). The Host Controller Interface (HCI) provides a standard interface between the Bluetooch module
and the host software, so that we can buy the hardware module from one vendor and software module
from another vendor. HCI uses three types of packets:
Commands which are sent from the host to the module,
Events which are sent fromn the module to he host, and
" Data packets which are exchanged between the host and che
module.
The functions of HCI are
Serring up and disconnection of the links and configuring the links.
Conrrol of baseband features such as timeouts.
Communication Interfaces 179

Retrieving of status information of the module.


" Invoking the test modes to test the module for local testing of Bluetooth devices.
HCI provides command interface to the baseband controller and link manager as well as access to
hardware status and control registers. HCI has to reside in the Bluetooth module connected to the
laptop as well as the host. In the Bluetooth module firmware, HCl commands are implemented so that
the host can access the baseband commands, link manager commands, hardware status registers,
control registers and event registers. The Bluetooth module is connected to the USB port (say, of the
lapiop). Three interfaces are defined to get HCl packets from bost to the Bluetooth module: (a) USB;
(b) RS232; and (c) UART.
In the host, the bus driver is implemented as software above which the HCI driver software and other
higher layer protocol softwares are implemented. The .HCI commands can be categorized as
Link control commands to establish piconets and scatternets
In Brief... " Link policy commands to put devices in hold mode or saiff
mode
Host Control Interface (HCI)
provides a standard interface " Commands to get information about the local hardware
between the Bluetoth module Commands to get the status parameters
attached to adevice and the
software running on the device. Commands to test the local Bluetooth module.
Through the HCI, the Bluetooth Each Bluetooth module is itself an embedded system built around a
device obtains the commands to
establish piconets and 16-bit processor. To make low-cost Bluetooth module, single-chip
scatternets, to obtain status
solutions are now becoming available. Bluetooth-enabling consumer
information and test the electronic items as well as embedded systems will facilitate low-cost
Bluetooth module. networking.
Summary
In chis chapter, the important communication interfaces for embedded systems are presented. RS232
interface provides a serial communication interface for data rates up to 115.2 Kbps and distances up
to about 100 metersIt is one of the most widely used interfaces. For longer distances and for noisy
environments, RS422 and RS485 interfaces are used. These serial intèrfaces are now being replaced
by Universal Serial Bus which provides very high data rates. USB 1.1 supports up to 12 Mlbps and
USB 2.0 up to 480 Mbps. Up to 127 devices can be connected in hierarchical fashion using USB.
Infrared interface provides low-cost point-to-point communication between devices. With the availability
of low-cost Ethernet chips, Ethernet interfaces can be provided to embedded systems to make themn
network-enabled. By incorporating Ethernet interface and running the TCP/IP protocol stack in the
embedded software, the embedded system can be Internet-enabled and can be accessed over a LAN
or over the public Internet. Wireless LAN interfaces based on IEEE s02. |1 family standards provide
wireless communication interface to the embedded systems. Bluetooth is another communication
interface that uses wireless technology. Using Bluetooth, two or more devices can form an ad hoc
network and share data. In fact, Ethernet, IEEE 802.1 1and Bluetooth interfaces are embedded systems
and when these embedded systems are integrated into the embedded devices, they becone powertul
communicating devices.
180

Questions
1. Explain the RS 232 interface specifications.
2. Wrat are the advantages of USB over RS 232? protocol architecture of tEEE 1394.
the
3. Where is IEEE 1394 interface used? Explain
LAN.
4. Explain the protocol architecture of Ethernet
standard.
5. Give che broad specifications of Bluetooth
interface? What are its advantages and limitations?
6. What is IrDA

Exercises
required to
embedded system, study che additional memory
network-enable an
1. If you want to
port the protocol stack. kit architecture. Study the processing power
Bluetooth development reduced.
2. Study a commercially available device. Explain how the cost of a Bluetooth
module ca1 be
requirement of a Blueooth
Study how data can be synchronized between a palmtop computer
3. What is data synchronization?
and a desktop computer. svstem
is of the size of 5 square kilometers. You need to design a wireless its
4. An exhibition ground select a particular stall number,
on the pal1mtops. If you
that provides location information select a particular item (say TV), the stalls that have TVs
location should be displayed. If you
wireless system using Bluetooth.
should be displaved. Design the digital format
system has to obtain data from 20 sensors, convert the signals into
5. An embedded sampled
muliplex the digital data and transmit the data to a PC. If each signal is
using ADCs, ADC is 16 bits, suggest a suitable communication link
resolution of each
at 10 KHz and the
the PC.
between the embedded system and
has to record the telephone conversations of 2 channels. The recorded
6. An embedded system
have to be transterred on to a PC. Calculate the memory capaciry required in the
messages be transferred
embedded system and the periodicity with which the recorded messages have to
to the PC.

You might also like