You are on page 1of 18

Embedded Systems

INTERFACING
Dr. Bikram Keshari Mishra
Associate Professor
Department of Computer Sc. and Engg.
Silicon Institute of Technology, Bhubaneswar

INTERFACING

• Interfacing plays an impt. role in :


– connecting processors to peripheral devices.
– communicating betwn processors.

• Common ways of interfacing are:


– Synchronous interfaces : SPI, I2C etc.
– RS232C, RS422 based serial interface, USB
– n/w interfaces : RS485, CAN, Ethernet etc.

12/13/2022 Dr. Bikram K. Mishra 2


Serial Peripheral Interface(SPI)

• SPI developed by

• SPI is an interface bus that enables serial exchange of data (one bit
at a time) betwn two devices-
– one called a master
– other called a slave

• Data can be transferred in both directions at the same time.

12/13/2022 Dr. Bikram K. Mishra 3

Four Signal Data Transfer in SPI

SPI uses four signals for data transfer.


MOSI : Master Out / Slave In – generated by master, slave is receiver.
Data
lines
MISO : Master In / Slave Out – Slaves generates and master receives

SCLK or SCK : Serial Clock – is generated by master to synchronize


Control data transfer betwn master and slave.
lines
CS : Chip Select – generated by master to select slaves

12/13/2022 4
Dr. Bikram K. Mishra
SPI bus – single master & single slave

SPI bus can operate with:

Single Master and Single Slave :

processor peripheral devices

12/13/2022 Dr. Bikram K. Mishra 5

SPI bus – multiple slave devices

Single Master and Multiple Slave devices :

12/13/2022 6
Dr. Bikram K. Mishra
Data Transmission in SPI

• Communication always initiated by master.

• Master first configures the clock (SCLK).

• Master sends its content on MOSI line. Slave reads it.

• Slave sends its content on MISO line. Master reads it.

12/13/2022 Dr. Bikram K. Mishra 7

Inter-Integrated Circuits
(IIC/I2C)
I2C Features
• I2C bus is very cheap.
• Reduces board space and cost by:
– Allowing use of ICs with fewer pins.
– Allowing components to be located close to their point of use.

• Uses TWO wires to connect multiple devices.


– SDA : Serial Data
– SCL : Serial Clock

• I2C bus is :
– bi-directional
– synchronous to a common clock
Dr. Bikram K. Mishra 8
12/13/2022
I2C Bus Configuration
• Master node :
– Initiates a transfer by generating START and STOP conditions
– Generates the clock
– Transmits the slave address
– Determines data transfer direction
• Slave node :
– receives clock
– responds when addressed by master.
– Slaves cannot initiate communication.

12/13/2022 9
Dr. Bikram K. Mishra

Master WRITING to a Slave

Master READING from a Slave

1
12/13/2022 Dr. Bikram K. Mishra 10
RS – 232 C

• Is serial comm n interface developed in 1962.

• Was originally intended for connecting Data Terminal Equipments (DTE)


(like computers) with Data Commn Equipments (DCE) (like modems).

• Now it is used as an interface betwn :


o DTE – DTE (PC to PC)
o DCE – DTE (workstation with DCE interface to PC)
o DCE – DCE (workstation to modem)

11
12/13/2022 Dr. Bikram K. Mishra

RS-232C – Transmitter / Receiver Handshaking

• RS-232C – Transmitter / Receiver Handshaking done either by:


Hardware Handshaking :
• Handshaking done by using actual hardware lines.
• When transmitter wishes to send, it issues Request To Send (RTS) signal
• Receiver issues Clear To Send (CTS) when ready indicating transmitter
to send data.

Software Handshaking :
Uses Ctrl-S and Ctrl-Q to represent request to suspend and clear to
resume respectively

Limitations of RS 232 C It can interface serial devices :


• over a cable length up to 25 meters.
• data speed up to 38.4 Kbps
12/13/2022 Dr. Bikram K. Mishra 12
RS – 422

12/13/2022 13
Dr. Bikram K. Mishra

USB

• Designed jointly by in 1996.

• It is a serial bus protocol initially designed for connection, between


computers and its peripheral like keyboard, mouse, printer, camera etc.

• Now, is an integral part of any electronic gadgets like smart phones,


PDAs, video game consoles and many more.

12/13/2022 Dr. Bikram K. Mishra 14


USB "tiered star" Topology

15
12/13/2022 Dr. Bikram K. Mishra

Tier-star Topology

• The architecture of USB is a tier-star topology, consisting of :


– a USB host
– no. of USB ports
– multiple peripheral devices
– USB hubs (optional)

• A USB host may have multiple host controllers and each host controller may
provide one or more USB ports.
• Up to 127 devices including hubs, may be connected to a single host
controller.
• Root hub — It is a hub that is built into the host controller.

16
12/13/2022 Dr. Bikram K. Mishra
Four Tires USB Tree Structure

12/13/2022 Dr. Bikram K. Mishra 17

Seven Tires of Hubs

12/13/2022 Dr. Bikram K. Mishra 18


USB Architecture

• Pipe: A pipe is a logical connection from host controller to endpoints


in the device
• End points : An endpoint is defined and numbered by the device during
initialization and so is permanent.

Message pipe vs. Stream pipe

• A message pipe is bi-directional and used for control transfers.

• A stream pipe is a uni-directional pipe connected to a uni-directional


endpoint that transfers data using either :
a) isochronous
b) interrupt
c) bulk transfer
12/13/2022 Dr. Bikram K. Mishra 19

Data Transfer in Stream pipes

They can be of three types of data transfer :

a) Interrupt - device like mouse or keyboard, which will


be sending very little data

b) Bulk - device like printer, which receives data in


one big packet, uses bulk transfer mode.

c) Isochronous- A streaming device, such as speakers uses


this mode.

12/13/2022 Dr. Bikram K. Mishra 20


Infra RED (IrDA)

12/13/2022 Dr. Bikram K. Mishra 21

IrDA transmitter beams out its transmission at an angle of 150 to 300

The receiver has a viewing angle of 150.

The range of line of sight is at least 1 meter.

12/13/2022 Dr. Bikram K. Mishra 22


Protocol Layers of IrDA

12/13/2022 Dr. Bikram K. Mishra 23

Required IrDA Protocols

a) Physical Layer: Specifies optical characteristics, encoding of


data, and framing for various speeds.

b) IrLAP (Link Access Protocol) : Establishes the connection.

c) IrLMP (Link Management Protocol) : Multiplexes services.

d) IAS (Info. Access Service) : Provides a list of services

12/13/2022 Dr. Bikram K. Mishra 24


Optional IrDA Protocols

a) TinyTP (Tiny Transport Protocol) : Provides per-channel


flow control to keep things moving smoothly.

b) IrOBEX (Object Exchange protocol) : Provides easy


transfer of files and other data objects.

c) IrCOMM : Provides serial and parallel port emulation,


enabling existing applications that use serial and parallel
communications to use IR without change.

d) IrLAN (Local Area Network) : Allows LAN access via IR


interface.

12/13/2022 Dr. Bikram K. Mishra 25

Problems with Infrared

26
12/13/2022 Dr. Bikram K. Mishra
CAN

How CAN works?

• Msg. transmitted from any node on a CAN bus do not contain addrs
of transmitting or receiving nodes.

• All other nodes receive the msg and performs an acceptance test on the
identifier to determine if the msg is relevant to that particular node.

• The unique identifier also determines the priority of the messages.

12/13/2022 Dr. Bikram K. Mishra 27

4 Types of Frames in CAN

Messages in CAN are sent in a format called frames.


A frame is defined structure, carrying meaningful sequence of
bit / bytes of data within the network.

1) Data Frame :
– Used when a node transmits infm to any other node in the system
– Data Frames consists of :
• Arbitration Fields
• Control Fields
• Data Fields
• CRC Fields (Cyclic Redundancy Check)
• a 2-bit Acknowledge Field
• an End of Frame.

12/13/2022 Dr. Bikram K. Mishra 28


2) Remote Frame:
– Purpose : to seek permission for transmission of data from
another node.
– Eg: the microprocessor for central locking on car may need to
know the state of gear selection from power train
controller.

3) Error Frame:
– If transmitting or receiving node detects an error, it will
immediately abort transmission and send error frame.

4) Overload Frame:
– Used to provide delay between messages.
– It is transmitted when the nodes become too busy.

12/13/2022 Dr. Bikram K. Mishra 29

CAN Benefits

• Low cost: As CAN serial bus uses two wires. Also, driven by low cost protocol
devices, they are relatively cheap.

• Reliable: Because of excellent error detection and error handling mechanisms.

• Flexibility: CAN nodes can be easily connected / disconnected.

• Good Speed: CAN supports data rate of 1 MBit/s @ 40m bus length.

• Multi-master communication: Any node can access the bus.

• Fault Confinement: Faulty nodes do not disturb the communication.

• Broadcast capability: Messages can be sent to one /many/all nodes.

• Standardized: ISO has standardized CAN via ISO-DIS 11898 high speed
applications) and ISO-DIS 11519-2 (low speed applications).

12/13/2022 Dr. Bikram K. Mishra 30


Bluetooth
Key Features

– Less complication
– Less power consumption
– Cheaper rates
– Robustness

12/13/2022 Dr. Bikram K. Mishra 31

Bluetooth Architecture

Piconets

12/13/2022 Dr. Bikram K. Mishra 32


Piconets
• Bluetooth architecture defines two types of networks:
1. Piconet
2. Scatter-net
When bluetooth devices come within a range, an electronics conversation
takes place betwn them to determine whether they want to share data, the
devices form a Personal Area Network (PAN) called a piconet.

• Piconet consist of 1 primary node (master) & 7 secondary nodes (slaves)


• Commn betwn master and slaves can be one-to-one or one-to-many.
• Salve-slave commn is not possible.

• Besides 7 slave stations, a piconet can have up to 255 parked nodes.


– parked nodes are slave stations and cannot take part in commn until
it is moved from parked state to active state.
12/13/2022 Dr. Bikram K. Mishra 33

Scatter-net

• Scatter-net is formed by
combining various piconets.

• A slave in one piconet can act as a master in another piconet.


– such a node can receive msgs from master in the first piconet
and deliver the msg to its slaves in other piconet where it is
acting as master. This node is also called bridge slave.

• Thus, a station can be a member of two piconets.


– But, a station cannot be a master in two piconets.

34
12/13/2022 Dr. Bikram K. Mishra
Advantages over Infrared

– Range of infrared is very short (no more than 5 meters)

– Infra red uses pulse of infrared light to transmit data


whereas, bluetooth uses radio wave.

– Transmission range of infrared is betwn 115 Kbps to 16


Mbps whereas, bluetooth transmit data betwn 1 Mbps to
3 Mbps.

– Infrared requires a direct line of sight betwn


communicating devices whereas, bluetooth devices can
be placed anywhere within its range.

12/13/2022 Dr. Bikram K. Mishra 35

ISA Bus
• It operates at 8.33MHz.
• Its data transfer data rate is 8MB/s.
• It has 24 address lines and 16 data lines.
• It is used to connect printer, scanner, modem, sound card, CD-
ROM etc.

• Since PCI bus does not accept 8-bit and 16-bit ISA cards, ISA
bus is also provided along with PCI bus to interface 8-bit and
16-bit ISA cards.

12/13/2022 Dr. Bikram K. Mishra 36

You might also like