SlideShare a Scribd company logo
Dept. Of ECE Unit IV Communication Interfaces
1
Topics
 Need for Communication Interfaces.
 RS 232 / UART.
 RS 422 / RS 485.
 USB.
 Infrared.
 IEEE 1394 Firewire.
 Ethernet.
 IEEE 802.11.
 Blue tooth.
Need for Communication Interfaces
Most of the embedded systems have to interface with the external world. This requirement
may be to transmit the data to a PC or work station, or to interact with another system for
sharing the data. To meet this requirement, the embedded systems need to be provided with
communication interfaces i.e.
 The embedded system needs to send data to a host. The hosts will analyses of data
and present the data through a Graphical User Interface (GUI).
 The embedded system may need to communicate with another embedded system to
transmit / receive data. Standard communication interface is preferred.
 A number of embedded systems may need to be networked to share data. Network
interface need to be provided in such case.
 An embedded system may need to be connected to the internet so that anyone can
access the embedded systems. Ex. Real time weather monitoring system.
 Mobile devices such as cell phones and palmtops need to interact with other such
devices like PCs and laptops for data synchronization.
 Some embedded systems need software up gradation after it is installed into the field.
It can be upgraded through communication interfaces.
For the above reasons providing communication interfaces based on standard protocol is
must. Many micro controller devices have on chip communication interfaces such as serial
communication some of the communication devices are RS232 / UART, RS422/ RS485,
USB, Infrared, IEEE 1394 Firewire, Ethernet, IEEE 802.11 wireless interface, Bluetooth.
RS232/UART
RS232
Features
 RS232 is a standard developed by Electronic Industry Association (EIA).
 This is the oldest and most widely used communication interfaces.
 The PC will have two RS232 ports designated as COM1 and COM2.
 Microcontrollers have an on-chip serial interface.
 The evaluation boards of the processors are also connected to the host system using
RS232.
 RS232 is a standard for serial communication i.e., the bits are transmitted serially.
 The communication between the two devices is in full duplex mode i.e., the data
transfer can take place in both directions.
 RS232 standard specifies a distance of 19.2 meters. However, you can achieve
distances up to 100 meters using RS232 cables.
 The speed upto 115.2 kbps over distance upto 100 meters.
Dept. Of ECE Unit IV Communication Interfaces
2
 RS232 is used to connect a DTE (Data Terminal Equipment) to a DCE (Data Circuit
Terminal Equipment).
o A DTE can be a PC, Serial Printer or a Plotter.
o A DCE can be a modem, mouse, digitizer or a scanner.
 RS232 interfaces specify the physical layer interface only.
 The specifications describe the physical, mechanical, electrical, and procedural
characteristics for serial communication.
RS232 Communication Parameters
 When two devices have to communicate through RS232, the sending device sends the
data character by character.
 The same communication parameters have to be set on both the systems.
 The bits corresponding to the character are called data bits.
 The data bits are prefixed with a bit called start bit, suffixed with one or two bits
called stop bits and a parity bit used for error detection at the receiving end.
 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. The various communication parameters are
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.8432MHz and it is divided by 1600
to obtain the 115200 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 bit
 These bits are appended to the data bits to identify the end of the 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 bit
 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 bit is
set to „none‟, the parity bit is ignored.
 For example, if the data bits are 1010110, the parity bit is 0 if even parity is used and
the parity bit is 1 if odd parity is used. At the receiving end, the device will calculate
parity bit, it can be assumed that the data is without errors.
 If two bits are in error, the receiver cannot detect that there is an error.
Dept. Of ECE Unit IV Communication Interfaces
3
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 we are sure that there will be no flow control problem, there is no need for
handshaking.
 We can do hardware handshaking in RS232 using two signals: Request to Send (RTS)
and Clear to Send (CTS).
 When a device has data to send, it asserts RTS and the receiving device asserts CTS.
 We can also do software handshaking a device can send a request to suspend data
transmission by sending the character control S (0x13). The signal to resume data
transmission is sent using the character control Q (0x11). This software handshaking
is known as XON/XOFF.
RS232 Connector Configurations
 RS232 standard specifies two types of connector‟s 25-pin connector and 9-pin
connector. In the 25-pin configuration, only a few pins are used as described in the
Table 4.1 and 9-pin configuration is described in Table 4.2.
Table 4.1. 25 Pin Connector
Pin Number Function (Abbreviation)
1
2
3
4
5
6
7
8
20
22
Chassis ground
Transmit data (TXD)
Receive data (RXD)
Request to Send (RTS)
Clear to Send (CTS)
Data Set Ready (DSR)
Signal Ground (GND)
Carrier Detect (CD)
Data Terminal Ready (DTR)
Ring Indicator (RI)
Table 4.2. 9 Pin Connector
Pin Number Function (Abbreviation)
1
2
3
4
5
6
7
8
9
Carrier Detect (CD)
Receive data (RXD)
Transmit data (TXD)
Data Terminal Ready (DTR)
Signal Ground (GND)
Data Set Ready (DSR)
Request to Send (RTS)
Clear to Send (CTS)
Ring Indicator(RI)
For transmission of 1‟s and 0‟s, the voltage levels are defined in the standard. The voltage
levels are different for control signals and data signals. The voltage level is with reference to
the local ground and hence uses unbalanced transmission.
Table 4.3Voltage Levels for Data and Control Signals
Signal Voltage level
Data Input
Data Output
Control Input
Control Output
+3 volts and above for 0-3 volts and below for 1
+5 volts and above for 0-5 volts and below for 1
+3 volts and above for 1 (ON)-3 volts and below for 0 (OFF)
+5 volts and above for 1 (ON)-5 volts and below for 0 (OFF)
Dept. Of ECE Unit IV Communication Interfaces
4
Note:
 The voltage levels used in RS232 are different from voltage levels used in an
embedded systems (as most chips use 5 volts and below only).
 The processor gives out the data in parallel format, not in serial format.
These problems are overcome through the use of UART (Universal Asynchronous Receive
Transmit) chips.
UART (Universal Asynchronous Receive Transmit)
 The processors process the data in parallel format, not in serial format. To bridge the
processor and the RS 232 port, Universal Asynchronous Receive Transmit (UART)
chip is used.
 UART has two sections, receive section and transmit section.
 Receive section receives the data in serial format, converts it into parallel format and
gives it to the processor.
 The transmit section takes the data in parallel format from the processor and converts
it into serial format.
 The UART chip also adds the start bit, stop bits and parity bit.
 Many micro-controllers have on chip UART.
Fig 4.1. Hardware for RS232 Interface
 UART chip operates at 5 volts.
 The necessary voltage level conversion has to be done to meet the voltage levels of
RS232.
 The level conversion to the desired voltages is done by the level shifter, and then the
signals are passed on to the RS232 connector.
 ICs such as MAX 3222, MAX 3241 of Maxim can be used as level shifters.
 The data rates supported will be dependent on the UART chip and the clock is used.
RS422
 RS422 standard for serial communication is used in noisy environments over longer
distances because of balanced transmission.
 The distance between two devices can be up to 1200 meters.
 Twisted copper cable is used as the transmission medium.
 In RS232 the voltage levels are measured with reference to local ground, in RS422,
voltage difference between the two copper wires represents the logic levels.
 Two channels are used for transmit and receive paths.
 Chips such as MAX3488 are used for RS422.
RS485
 RS485 is a variation of RS422 to connect a number of devices in a network.
 A network using RS485 protocols operates in a master/slave configuration.
 Up to 512 devices can be networked.
 Using one twisted pair, half duplex communication can be achieved and using two
twisted pairs, full duplex communication can be achieved.
 An RS485 controller chip is used on each device.
 MAX 3483 is an RS485 controller for half duplex communication and MAX3491 is
for full duplex communication.
Dept. Of ECE Unit IV Communication Interfaces
5
USB (Universal Serial Bus)
 Universal Serial Bus has popularity in recent years.
 Desktops, laptops, printers, display devices, video cameras, hard disk drives, CDROM
drives, audio equipment etc. are now available with USB interface.
 Using USB, a number of devices can be networked using master/slave architecture.
 A host, such as the PC, is designated as shown in Fig.4.2.
Fig 4.2 USB Device Connection.
 Number of devices, up to a maximum of 127, can be connected in the form of an
inverted tree.
 On the host such as a PC, there will be a host controller, a combination of hardware
and software to control all the USB devices.
 Devices can be connected to the host controller either directly or through a hub.
 A hub is also a USB device that extends the number of ports from 2 to 8, to connect
other USB devices.
 A USB device can be self powered, or powered by the bus.
 USB can supply 500 mA current to the devices.
USB Physical Interface
 A shielded 4-wire twisted copper cable is used with the pin connections as shown in
Table 4.4.
 Data is transmitted over a differential twisted pair of wires labelled D+ and D-.
Table 4.4. Pin Configuration for USB
Pin Number Function (Abbreviation)
1
2
3
4
+5v Power (VBUS)
Differential data line (D+)
Differential data line (D-)
Power and Signal ground (GND)
Features of USB
Data rates
 USB 1.1 standard supports 12 Mbps data rate, and 1.5 Mbps for slower peripherals.
 USB 2.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
with out any need for configuration settings.
 The host will detect and identify the device by exchanging the set of packets. This is
known as „„Bus Enumeration‟‟. The devices are not pluggable, i.e. there is no need to
switch off the power to connect the device.
Dept. Of ECE Unit IV Communication Interfaces
6
Communication Protocol
 The communication between the host and the devices is the form of packets.
 Packets of the size up to 1023 bytes are exchanged for data transfer.
 Short data packets are exchanged for handshaking, acknowledgements, and for
informing the capabilities of the devices.
 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 the network and
communication starts.
 When a device is plugged in, the host automatically gets the complete information
about the device, either directly or through the hub.
 When a device is removed, the hub informs the host.
Device classes
 Each USB has a unique ID (between 1 and 127) and a device descriptor that provides
information about the device classes are display, communication, audio, mass storage
and human interface (such as keyboards, front panel knobs, control panels in VCR,
data gloves etc.)
Providing an USB interface to an embedded system is just to integrate a USB chip such as
USS-820D of Agere systems. Maxim‟s MAX 3450E, 3451E and 3452E are some of the USB
transceivers.
USB is a powerful, versatile and simple communication interface. So, many peripherals are
now provided with a USB interface.
Infrared
 Infrared interfaces are used in remote control units of TV, VCR, air-conditioner, etc.
 These interfaces are all based on proprietary protocols.
 Infrared Data Association (IrDA), a non-profit industry association founded in 1993,
released the specifications for low-cost infrared communication between devices.
 Infrared interfaces are now common place for a number of devices such as palmtops,
cell phones, digital cameras, printers, keyboards, mice, LCD projectors, ATMs, smart
cards etc.
 Infrared interface provides a low-cost, short range, point-to-point communication
between two devices.
 The only drawback with infrared is that it operates in a line of sight communication
mode and it cannot penetrate through walls. It supports only data.
The block diagram of IrDA is shown in Fig. 4.3(a) and the protocol architecture is shown in
Fig 4.3(b).
 As shown Fig. 4.3(a). The device will have an infrared transceiver.
 The transmitter 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, a different 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 device. The receiving device will detect the
signal, decode and depacketized the data.
(a) IrDA Module
Dept. Of ECE Unit IV Communication Interfaces
7
Higher Layer
(Applications, IrCOMM)
Link Management Protocol (IrLMP)
Link Access Protocol (IrLAP)
Physical Layer (IrPHY)
(b) Protocol Architecture
Fig 4.3 Infrared Interface
 As shown in Fig 4.3(b) for communication through infrared interface, the physical
layer (IrPHY) and data link layer (IrLAP) are specified in the standards. Link
management is done through IrLMP, above which the application layer protocols will
be running.
Physical layer
 IrPHY specifies the data rates and the mode of communication.
 IrDA has two specification IrDA data and IrDA control.
 IrDA data has a range of 1 meter with bi-directional communication. Serial IR (SIR)
supports data rates up to 115 Kbps and fast IR (FIR) supports data rates up to 4 Mbps.
 IrDA control has a range of 5 meters with bi-directional communication speed up to
75 Kbps.
 A host such as PC can communicate with 8 peripherals using IrDA protocols.
Data link layer
 The data link layer is called the IrLAP i.e, Link Access Protocol.
 IrLAP is based on HDLC protocol.
 Master/slave protocol is used for communication between two devices.
 The device that starts the communication is the master. The master sends the
communication and the slave sends a response.
Link management layer
 IrLMP layer facilitates a device to query the capabilities of other devices.
 It also provides the software capability to share IrLAP between multiple tasks.
Higher layers
 The higher layer protocols are application specific.
 IrCOMM protocol emulates the standard serial port.
 When two devices such as palmtop and mobile phone both fitted with infrared
interface come face to face, they can exchange the data using the application layer
protocols.
In spite of its limitations such as short range, low data rates and point-to-point
communication, infrared is a very popular communication interface for consumer items and
office automation equipment because of its low cost.
IEEE 1394 Firewire
 Apple computers Inc. Initiated the development of a mechanism to interconnect
consumer devices such as PC, printer, TV, VCR, digital camera, CD player using a
serial bus known as Firewire.
 Later it led to the development of the standard IEEE 1394. As shown in Fig. 4.4(a)
 The consumer devices can be connected 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.
Dept. Of ECE Unit IV Communication Interfaces
8
 IEEE 1394 provides plug and play capability and hot insertion capability. You can
insert or remove a device even when the bus is active. Another feature is that peer-to-
peer communication is supported and hence even if the PC is not there, any two
devices can be connected.
 Each device is given a 6-bit identification number and hence a maximum of 63
devices can be interconnected on a single bus.
 Using bridges, multiple buses can be connected. Each bus is given a 10-bit
identification number and hence 1023 buses can be interconnected.
 The standard specifies copper wire or optical fiber as the transmission medium with
data rates 100, 200, 400, 800, 1600, and 3200 Mbps.
(a) Connecting Devices Through IEEE 1394 Bus.
(b) Protocol Architecture
Fig. 4.4 IEEE 1394
The protocol architecture for the communication between devices is shown in Fig.4.4(b). The
functionality of each layer is as follows
Physical layer
 This layer specifies the electrical and mechanical connections.
 Bus initialization and arbitration are the functions of this 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.
Transaction 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 they 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.
Ethernet
 Ethernet interface is now ubiquitous.
 It is available on every desktop and laptop.
 With the availability of low-cost Ethernet chips and the associated protocol stack,
providing an Ethernet interface is very easy and useful to the embedded system.
 Through the Ethernet interface, the embedded system can be connected to the LAN.
Bus Management
Resource Management
Node Control
Transaction Layer
Data Link Layer
Physical Layer
Dept. Of ECE Unit IV Communication Interfaces
9
 So, a number of embedded systems in a manufacturing 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 the
LAN.
 Due to the availability of low-cost Ethernet chips (such as CS 8900A of cirrus Logic),
with little additional cost, an embedded system can be provided with Ethernet
connectivity.
 Even 8-bit micro-controller based embedded systems can be provided the Ethernet
interface.
The Ethernet interface provides the physical layer and data link layer functionality.
Above the data link layer, the TCP/IP protocol stack and the application layer protocols
will run. This protocol architecture is shown in Fig. 4.5.
Application Layer
(SMTP, FTP, HTTP)
TCP Layer
IP Layer
Logical Link Control
Medium Access Control
Physical Layer
Fig. 4.5. Ethernet LAN Protocol Architecture
Table 4.5. Pin Connection of Ethernet LAN Interface
Physical layer
 The Ethernet physical layer specifies a RJ 45 jack using which the device is connected
to the Local Area Network.
 The various pin connection details of RJ 45 connector are given in Table 4.5. Speeds
of 10 Mbps and 100 Mbps are supported.
 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 0 volts, and hence the signal difference is 5 volts.
Data link layer
 The data link layer is divided into Medium Access Control (MAC) layer and Logical
Link Control (LLC) layer.
 The MAC layer uses the Carrier Sense Multiple Access/collision Detection
(CSMA/CD) protocol to access the shared medium.
Pin Number Function (Abbreviation)
1
2
3
4
5
6
7
8
Transmit data (TD+)
Transmit data (TD-)
Receive Data (RD+)
No Connection (NC)
No Connection (NC)
Receive Data (RD-)
No Connection (NC)
No Connection (NC)
Dept. Of ECE Unit IV Communication Interfaces
10
 The LLC layer specifies the protocol for logical connection establishment, flow
control, error control and acknowledgements.
 Each Ethernet interface will have a unique Ethernet address of 48 bits.
To make the embedded system network-enabled, as shown in Fig. 4.5, the upper layer
protocols viz., TCP/IP stack has to be embedded along with the Operating System and
application software in the firmware.
If the embedded system has to send mails, Simple Mail Transfer Protocol (SMTP) has to
run. To support file transfer application, File Transfer Protocol (FTP) software has to be
ported. If the embedded system has to work as a web server, the HTTP server software
has to run on the system.
IEEE 802.11
 IEEE 802.11 family of standards is for wireless Local Area Network and Personal
Area Networks.
 The architecture of IEEE 802.11 standards for wireless LAN is shown in Fig.4.6.
 The standards cover the physical and MAC layers of Wireless LANs.
 The LLC layer is same as for the Ethernet LAN.
 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).
 BSS can interface to a backbone LAN through Access Point (AP).
 The backbone LAN can be a wired 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 “Hotspots”.
Fig. 4.6 IEEE 802.11 Wireless LAN
Extensions to IEEE 802.11 have been developed to support higher data rates.
 802.11b standard has been developed which supports data rates up to 22 Mbps at 2.4
GHz, with a range of 100 meters.
 802.11a operates in the 5 GHz frequency band and can support data rates up to 54
Mbps, with a range of 100 meters.
 802.11g supports 54 Mbps data rates in the 2.4GHz band.
ISM (Industrial, scientific and Medical) band is a „free‟ band and hence no government
approvals are required to operate radio systems in this band. ISM band frequency range is
2400-2483.5 MHz.
 The MAC protocol used in 802.11 is called CSMA/CA (Carrier Sense Multiple
Access with Collision Avoidance).
 The CSMA/CA operation is shown in Fig.4.7.
Dept. Of ECE Unit IV Communication Interfaces
11
Fig. 4.7. CSMA/CA Protocol
 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 the 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
periods called random back-off interval and then transmits its frame. When the
destination receives the 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 retransmitted using the above procedure. A
maximum of 7 retransmissions are allowed after which the frame is discarded. This
procedure is known as CSMA/CA.
 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.4.8.
In fig.4.8(a), the configuration uses the Access Point.
a) Communication Through Access Point b) Direct Communication
Fig 4.8 Communication Between Nodes in Wireless LAN
 Direct communication between two devices is shown. When two or more devices
form a network without the need for centralized control, they are called ad hoc
networks.
 For instance, a mobile phone can form a network with a laptop and synchronize the
data automatically.
 Embedded systems are now being provided with wireless LAN connectivity to
exchange the data.
 The main attraction of wireless connectivity is that it can be used in environments
where running a cable is difficult such as in shop floors of manufacturing units.
The physical medium specifications for 802.11 WLANs are
 Diffused Infrared with an 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 operating in 2.4 GHz ISM band. Up to 7 channels
each with a data rate of 1 Mbps or 2 Mbps can be used.
 Frequency hopping spread spectrum operating in 2.4 GHz ISM band with 1 Mbps
data rate. 2 Mbps data rate is optional.
Bluetooth
Dept. Of ECE Unit IV Communication Interfaces
12
 A typical office cabin or even a car is equipped with a number of electromagnetic
gadgets such as 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 devices form a
Personal Area Network (PAN).
 When we bring two devices, say a laptop and a mobile phone, close to each other,
these two can automatically form a network and Exchange data.
 For example, we can transfer the address book from the mobile phone to the laptop.
The networks, formed spontaneously by coming closer of two or more devices, are
termed as ad-hoc networks.
 In an ad-hoc network, the topology and the number of nodes at any time are not fixed
the topology may change with time.
 All the headaches associated with administering such networks can be avoided if
these devices are made to communicate through radio links and also if one device can
find out the presence of other devices and their capabilities (i.e. if one device can
„discover‟ other devices). The need for such PANs is everywhere in office cabins, at
homes and also in cars.
 A number of technologies have been proposed for PANs among them are Bluetooth,
IrDA and IEEE 802.11.
 Bluetooth can provide wireless connectivity to embedded systems at a very low cost.
 Bluetooth Special Interest Group (SIG) founded in February 1988 by Ericsson, Intel,
IBM, Toshiba and Nokia released version is 1.0 of Bluetooth specifications in July
1999. Bluetooth version 1.1 specifications released in February 2001.
 Most of the electronic devices can be Bluetooth enabled. These includes a PC, laptop,
PDA, digital camera, mobile phone, pager, MP3 player, headset, printer, keyboard,
mouse, LCD projector, 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.
 A set of devices can form a personal area network as shown in Fig. 4.9. , if they are in
the radio vicinity of each other (typically 10 meters radius). When a device comes in
the vicinity of another device, Bluetooth protocols facilitate their forming a network.
A device can find out what services are offered by the other device and then obtain
that service.
Fig 4.9 Wireless Personal Area Network
Dept. Of ECE Unit IV Communication Interfaces
13
 For example, a laptop can discover the printer automatically and then obtain the print
service. Such networks are called as ad-hoc networks as the network is formed in
office, at home, in cars and also in public places such as shopping malls, airports etc.
The salient features of Bluetooth technology are
 It is a low cost technology cost will be as low as a cable connection. Since most of the
Bluetooth enabled devices have to operate through a battery, the power consumption
is also very low.
 It is based on radio transmission in the ISM band is not controlled by any government
authority and hence no special approval is required to use Bluetooth radio systems.
 It caters to short ranges, the range of a Bluetooth device is typically 10 meters, though
with higher power, the range can be increased to 100 meters.
 It is based on open standards formulated by a consortium of industries and a large
number of equipment vendors are committed to this technology.
Bluetooth system specifications
The specifications of the Bluetooth system are as follows
Frequency of operation
 Bluetooth device operate in the ISM band in the frequency range 2400-2483.5MHz.
 This band consists of 79 channels each of 1MHz bandwidth, with a lower guard band
of 3.5MHz.
 When a device transmits its data, it uses frequency hopping, i.e. the device transmits
each packet in a different channel.
 The receiving device has to switch to that channel to receive that packet. Though the
radio design becomes complex when frequency hopping is used, the advantage is that
it provides secure communication.
 Nominal frequency hop rate is 1600 hops per second.
Modulation
 Gaussian Frequency Shift Keying (GFSK) is used as the modulation technique.
 Binary 1 is represented by a positive frequency deviation and 0 by negative frequency
deviation.
 The radio receiver has to be designed in such a way that the Bit Error Rate (BER) of
minimum 0.1% is ensured, i.e. the radio should provide a link which ensures that
there will not be more than 1 error for every 1000 bits transmitted.
Operating range
 Three classes of devices are defined in Bluetooth specifications:
Class 1 devices transmit maximum of 100mW. The range of such devices is 100
meters.
Class 2 devices transmit 10mW. The range is 50 meters.
Class 3 devices transmit 1mW. The range is 10 meters.
 Most of the commercially available devices have a transmitting power of 1milliwatt
and hence a range of 10 meters.
Services supported
 Both data and voice services are supported by Bluetooth devices.
 For voice communication, Synchronous Connection Oriented (SCO) links are used
which support circuit switching operation.
Dept. Of ECE Unit IV Communication Interfaces
14
 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.711 standard at 64kbps and
Continuously Variable Slope Delta Modulation (CVSD) technique also at 64 kbps.
There is no retransmission of voice packets if they are lost or received in error.
 For data services, devices exchange data in the form of packets.
 The receiving device acknowledges the packet or reports that the packet is received in
error. If a packet is received with errors, the packet is retransmitted. It is also possible
to broadcast packets by one device to all other devices in the network.
 In broadcast mode there is no an 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 data 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 the 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 a Master 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, a piconet can contain many slaves that are in parked
mode. These parked devices are synchronized with the Master, but they are not active
on the channel.
 The communication between the Master and the Slave uses Time Division Duplex
(TDD).
 Fig 4.10(a), a piconet is shown with one Master and one Slave. It is a point-to-point
communication node.
 Fig 4.10(b), the piconet consists of a Master and a number of Slaves. It is a point-to-
multipoint communication mode.
 Fig 4.10(c), shows a scatternet which is formed by a number of piconets. In this
scatternet, each piconet will have a Master and a number of Slaves. The Master of a
piconet can be a Slave in another piconet.
Dept. Of ECE Unit IV Communication Interfaces
15
 Each piconet in the scatternet will have its own frequency hopping sequence and
hence there will be no interference between two piconets.
 In a scatternet, even if the coverage areas of two piconets overlap, there will be no
interference. Fig. 4.10 shows the various topologies of a Bluetooth piconet.
Fig 4.10 Bluetooth Piconet & Scatternet
Communication between Master and Slave
 The Master and Slave communicate in the form of packets.
 Each packet is transmitted in a time slot. Each time slot is of 625 micro seconds
duration. These slots are numbered from 0 to 2^27-1.
 Master starts the transmission in even slots by sending a packet addressed to a slave
and the slave sends the packets in odd numbered slots.
 A packet generally occupies one time slot, but can extend up to five slots. If a packet
extends more than one slot, the hop frequency will be the same for the entire packet.
 If the Masters starts the transmission in slot 0 using frequency f1, the slave transmits
in slot 1 frequency f2, master transmits in slot 2 using frequency f3, and so on.
 A Bluetooth device can be in different states as shown in Fig. 4.11. To start with, an
application program in a Bluetooth device can enter the inquiry state to enquire about
other devices in the vicinity.
Fig 4.11 Bluetooth State Transition Diagram
Dept. Of ECE Unit IV Communication Interfaces
16
 To respond to an inquiry, the devices should periodically enter into inquiry scan state
and when the inquiry is successfully completed, they enter the inquiry response state.
 When a device wants to get connected to another device, it enters the page state. In
this state, the device will become the Master and page for other devices.
 The command for this paging has to come from an application program running on
this Bluetooth device.
 When the device pages for the other device, the other device may respond and the
Master enters the master response state.
 Devices should enter the page scan state periodically to check whether other devices
are paging for them.
 When device receives the page scan packet, it enters the slave response state.
 Once paging of devices is completed, the Master and the Slave establish a connection.
Thereafter, the connection is in active state during which the packet transmission
takes place.
 The connection can also be put one of the three modes „hold‟ or „sniff‟ or „park‟
modes.
 In hold mode, the device will stop receiving the data traffic for a specific amount of
time so that other devices in the piconet can use the channel. After the expiry of the
specific time, the device will start listening to traffic again.
 In sniff mode, a slave will be given an instruction like „listen starting with slot number
S every T slots for a period of N slots‟. So, the device need not listen to all the
packets, but only as the specified through the above parameters called sniff
parameters.
 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.
 A typical procedure for setting up a Bluetooth link can be:
The device sends an inquiry using a special inquiry hopping sequence.
Inquiry scanning devices respond to the inquiry by sending a packet. This packet
contains the information needed to connect to it.
The inquiring device requests a connection to the device that responded to the
inquiry.
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.
If the responding device accesses the connection, it synchronizes with the
Master‟s timing and frequency hopping sequence.
Bluetooth Addressing
 Each Bluetooth module (the radio transceiver) is given a 48-bit address containing
three fields, LAP (Lower Address Part) with 24 bits, Upper address part (UAP) with 8
bits and Non-Significant Address Part with 16 bits.
 This address is assigned by the manufacturer of the Bluetooth module consists of
company ID and company assigned number. This address is unique to every
Bluetooth device.
 In Bluetooth specifications, this address is referred to as BD_ADDR.
 Each active member in a piconet will have a 3-bit address. In addition to the
maximum of 7 active members, many more devices can be in „parked‟ mode.
 The parked members also need to have addresses so that the master can make them
active for exchange of packets. Parked member address is either the BD_ADDR of 48
bits or an 8-bit parked member address denoted by PM_ADDR.
Dept. Of ECE Unit IV Communication Interfaces
17
Bluetooth profiles
 To ensure interoperability between devices manufactured by different vendors,
Bluetooth SIG released the Bluetooth „profiles‟ which define the precise
characteristics and protocols supported by these devices.
 The Bluetooth profiles are defined for headset, cordless phone, fax machine, LAN
Access Point, serial communication, dial-up networking, file transfer, synchronisation
of data between two devices, etc.
Bluetooth Protocol Architecture
Fig 4.12 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 set up and control links.
 The three layers RF, Link controller and the Link manager will be on the
Bluetooth module attached to the 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 compared to data.
 LMP messages are sent as single packets, with a header of 1 byte. The
functions of the LMP are as follows
Authentication
When two devices have to communicate with each other, one has to verify the other
device. So, one device is called verifier and the other is called claimant.
The verifier sends a message, a packet containing a random number, which is called a
challenge.
The claimant calculates the response which is a function of challenge and sends the
response along with its Bluetooth address (48-bit address) and secret key.
This is known as Challenge-Response scheme you throw a challenge and check
whether the other device can correctly respond to that challenge.
Dept. Of ECE Unit IV Communication Interfaces
18
Encryption
To maintain confidentiality of data over the radio link, the data is encrypted. The
Master sends a key with which the data is encrypted to all the slaves, through an LMP
message.
Clock offset request
Synchronising the clocks between the master and slaves is a must for proper exchange
of data.
If the clock has to be offset, the LMP exchanges messages to ensure clock
synchronization.
Timing accuracy information request
To ensure synchronization, the master can request the slaves for timing accuracy
information.
LMP version
It needs to be ensured that both the devices use the same version of LMP.
To achieve this, version number of the LMP protocol is exchanged.
Type of packets supported
As different Bluetooth enabled devices may support different features, LMP features
request and response is exchanged between the devices.
Switching Master/Slave role
In a piconet, a device will act as a Master and other devices will act as slaves.
The master and the slave in a piconet can switch roles using the LMP messages.
The Master or the Slave can initiate the switching operation.
Name request
Each device can be given a user-friendly name having a maximum of 248 bits in
ASCII format.
A device can request for the name through an LMP message and obtain the response.
Detach
Messages exchanged to close a connection.
Hold mode
To place ACL link in hold for a specified time when there is no data to send. This
feature is mainly to save power.
Park mode
To be in synchronization with the Master but not participate in data exchange.
Power control
To request for transmitting less power.
This is useful particularly for class 1 devices which are capable of transmitting
100mW power.
Dept. Of ECE Unit IV Communication Interfaces
19
Quality of Service (QoS) parameters exchange
In applications that require good quality transmission link, quality of service
parameters can be specified.
These parameters include number of repetitions for broadcast packets, delay and
bandwidth allocation.
Request SCO link
To request for an SCO link after the ACL link is established.
Multi-slot packet control
To control the procedure when data is sent in consecutive packets.
Link supervision
To monitor link when device goes out of range (through a time-out mechanism).
Connection establishment
After paging is successfully completed, to establish the connection.
 A Bluetooth device will implement the base band, RF and LMP/layers in a
hardware/firmware combination.
 A 16-bit processor based system is used to implement these three layers of protocols.
However, to reduce the cost, single chip solutions are now available which will
reduce the cost to make a device Bluetooth enabled.
 These three layers ensure establishment of a connection and managing the connection
for transfer of voice or data. But to ensure that the whole application runs as per user
requirements, we need lot of other protocols.
Logical Link Control and Adaptation Protocol (L2CAP)
 L2CAP runs above the baseband and carries out the data link layer functionality.
 L2CAP layer is only for ACL links.
 L2CAP data packets can be up to 64 kilobytes long.
 L2CAP protocol runs on hosts such as laptop, cellular phone or other wireless
devices.
 When L2CAP messages are exchanged between two devices, it assumes that an ACL
link is already established between two devices. It also assumes that packets are
delivered in sequence.
 L2CAP does not do any checksum calculation. Note that L2CAP does not support
SCO links for voice communication. L2CAP does not support multicasting.
 The functions of L2CAP layer are
 Protocol multiplexing
In the protocol stack given in fig, above L2CAP, a number of other protocols can be
running. A packet received by L2CAP has to be passed onto the correct 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 layer are reassembled and sent to higher layers.
Dept. Of ECE Unit IV Communication Interfaces
20
 Quality of Service
Quality of service (QoS) parameters such as delay can be specified, and this layer
ensures that the QoS constraints are honoured.
 L2CAP layer sends connection request and QoS request messages from the
application programs through the higher layers. It receives from the lower layers the
responses for these requests.
 The response can be. connection indication, connection confirmation, connect
confirmation negative, connect confirmation pending, disconnection indication (from
remote), disconnect confirmation, timeout indication 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 networks.
 This protocol is used for discovering the services offered by a device.
 SDP offers the following services
A device can search for the service needed by it in the piconet.
A device can discover a service based on a class services (e.g. A laptop wants a
print service, and it can find out the different printers available in the piconet, dot
matrix printer, laser printer etc., and subsequently select the desired print service).
Browsing of services.
Discovery of new services when devices enter in the radio range of other devices.
Mechanism to find out when a service becomes unavailable when the device goes
out of radio range.
The details of services such as classes of services and the attributes of services.
To discover services on another device without consulting the third device.
 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 client and 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
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 the
server.
Server sends a service search response to the client indicating that two print
services are provided.
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.
Dept. Of ECE Unit IV Communication Interfaces
21
If the client wants to use the service, it sends a command to print the desired
document.
 The SDP is the heart of the Bluetooth system as it provides the capability to discover
availability of services and the details of the services along with the necessary
information such as protocols to access the service.
RFCOMM
 RFCOMM is a transport protocol to emulate serial communication (RS232 serial
port) over L2CAP.
 Through RFCOMM, two devices can communicate using serial communication
protocols over Bluetooth radio.
 To achieve this, RFCOMM emulates the 9 signals of RS232. These signals are
102 Signal Ground (GND)
103 Transmit Data (TD)
104 Receive Data (RD)
105 Request to Send (RTS)
106 Clear to Send (CTS)
108 Data Terminal Ready (DTR)
109 Data Carrier Detect (DCD)
125 Ring Indicator (RI)
 RFCOMM is derived from the GSM (Global System for Mobile communications)
specifications TS 07.10 for serial emulation.
 It supports two types of devices. Type 1 devices are communication end points such
as computers and printers. Type 2 devices are part of communication segment such as
modems.
Telephony Control Protocol Specifications (TCS)
 To establish voice communication between two Bluetooth devices, we need the SCO
links.
 SCO links are not handled by L2CAP protocol.
 L2CAP handles the signalling required for establishing voice connections through
Telephony Control Protocol Specification abbreviated TCS.
 TCS defines call control signalling for establishing speech and data calls between
Bluetooth devices and mobility management procedures.
 This protocol is based on the International Telecommunications Union (ITU) standard
Q.931, which is the standard for signalling in Integrated Services Digital Network
(ISDN).
 TCS messages are exchanged between the devices to establish and release
connections and to provide supplementary services such as calling line identification
(to identify the telephone number 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 the protocol stack on the laptop (called
the host).
 Bluetooth device will have two ports, a module implementing the lower layers (LMP
and below) and a software module implementing higher layers stack (L2CAP and
above).
Dept. Of ECE Unit IV Communication Interfaces
22
 The software module runs on the laptop (the host). The Host Controller Interface
(HCI) provides a standard interface between the Bluetooth 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 from the module to the host, and
Data packets which are exchanged between the host and the module.
 The functions of HCI are
Setting up and disconnection of the links and configuring the links.
Control of baseband features such as timeouts.
Retrieving of status information of the module.
Invoking the test module 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, HCI commands are implemented so that the host
can access the base band commands, link manager commands, hardware status
registers, control registers and event registers.
 The Bluetooth module is connected to the USB port (say, of the laptop). Three
interfaces are defined to get HCI packets from host to the Bluetooth module i.e, USB,
RS232 and UART.
 In the host, the bus driver is implemented as software above which the HCI driver
software and other higher layer protocol software are implemented.
 The HCI commands can be categorized as
Link control commands to establish piconets and scatternets
Link policy commands to put devices in hold mode or sniff mode
Commands to get information about the local hardware
Commands to get the status parameters
Commands to test the local Bluetooth module.
 Each Bluetooth module is itself an embedded system built around a 16-bit processor.
To make low-cost Bluetooth module, single-chip solutions are now becoming
available.
 Bluetooth enabling consumer electronic items as well as embedded systems will
facilitate low-cost networking.

More Related Content

Similar to RS 232 Notes for Embedded systems and IOT (20)

PPTX
Serial Communication
UshaRani289
 
PDF
Serial Port Device Driver
Emblogic
 
PPTX
45039336 rs232
a_subramaniyam
 
DOCX
UART project report by Tarun Khaneja ( 09034406598 )
Tarun Khaneja
 
PPTX
Computer Interfaces
Prasad Deshpande
 
PDF
Universal Asynchronous Receive and transmit IP core
Aneesh Raveendran
 
PPTX
Chapter 3 esy
Yogesh Mashalkar
 
PPT
Batch 25(a)
Elchuri Rajeswari
 
PDF
MPS W8-L2L3 Programming AVR Serial Port Ia (in C).pdf
saadbutt43215
 
PPTX
EXIDE PPT TEMPLATE.pptx
NaveenK365392
 
PPTX
Serial Data Communication
Desty Rahayu
 
PPT
8251 08 Serial
Aisu
 
PPTX
Serial buses
Umar Shuaib
 
PDF
Industrial Automation notes_unit2_part3_.pdf
DishendraJadhav1
 
PDF
Overview of the Functionalities of 4G Routers
E-Lins Technology Co. Ltd.
 
PPTX
Serial Communication in Internet of Things .pptx
21BCM504AparnaMA
 
PDF
A010240110
IOSR Journals
 
PPTX
io intweface.pptx
SureshMahar2
 
PPT
UART
Naveen Kumar
 
PDF
SEM88_Presentation
Luka Penger
 
Serial Communication
UshaRani289
 
Serial Port Device Driver
Emblogic
 
45039336 rs232
a_subramaniyam
 
UART project report by Tarun Khaneja ( 09034406598 )
Tarun Khaneja
 
Computer Interfaces
Prasad Deshpande
 
Universal Asynchronous Receive and transmit IP core
Aneesh Raveendran
 
Chapter 3 esy
Yogesh Mashalkar
 
Batch 25(a)
Elchuri Rajeswari
 
MPS W8-L2L3 Programming AVR Serial Port Ia (in C).pdf
saadbutt43215
 
EXIDE PPT TEMPLATE.pptx
NaveenK365392
 
Serial Data Communication
Desty Rahayu
 
8251 08 Serial
Aisu
 
Serial buses
Umar Shuaib
 
Industrial Automation notes_unit2_part3_.pdf
DishendraJadhav1
 
Overview of the Functionalities of 4G Routers
E-Lins Technology Co. Ltd.
 
Serial Communication in Internet of Things .pptx
21BCM504AparnaMA
 
A010240110
IOSR Journals
 
io intweface.pptx
SureshMahar2
 
SEM88_Presentation
Luka Penger
 

More from ERPraven (6)

PPTX
SINGLE IMAGE DEHAZING USING DARK CHANNEL PRIOR.pptx
ERPraven
 
PPTX
DESIGN OF PLANAR MICROSTRIP PATCH ANTENNA FOR EARLY CANCER DETECTION.pptx
ERPraven
 
PPTX
RS232 protocol for embedded systems and IOT PPT.pptx
ERPraven
 
PPTX
NS2 Demo PPT for configuring networks.pptx
ERPraven
 
PPT
Wireless Technologies in IOT AND 5G & 6G
ERPraven
 
PPT
IOT Case Studies in Engineering and Technology
ERPraven
 
SINGLE IMAGE DEHAZING USING DARK CHANNEL PRIOR.pptx
ERPraven
 
DESIGN OF PLANAR MICROSTRIP PATCH ANTENNA FOR EARLY CANCER DETECTION.pptx
ERPraven
 
RS232 protocol for embedded systems and IOT PPT.pptx
ERPraven
 
NS2 Demo PPT for configuring networks.pptx
ERPraven
 
Wireless Technologies in IOT AND 5G & 6G
ERPraven
 
IOT Case Studies in Engineering and Technology
ERPraven
 
Ad

Recently uploaded (20)

PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PPTX
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PDF
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
PPTX
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
PDF
IoT - Unit 2 (Internet of Things-Concepts) - PPT.pdf
dipakraut82
 
PPTX
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
PPT
Oxygen Co2 Transport in the Lungs(Exchange og gases)
SUNDERLINSHIBUD
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PPTX
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PPTX
site survey architecture student B.arch.
sri02032006
 
PDF
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
PPTX
UNIT DAA PPT cover all topics 2021 regulation
archu26
 
PPTX
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
Day2 B2 Best.pptx
helenjenefa1
 
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
IoT - Unit 2 (Internet of Things-Concepts) - PPT.pdf
dipakraut82
 
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
Oxygen Co2 Transport in the Lungs(Exchange og gases)
SUNDERLINSHIBUD
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
site survey architecture student B.arch.
sri02032006
 
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
UNIT DAA PPT cover all topics 2021 regulation
archu26
 
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
Ad

RS 232 Notes for Embedded systems and IOT

  • 1. Dept. Of ECE Unit IV Communication Interfaces 1 Topics  Need for Communication Interfaces.  RS 232 / UART.  RS 422 / RS 485.  USB.  Infrared.  IEEE 1394 Firewire.  Ethernet.  IEEE 802.11.  Blue tooth. Need for Communication Interfaces Most of the embedded systems have to interface with the external world. This requirement may be to transmit the data to a PC or work station, or to interact with another system for sharing the data. To meet this requirement, the embedded systems need to be provided with communication interfaces i.e.  The embedded system needs to send data to a host. The hosts will analyses of data and present the data through a Graphical User Interface (GUI).  The embedded system may need to communicate with another embedded system to transmit / receive data. Standard communication interface is preferred.  A number of embedded systems may need to be networked to share data. Network interface need to be provided in such case.  An embedded system may need to be connected to the internet so that anyone can access the embedded systems. Ex. Real time weather monitoring system.  Mobile devices such as cell phones and palmtops need to interact with other such devices like PCs and laptops for data synchronization.  Some embedded systems need software up gradation after it is installed into the field. It can be upgraded through communication interfaces. For the above reasons providing communication interfaces based on standard protocol is must. Many micro controller devices have on chip communication interfaces such as serial communication some of the communication devices are RS232 / UART, RS422/ RS485, USB, Infrared, IEEE 1394 Firewire, Ethernet, IEEE 802.11 wireless interface, Bluetooth. RS232/UART RS232 Features  RS232 is a standard developed by Electronic Industry Association (EIA).  This is the oldest and most widely used communication interfaces.  The PC will have two RS232 ports designated as COM1 and COM2.  Microcontrollers have an on-chip serial interface.  The evaluation boards of the processors are also connected to the host system using RS232.  RS232 is a standard for serial communication i.e., the bits are transmitted serially.  The communication between the two devices is in full duplex mode i.e., the data transfer can take place in both directions.  RS232 standard specifies a distance of 19.2 meters. However, you can achieve distances up to 100 meters using RS232 cables.  The speed upto 115.2 kbps over distance upto 100 meters.
  • 2. Dept. Of ECE Unit IV Communication Interfaces 2  RS232 is used to connect a DTE (Data Terminal Equipment) to a DCE (Data Circuit Terminal Equipment). o A DTE can be a PC, Serial Printer or a Plotter. o A DCE can be a modem, mouse, digitizer or a scanner.  RS232 interfaces specify the physical layer interface only.  The specifications describe the physical, mechanical, electrical, and procedural characteristics for serial communication. RS232 Communication Parameters  When two devices have to communicate through RS232, the sending device sends the data character by character.  The same communication parameters have to be set on both the systems.  The bits corresponding to the character are called data bits.  The data bits are prefixed with a bit called start bit, suffixed with one or two bits called stop bits and a parity bit used for error detection at the receiving end.  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. The various communication parameters are 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.8432MHz and it is divided by 1600 to obtain the 115200 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 bit  These bits are appended to the data bits to identify the end of the 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 bit  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 bit is set to „none‟, the parity bit is ignored.  For example, if the data bits are 1010110, the parity bit is 0 if even parity is used and the parity bit is 1 if odd parity is used. At the receiving end, the device will calculate parity bit, it can be assumed that the data is without errors.  If two bits are in error, the receiver cannot detect that there is an error.
  • 3. Dept. Of ECE Unit IV Communication Interfaces 3 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 we are sure that there will be no flow control problem, there is no need for handshaking.  We can do hardware handshaking in RS232 using two signals: Request to Send (RTS) and Clear to Send (CTS).  When a device has data to send, it asserts RTS and the receiving device asserts CTS.  We can also do software handshaking a device can send a request to suspend data transmission by sending the character control S (0x13). The signal to resume data transmission is sent using the character control Q (0x11). This software handshaking is known as XON/XOFF. RS232 Connector Configurations  RS232 standard specifies two types of connector‟s 25-pin connector and 9-pin connector. In the 25-pin configuration, only a few pins are used as described in the Table 4.1 and 9-pin configuration is described in Table 4.2. Table 4.1. 25 Pin Connector Pin Number Function (Abbreviation) 1 2 3 4 5 6 7 8 20 22 Chassis ground Transmit data (TXD) Receive data (RXD) Request to Send (RTS) Clear to Send (CTS) Data Set Ready (DSR) Signal Ground (GND) Carrier Detect (CD) Data Terminal Ready (DTR) Ring Indicator (RI) Table 4.2. 9 Pin Connector Pin Number Function (Abbreviation) 1 2 3 4 5 6 7 8 9 Carrier Detect (CD) Receive data (RXD) Transmit data (TXD) Data Terminal Ready (DTR) Signal Ground (GND) Data Set Ready (DSR) Request to Send (RTS) Clear to Send (CTS) Ring Indicator(RI) For transmission of 1‟s and 0‟s, the voltage levels are defined in the standard. The voltage levels are different for control signals and data signals. The voltage level is with reference to the local ground and hence uses unbalanced transmission. Table 4.3Voltage Levels for Data and Control Signals Signal Voltage level Data Input Data Output Control Input Control Output +3 volts and above for 0-3 volts and below for 1 +5 volts and above for 0-5 volts and below for 1 +3 volts and above for 1 (ON)-3 volts and below for 0 (OFF) +5 volts and above for 1 (ON)-5 volts and below for 0 (OFF)
  • 4. Dept. Of ECE Unit IV Communication Interfaces 4 Note:  The voltage levels used in RS232 are different from voltage levels used in an embedded systems (as most chips use 5 volts and below only).  The processor gives out the data in parallel format, not in serial format. These problems are overcome through the use of UART (Universal Asynchronous Receive Transmit) chips. UART (Universal Asynchronous Receive Transmit)  The processors process the data in parallel format, not in serial format. To bridge the processor and the RS 232 port, Universal Asynchronous Receive Transmit (UART) chip is used.  UART has two sections, receive section and transmit section.  Receive section receives the data in serial format, converts it into parallel format and gives it to the processor.  The transmit section takes the data in parallel format from the processor and converts it into serial format.  The UART chip also adds the start bit, stop bits and parity bit.  Many micro-controllers have on chip UART. Fig 4.1. Hardware for RS232 Interface  UART chip operates at 5 volts.  The necessary voltage level conversion has to be done to meet the voltage levels of RS232.  The level conversion to the desired voltages is done by the level shifter, and then the signals are passed on to the RS232 connector.  ICs such as MAX 3222, MAX 3241 of Maxim can be used as level shifters.  The data rates supported will be dependent on the UART chip and the clock is used. RS422  RS422 standard for serial communication is used in noisy environments over longer distances because of balanced transmission.  The distance between two devices can be up to 1200 meters.  Twisted copper cable is used as the transmission medium.  In RS232 the voltage levels are measured with reference to local ground, in RS422, voltage difference between the two copper wires represents the logic levels.  Two channels are used for transmit and receive paths.  Chips such as MAX3488 are used for RS422. RS485  RS485 is a variation of RS422 to connect a number of devices in a network.  A network using RS485 protocols operates in a master/slave configuration.  Up to 512 devices can be networked.  Using one twisted pair, half duplex communication can be achieved and using two twisted pairs, full duplex communication can be achieved.  An RS485 controller chip is used on each device.  MAX 3483 is an RS485 controller for half duplex communication and MAX3491 is for full duplex communication.
  • 5. Dept. Of ECE Unit IV Communication Interfaces 5 USB (Universal Serial Bus)  Universal Serial Bus has popularity in recent years.  Desktops, laptops, printers, display devices, video cameras, hard disk drives, CDROM drives, audio equipment etc. are now available with USB interface.  Using USB, a number of devices can be networked using master/slave architecture.  A host, such as the PC, is designated as shown in Fig.4.2. Fig 4.2 USB Device Connection.  Number of devices, up to a maximum of 127, can be connected in the form of an inverted tree.  On the host such as a PC, there will be a host controller, a combination of hardware and software to control all the USB devices.  Devices can be connected to the host controller either directly or through a hub.  A hub is also a USB device that extends the number of ports from 2 to 8, to connect other USB devices.  A USB device can be self powered, or powered by the bus.  USB can supply 500 mA current to the devices. USB Physical Interface  A shielded 4-wire twisted copper cable is used with the pin connections as shown in Table 4.4.  Data is transmitted over a differential twisted pair of wires labelled D+ and D-. Table 4.4. Pin Configuration for USB Pin Number Function (Abbreviation) 1 2 3 4 +5v Power (VBUS) Differential data line (D+) Differential data line (D-) Power and Signal ground (GND) Features of USB Data rates  USB 1.1 standard supports 12 Mbps data rate, and 1.5 Mbps for slower peripherals.  USB 2.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 with out any need for configuration settings.  The host will detect and identify the device by exchanging the set of packets. This is known as „„Bus Enumeration‟‟. The devices are not pluggable, i.e. there is no need to switch off the power to connect the device.
  • 6. Dept. Of ECE Unit IV Communication Interfaces 6 Communication Protocol  The communication between the host and the devices is the form of packets.  Packets of the size up to 1023 bytes are exchanged for data transfer.  Short data packets are exchanged for handshaking, acknowledgements, and for informing the capabilities of the devices.  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 the network and communication starts.  When a device is plugged in, the host automatically gets the complete information about the device, either directly or through the hub.  When a device is removed, the hub informs the host. Device classes  Each USB has a unique ID (between 1 and 127) and a device descriptor that provides information about the device classes are display, communication, audio, mass storage and human interface (such as keyboards, front panel knobs, control panels in VCR, data gloves etc.) Providing an USB interface to an embedded system is just to integrate a USB chip such as USS-820D of Agere systems. Maxim‟s MAX 3450E, 3451E and 3452E are some of the USB transceivers. USB is a powerful, versatile and simple communication interface. So, many peripherals are now provided with a USB interface. Infrared  Infrared interfaces are used in remote control units of TV, VCR, air-conditioner, etc.  These interfaces are all based on proprietary protocols.  Infrared Data Association (IrDA), a non-profit industry association founded in 1993, released the specifications for low-cost infrared communication between devices.  Infrared interfaces are now common place for a number of devices such as palmtops, cell phones, digital cameras, printers, keyboards, mice, LCD projectors, ATMs, smart cards etc.  Infrared interface provides a low-cost, short range, point-to-point communication between two devices.  The only drawback with infrared is that it operates in a line of sight communication mode and it cannot penetrate through walls. It supports only data. The block diagram of IrDA is shown in Fig. 4.3(a) and the protocol architecture is shown in Fig 4.3(b).  As shown Fig. 4.3(a). The device will have an infrared transceiver.  The transmitter 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, a different 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 device. The receiving device will detect the signal, decode and depacketized the data. (a) IrDA Module
  • 7. Dept. Of ECE Unit IV Communication Interfaces 7 Higher Layer (Applications, IrCOMM) Link Management Protocol (IrLMP) Link Access Protocol (IrLAP) Physical Layer (IrPHY) (b) Protocol Architecture Fig 4.3 Infrared Interface  As shown in Fig 4.3(b) for communication through infrared interface, the physical layer (IrPHY) and data link layer (IrLAP) are specified in the standards. Link management is done through IrLMP, above which the application layer protocols will be running. Physical layer  IrPHY specifies the data rates and the mode of communication.  IrDA has two specification IrDA data and IrDA control.  IrDA data has a range of 1 meter with bi-directional communication. Serial IR (SIR) supports data rates up to 115 Kbps and fast IR (FIR) supports data rates up to 4 Mbps.  IrDA control has a range of 5 meters with bi-directional communication speed up to 75 Kbps.  A host such as PC can communicate with 8 peripherals using IrDA protocols. Data link layer  The data link layer is called the IrLAP i.e, Link Access Protocol.  IrLAP is based on HDLC protocol.  Master/slave protocol is used for communication between two devices.  The device that starts the communication is the master. The master sends the communication and the slave sends a response. Link management layer  IrLMP layer facilitates a device to query the capabilities of other devices.  It also provides the software capability to share IrLAP between multiple tasks. Higher layers  The higher layer protocols are application specific.  IrCOMM protocol emulates the standard serial port.  When two devices such as palmtop and mobile phone both fitted with infrared interface come face to face, they can exchange the data using the application layer protocols. In spite of its limitations such as short range, low data rates and point-to-point communication, infrared is a very popular communication interface for consumer items and office automation equipment because of its low cost. IEEE 1394 Firewire  Apple computers Inc. Initiated the development of a mechanism to interconnect consumer devices such as PC, printer, TV, VCR, digital camera, CD player using a serial bus known as Firewire.  Later it led to the development of the standard IEEE 1394. As shown in Fig. 4.4(a)  The consumer devices can be connected 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.
  • 8. Dept. Of ECE Unit IV Communication Interfaces 8  IEEE 1394 provides plug and play capability and hot insertion capability. You can insert or remove a device even when the bus is active. Another feature is that peer-to- peer communication is supported and hence even if the PC is not there, any two devices can be connected.  Each device is given a 6-bit identification number and hence a maximum of 63 devices can be interconnected on a single bus.  Using bridges, multiple buses can be connected. Each bus is given a 10-bit identification number and hence 1023 buses can be interconnected.  The standard specifies copper wire or optical fiber as the transmission medium with data rates 100, 200, 400, 800, 1600, and 3200 Mbps. (a) Connecting Devices Through IEEE 1394 Bus. (b) Protocol Architecture Fig. 4.4 IEEE 1394 The protocol architecture for the communication between devices is shown in Fig.4.4(b). The functionality of each layer is as follows Physical layer  This layer specifies the electrical and mechanical connections.  Bus initialization and arbitration are the functions of this 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. Transaction 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 they 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. Ethernet  Ethernet interface is now ubiquitous.  It is available on every desktop and laptop.  With the availability of low-cost Ethernet chips and the associated protocol stack, providing an Ethernet interface is very easy and useful to the embedded system.  Through the Ethernet interface, the embedded system can be connected to the LAN. Bus Management Resource Management Node Control Transaction Layer Data Link Layer Physical Layer
  • 9. Dept. Of ECE Unit IV Communication Interfaces 9  So, a number of embedded systems in a manufacturing 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 the LAN.  Due to the availability of low-cost Ethernet chips (such as CS 8900A of cirrus Logic), with little additional cost, an embedded system can be provided with Ethernet connectivity.  Even 8-bit micro-controller based embedded systems can be provided the Ethernet interface. The Ethernet interface provides the physical layer and data link layer functionality. Above the data link layer, the TCP/IP protocol stack and the application layer protocols will run. This protocol architecture is shown in Fig. 4.5. Application Layer (SMTP, FTP, HTTP) TCP Layer IP Layer Logical Link Control Medium Access Control Physical Layer Fig. 4.5. Ethernet LAN Protocol Architecture Table 4.5. Pin Connection of Ethernet LAN Interface Physical layer  The Ethernet physical layer specifies a RJ 45 jack using which the device is connected to the Local Area Network.  The various pin connection details of RJ 45 connector are given in Table 4.5. Speeds of 10 Mbps and 100 Mbps are supported.  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 0 volts, and hence the signal difference is 5 volts. Data link layer  The data link layer is divided into Medium Access Control (MAC) layer and Logical Link Control (LLC) layer.  The MAC layer uses the Carrier Sense Multiple Access/collision Detection (CSMA/CD) protocol to access the shared medium. Pin Number Function (Abbreviation) 1 2 3 4 5 6 7 8 Transmit data (TD+) Transmit data (TD-) Receive Data (RD+) No Connection (NC) No Connection (NC) Receive Data (RD-) No Connection (NC) No Connection (NC)
  • 10. Dept. Of ECE Unit IV Communication Interfaces 10  The LLC layer specifies the protocol for logical connection establishment, flow control, error control and acknowledgements.  Each Ethernet interface will have a unique Ethernet address of 48 bits. To make the embedded system network-enabled, as shown in Fig. 4.5, the upper layer protocols viz., TCP/IP stack has to be embedded along with the Operating System and application software in the firmware. If the embedded system has to send mails, Simple Mail Transfer Protocol (SMTP) has to run. To support file transfer application, File Transfer Protocol (FTP) software has to be ported. If the embedded system has to work as a web server, the HTTP server software has to run on the system. IEEE 802.11  IEEE 802.11 family of standards is for wireless Local Area Network and Personal Area Networks.  The architecture of IEEE 802.11 standards for wireless LAN is shown in Fig.4.6.  The standards cover the physical and MAC layers of Wireless LANs.  The LLC layer is same as for the Ethernet LAN.  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).  BSS can interface to a backbone LAN through Access Point (AP).  The backbone LAN can be a wired 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 “Hotspots”. Fig. 4.6 IEEE 802.11 Wireless LAN Extensions to IEEE 802.11 have been developed to support higher data rates.  802.11b standard has been developed which supports data rates up to 22 Mbps at 2.4 GHz, with a range of 100 meters.  802.11a operates in the 5 GHz frequency band and can support data rates up to 54 Mbps, with a range of 100 meters.  802.11g supports 54 Mbps data rates in the 2.4GHz band. ISM (Industrial, scientific and Medical) band is a „free‟ band and hence no government approvals are required to operate radio systems in this band. ISM band frequency range is 2400-2483.5 MHz.  The MAC protocol used in 802.11 is called CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance).  The CSMA/CA operation is shown in Fig.4.7.
  • 11. Dept. Of ECE Unit IV Communication Interfaces 11 Fig. 4.7. CSMA/CA Protocol  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 the 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 periods called random back-off interval and then transmits its frame. When the destination receives the 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 retransmitted using the above procedure. A maximum of 7 retransmissions are allowed after which the frame is discarded. This procedure is known as CSMA/CA.  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.4.8. In fig.4.8(a), the configuration uses the Access Point. a) Communication Through Access Point b) Direct Communication Fig 4.8 Communication Between Nodes in Wireless LAN  Direct communication between two devices is shown. When two or more devices form a network without the need for centralized control, they are called ad hoc networks.  For instance, a mobile phone can form a network with a laptop and synchronize the data automatically.  Embedded systems are now being provided with wireless LAN connectivity to exchange the data.  The main attraction of wireless connectivity is that it can be used in environments where running a cable is difficult such as in shop floors of manufacturing units. The physical medium specifications for 802.11 WLANs are  Diffused Infrared with an 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 operating in 2.4 GHz ISM band. Up to 7 channels each with a data rate of 1 Mbps or 2 Mbps can be used.  Frequency hopping spread spectrum operating in 2.4 GHz ISM band with 1 Mbps data rate. 2 Mbps data rate is optional. Bluetooth
  • 12. Dept. Of ECE Unit IV Communication Interfaces 12  A typical office cabin or even a car is equipped with a number of electromagnetic gadgets such as 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 devices form a Personal Area Network (PAN).  When we bring two devices, say a laptop and a mobile phone, close to each other, these two can automatically form a network and Exchange data.  For example, we can transfer the address book from the mobile phone to the laptop. The networks, formed spontaneously by coming closer of two or more devices, are termed as ad-hoc networks.  In an ad-hoc network, the topology and the number of nodes at any time are not fixed the topology may change with time.  All the headaches associated with administering such networks can be avoided if these devices are made to communicate through radio links and also if one device can find out the presence of other devices and their capabilities (i.e. if one device can „discover‟ other devices). The need for such PANs is everywhere in office cabins, at homes and also in cars.  A number of technologies have been proposed for PANs among them are Bluetooth, IrDA and IEEE 802.11.  Bluetooth can provide wireless connectivity to embedded systems at a very low cost.  Bluetooth Special Interest Group (SIG) founded in February 1988 by Ericsson, Intel, IBM, Toshiba and Nokia released version is 1.0 of Bluetooth specifications in July 1999. Bluetooth version 1.1 specifications released in February 2001.  Most of the electronic devices can be Bluetooth enabled. These includes a PC, laptop, PDA, digital camera, mobile phone, pager, MP3 player, headset, printer, keyboard, mouse, LCD projector, 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.  A set of devices can form a personal area network as shown in Fig. 4.9. , if they are in the radio vicinity of each other (typically 10 meters radius). When a device comes in the vicinity of another device, Bluetooth protocols facilitate their forming a network. A device can find out what services are offered by the other device and then obtain that service. Fig 4.9 Wireless Personal Area Network
  • 13. Dept. Of ECE Unit IV Communication Interfaces 13  For example, a laptop can discover the printer automatically and then obtain the print service. Such networks are called as ad-hoc networks as the network is formed in office, at home, in cars and also in public places such as shopping malls, airports etc. The salient features of Bluetooth technology are  It is a low cost technology cost will be as low as a cable connection. Since most of the Bluetooth enabled devices have to operate through a battery, the power consumption is also very low.  It is based on radio transmission in the ISM band is not controlled by any government authority and hence no special approval is required to use Bluetooth radio systems.  It caters to short ranges, the range of a Bluetooth device is typically 10 meters, though with higher power, the range can be increased to 100 meters.  It is based on open standards formulated by a consortium of industries and a large number of equipment vendors are committed to this technology. Bluetooth system specifications The specifications of the Bluetooth system are as follows Frequency of operation  Bluetooth device operate in the ISM band in the frequency range 2400-2483.5MHz.  This band consists of 79 channels each of 1MHz bandwidth, with a lower guard band of 3.5MHz.  When a device transmits its data, it uses frequency hopping, i.e. the device transmits each packet in a different channel.  The receiving device has to switch to that channel to receive that packet. Though the radio design becomes complex when frequency hopping is used, the advantage is that it provides secure communication.  Nominal frequency hop rate is 1600 hops per second. Modulation  Gaussian Frequency Shift Keying (GFSK) is used as the modulation technique.  Binary 1 is represented by a positive frequency deviation and 0 by negative frequency deviation.  The radio receiver has to be designed in such a way that the Bit Error Rate (BER) of minimum 0.1% is ensured, i.e. the radio should provide a link which ensures that there will not be more than 1 error for every 1000 bits transmitted. Operating range  Three classes of devices are defined in Bluetooth specifications: Class 1 devices transmit maximum of 100mW. The range of such devices is 100 meters. Class 2 devices transmit 10mW. The range is 50 meters. Class 3 devices transmit 1mW. The range is 10 meters.  Most of the commercially available devices have a transmitting power of 1milliwatt and hence a range of 10 meters. Services supported  Both data and voice services are supported by Bluetooth devices.  For voice communication, Synchronous Connection Oriented (SCO) links are used which support circuit switching operation.
  • 14. Dept. Of ECE Unit IV Communication Interfaces 14  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.711 standard at 64kbps and Continuously Variable Slope Delta Modulation (CVSD) technique also at 64 kbps. There is no retransmission of voice packets if they are lost or received in error.  For data services, devices exchange data in the form of packets.  The receiving device acknowledges the packet or reports that the packet is received in error. If a packet is received with errors, the packet is retransmitted. It is also possible to broadcast packets by one device to all other devices in the network.  In broadcast mode there is no an 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 data 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 the 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 a Master 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, a piconet can contain many slaves that are in parked mode. These parked devices are synchronized with the Master, but they are not active on the channel.  The communication between the Master and the Slave uses Time Division Duplex (TDD).  Fig 4.10(a), a piconet is shown with one Master and one Slave. It is a point-to-point communication node.  Fig 4.10(b), the piconet consists of a Master and a number of Slaves. It is a point-to- multipoint communication mode.  Fig 4.10(c), shows a scatternet which is formed by a number of piconets. In this scatternet, each piconet will have a Master and a number of Slaves. The Master of a piconet can be a Slave in another piconet.
  • 15. Dept. Of ECE Unit IV Communication Interfaces 15  Each piconet in the scatternet will have its own frequency hopping sequence and hence there will be no interference between two piconets.  In a scatternet, even if the coverage areas of two piconets overlap, there will be no interference. Fig. 4.10 shows the various topologies of a Bluetooth piconet. Fig 4.10 Bluetooth Piconet & Scatternet Communication between Master and Slave  The Master and Slave communicate in the form of packets.  Each packet is transmitted in a time slot. Each time slot is of 625 micro seconds duration. These slots are numbered from 0 to 2^27-1.  Master starts the transmission in even slots by sending a packet addressed to a slave and the slave sends the packets in odd numbered slots.  A packet generally occupies one time slot, but can extend up to five slots. If a packet extends more than one slot, the hop frequency will be the same for the entire packet.  If the Masters starts the transmission in slot 0 using frequency f1, the slave transmits in slot 1 frequency f2, master transmits in slot 2 using frequency f3, and so on.  A Bluetooth device can be in different states as shown in Fig. 4.11. To start with, an application program in a Bluetooth device can enter the inquiry state to enquire about other devices in the vicinity. Fig 4.11 Bluetooth State Transition Diagram
  • 16. Dept. Of ECE Unit IV Communication Interfaces 16  To respond to an inquiry, the devices should periodically enter into inquiry scan state and when the inquiry is successfully completed, they enter the inquiry response state.  When a device wants to get connected to another device, it enters the page state. In this state, the device will become the Master and page for other devices.  The command for this paging has to come from an application program running on this Bluetooth device.  When the device pages for the other device, the other device may respond and the Master enters the master response state.  Devices should enter the page scan state periodically to check whether other devices are paging for them.  When device receives the page scan packet, it enters the slave response state.  Once paging of devices is completed, the Master and the Slave establish a connection. Thereafter, the connection is in active state during which the packet transmission takes place.  The connection can also be put one of the three modes „hold‟ or „sniff‟ or „park‟ modes.  In hold mode, the device will stop receiving the data traffic for a specific amount of time so that other devices in the piconet can use the channel. After the expiry of the specific time, the device will start listening to traffic again.  In sniff mode, a slave will be given an instruction like „listen starting with slot number S every T slots for a period of N slots‟. So, the device need not listen to all the packets, but only as the specified through the above parameters called sniff parameters.  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.  A typical procedure for setting up a Bluetooth link can be: The device sends an inquiry using a special inquiry hopping sequence. Inquiry scanning devices respond to the inquiry by sending a packet. This packet contains the information needed to connect to it. The inquiring device requests a connection to the device that responded to the inquiry. 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. If the responding device accesses the connection, it synchronizes with the Master‟s timing and frequency hopping sequence. Bluetooth Addressing  Each Bluetooth module (the radio transceiver) is given a 48-bit address containing three fields, LAP (Lower Address Part) with 24 bits, Upper address part (UAP) with 8 bits and Non-Significant Address Part with 16 bits.  This address is assigned by the manufacturer of the Bluetooth module consists of company ID and company assigned number. This address is unique to every Bluetooth device.  In Bluetooth specifications, this address is referred to as BD_ADDR.  Each active member in a piconet will have a 3-bit address. In addition to the maximum of 7 active members, many more devices can be in „parked‟ mode.  The parked members also need to have addresses so that the master can make them active for exchange of packets. Parked member address is either the BD_ADDR of 48 bits or an 8-bit parked member address denoted by PM_ADDR.
  • 17. Dept. Of ECE Unit IV Communication Interfaces 17 Bluetooth profiles  To ensure interoperability between devices manufactured by different vendors, Bluetooth SIG released the Bluetooth „profiles‟ which define the precise characteristics and protocols supported by these devices.  The Bluetooth profiles are defined for headset, cordless phone, fax machine, LAN Access Point, serial communication, dial-up networking, file transfer, synchronisation of data between two devices, etc. Bluetooth Protocol Architecture Fig 4.12 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 set up and control links.  The three layers RF, Link controller and the Link manager will be on the Bluetooth module attached to the 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 compared to data.  LMP messages are sent as single packets, with a header of 1 byte. The functions of the LMP are as follows Authentication When two devices have to communicate with each other, one has to verify the other device. So, one device is called verifier and the other is called claimant. The verifier sends a message, a packet containing a random number, which is called a challenge. The claimant calculates the response which is a function of challenge and sends the response along with its Bluetooth address (48-bit address) and secret key. This is known as Challenge-Response scheme you throw a challenge and check whether the other device can correctly respond to that challenge.
  • 18. Dept. Of ECE Unit IV Communication Interfaces 18 Encryption To maintain confidentiality of data over the radio link, the data is encrypted. The Master sends a key with which the data is encrypted to all the slaves, through an LMP message. Clock offset request Synchronising the clocks between the master and slaves is a must for proper exchange of data. If the clock has to be offset, the LMP exchanges messages to ensure clock synchronization. Timing accuracy information request To ensure synchronization, the master can request the slaves for timing accuracy information. LMP version It needs to be ensured that both the devices use the same version of LMP. To achieve this, version number of the LMP protocol is exchanged. Type of packets supported As different Bluetooth enabled devices may support different features, LMP features request and response is exchanged between the devices. Switching Master/Slave role In a piconet, a device will act as a Master and other devices will act as slaves. The master and the slave in a piconet can switch roles using the LMP messages. The Master or the Slave can initiate the switching operation. Name request Each device can be given a user-friendly name having a maximum of 248 bits in ASCII format. A device can request for the name through an LMP message and obtain the response. Detach Messages exchanged to close a connection. Hold mode To place ACL link in hold for a specified time when there is no data to send. This feature is mainly to save power. Park mode To be in synchronization with the Master but not participate in data exchange. Power control To request for transmitting less power. This is useful particularly for class 1 devices which are capable of transmitting 100mW power.
  • 19. Dept. Of ECE Unit IV Communication Interfaces 19 Quality of Service (QoS) parameters exchange In applications that require good quality transmission link, quality of service parameters can be specified. These parameters include number of repetitions for broadcast packets, delay and bandwidth allocation. Request SCO link To request for an SCO link after the ACL link is established. Multi-slot packet control To control the procedure when data is sent in consecutive packets. Link supervision To monitor link when device goes out of range (through a time-out mechanism). Connection establishment After paging is successfully completed, to establish the connection.  A Bluetooth device will implement the base band, RF and LMP/layers in a hardware/firmware combination.  A 16-bit processor based system is used to implement these three layers of protocols. However, to reduce the cost, single chip solutions are now available which will reduce the cost to make a device Bluetooth enabled.  These three layers ensure establishment of a connection and managing the connection for transfer of voice or data. But to ensure that the whole application runs as per user requirements, we need lot of other protocols. Logical Link Control and Adaptation Protocol (L2CAP)  L2CAP runs above the baseband and carries out the data link layer functionality.  L2CAP layer is only for ACL links.  L2CAP data packets can be up to 64 kilobytes long.  L2CAP protocol runs on hosts such as laptop, cellular phone or other wireless devices.  When L2CAP messages are exchanged between two devices, it assumes that an ACL link is already established between two devices. It also assumes that packets are delivered in sequence.  L2CAP does not do any checksum calculation. Note that L2CAP does not support SCO links for voice communication. L2CAP does not support multicasting.  The functions of L2CAP layer are  Protocol multiplexing In the protocol stack given in fig, above L2CAP, a number of other protocols can be running. A packet received by L2CAP has to be passed onto the correct 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 layer are reassembled and sent to higher layers.
  • 20. Dept. Of ECE Unit IV Communication Interfaces 20  Quality of Service Quality of service (QoS) parameters such as delay can be specified, and this layer ensures that the QoS constraints are honoured.  L2CAP layer sends connection request and QoS request messages from the application programs through the higher layers. It receives from the lower layers the responses for these requests.  The response can be. connection indication, connection confirmation, connect confirmation negative, connect confirmation pending, disconnection indication (from remote), disconnect confirmation, timeout indication 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 networks.  This protocol is used for discovering the services offered by a device.  SDP offers the following services A device can search for the service needed by it in the piconet. A device can discover a service based on a class services (e.g. A laptop wants a print service, and it can find out the different printers available in the piconet, dot matrix printer, laser printer etc., and subsequently select the desired print service). Browsing of services. Discovery of new services when devices enter in the radio range of other devices. Mechanism to find out when a service becomes unavailable when the device goes out of radio range. The details of services such as classes of services and the attributes of services. To discover services on another device without consulting the third device.  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 client and 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 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 the server. Server sends a service search response to the client indicating that two print services are provided. 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.
  • 21. Dept. Of ECE Unit IV Communication Interfaces 21 If the client wants to use the service, it sends a command to print the desired document.  The SDP is the heart of the Bluetooth system as it provides the capability to discover availability of services and the details of the services along with the necessary information such as protocols to access the service. RFCOMM  RFCOMM is a transport protocol to emulate serial communication (RS232 serial port) over L2CAP.  Through RFCOMM, two devices can communicate using serial communication protocols over Bluetooth radio.  To achieve this, RFCOMM emulates the 9 signals of RS232. These signals are 102 Signal Ground (GND) 103 Transmit Data (TD) 104 Receive Data (RD) 105 Request to Send (RTS) 106 Clear to Send (CTS) 108 Data Terminal Ready (DTR) 109 Data Carrier Detect (DCD) 125 Ring Indicator (RI)  RFCOMM is derived from the GSM (Global System for Mobile communications) specifications TS 07.10 for serial emulation.  It supports two types of devices. Type 1 devices are communication end points such as computers and printers. Type 2 devices are part of communication segment such as modems. Telephony Control Protocol Specifications (TCS)  To establish voice communication between two Bluetooth devices, we need the SCO links.  SCO links are not handled by L2CAP protocol.  L2CAP handles the signalling required for establishing voice connections through Telephony Control Protocol Specification abbreviated TCS.  TCS defines call control signalling for establishing speech and data calls between Bluetooth devices and mobility management procedures.  This protocol is based on the International Telecommunications Union (ITU) standard Q.931, which is the standard for signalling in Integrated Services Digital Network (ISDN).  TCS messages are exchanged between the devices to establish and release connections and to provide supplementary services such as calling line identification (to identify the telephone number 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 the protocol stack on the laptop (called the host).  Bluetooth device will have two ports, a module implementing the lower layers (LMP and below) and a software module implementing higher layers stack (L2CAP and above).
  • 22. Dept. Of ECE Unit IV Communication Interfaces 22  The software module runs on the laptop (the host). The Host Controller Interface (HCI) provides a standard interface between the Bluetooth 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 from the module to the host, and Data packets which are exchanged between the host and the module.  The functions of HCI are Setting up and disconnection of the links and configuring the links. Control of baseband features such as timeouts. Retrieving of status information of the module. Invoking the test module 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, HCI commands are implemented so that the host can access the base band commands, link manager commands, hardware status registers, control registers and event registers.  The Bluetooth module is connected to the USB port (say, of the laptop). Three interfaces are defined to get HCI packets from host to the Bluetooth module i.e, USB, RS232 and UART.  In the host, the bus driver is implemented as software above which the HCI driver software and other higher layer protocol software are implemented.  The HCI commands can be categorized as Link control commands to establish piconets and scatternets Link policy commands to put devices in hold mode or sniff mode Commands to get information about the local hardware Commands to get the status parameters Commands to test the local Bluetooth module.  Each Bluetooth module is itself an embedded system built around a 16-bit processor. To make low-cost Bluetooth module, single-chip solutions are now becoming available.  Bluetooth enabling consumer electronic items as well as embedded systems will facilitate low-cost networking.