You are on page 1of 16

Lecture material taken from:

D i and Device dB Buses f for D Device i N Networks t k


Suree Pumrin, Ph.D. Semester Se este 2/2553 / 553 Designing Embedded Hardware, 2nd ed., Catsoulis, J., O Reilly, 2005. Embedded Systems: Architecture, Programming and Design, 2nd ed., Kamal, R., Tata McGraw Hill, 2008.

2102444 Introduction to Embedded Systems

2102444 Introduction to Embedded Systems

Objectives
Explain characteristics of I/O Devices Describe Communication Protocol Concepts p Select appropriate Serial Communication Buses such as Inter- Integrated Circuit (I2C), Controller Area Network (CAN), and Universal Serial Bus (USB) for some applications Select appropriate Parallel Communication Buses for some applications

Topics
I/O Devices Communication Protocol Concepts p Serial Communication Buses
Inter- Integrated Circuit (I2C) Controller Area Network (CAN) Universal Serial Bus (USB)

Parallel P ll l C Communication i ti B Buses


IBM Standard Architecture (ISA) and Extended ISA (EISA) Peripheral Component Interconnect (PCI), PCI Extended ( (PCI/X), ), Compact p PCI ( (cPCI) )
3 2102444 Introduction to Embedded Systems 4

2102444 Introduction to Embedded Systems

I/O Device
Definition: Any peripheral or component or utility that interfaces externally y or internally y to a computer p system y ports or buses, which then enables certain specific action or part of application by interaction with the computer basic hardware. Examples: LCD display, mice, modem, timer, keypad are the devices. Timer is an internal device and keyboard is an I/O device in a computer system system.

I/O Device (2)


Device Program: Most external and internal devices needs a p program g that enables certain specific p action or part of application. The program is called device driver. g a Device I/O Port: External devices interface through port to the computer buses. Port has a set of addresses though which device connects and then a device program does d th the I/O operations. ti I/O operations (I/O devices operate through the ports) are the important main operations in most embedded systems. For examples, router, switch, mobile phone
2102444 Introduction to Embedded Systems 6

2102444 Introduction to Embedded Systems

Examples E l of f Synchronous S h Serial I/O


Synchronous Serial Input Audio Input, Video I Input, t Dial Di l T Tone, N Network t kI Input, t Transceiver T i Input, Scanner, Remote Input and Serial I/O b I bus Input t Synchronous Serial Output Audio Output, Video Output, Dialing Number, Network Output, Remote Control Output, Transceiver Output, Multiprocessor Communication and Serial I/O bus Output
2102444 Introduction to Embedded Systems 7

Synchronous Serial Output Bits

2102444 Introduction to Embedded Systems

Examples of UART Serial I/O


UART Serial Input p Keypad, yp , Keyboard, y , Modem, Mouse, Character Inputs on a (For example, p , COM Port of a Serial line ( PC) UART Serial Output Printer, Printer Modem Modem, Character Outputs on a Serial line (For example COM Port of a PC) example,
2102444 Introduction to Embedded Systems 9

Examples of Parallel I/O


Parallel Port Input Bit Bit- Bit indicating completing one revolution of motor P ll l P Parallel Port t Output O t t BitBit Robot R b t motor t direction reversal bit

2102444 Introduction to Embedded Systems

10

Examples of Parallel I/O (2)


Parallel Port Input p Bits from an encoder for the current linear position of a shaft Parallel Port Output Robot stepper motor coil driving output bits

Three ways of communication between the devices


Synchronous y Iso-synchronous Asynchronous

2102444 Introduction to Embedded Systems

11

2102444 Introduction to Embedded Systems

12

Synchronous Communication
Clock information is transmitted explicitly or implicitly in synchronous communication. The receiver clock continuously maintains constant p phase difference with the transmitter clock. Bits of a data frame maintain uniform phase difference and are sent within a fixed maximum time interval. interval

Iso-Synchronous Communication
Clock of receiver maintains constant phase p difference with the transmitter clock in Isosynchronous y communication. Bits of a data frame can be sent within a variable maximum time interval.

2102444 Introduction to Embedded Systems

13

2102444 Introduction to Embedded Systems

14

Asynchronous Communication
Clocks of receiver and transmitter are independent. Bits of a data frame have variable phase differences and may y not be sent within any y prefixed time interval. Example: UART Serial communication, Telephone line communication. Each successive byte can have variable time-gap. time gap.

Two Modes of communication between the devices and computer system


Full Duplex Both devices or device and computer system simultaneously communicate each other. Half Duplex Only one device can communicate with another one at a time.

2102444 Introduction to Embedded Systems

15

2102444 Introduction to Embedded Systems

16

Internal Serial Communication Devices


Microcontroller internal device
1) 8051 and d 8096 - Synchronous S h S Serial i lH Half lf Duplex, separate clock line; Alternate use UART d duplex l P Ports t 2) 68HC11 - Synchronous Serial Full Duplex with separate clock and master-slave control lines; Separate UART duplex Ports

P ll l P Parallel Port tD Devices i

2102444 Introduction to Embedded Systems

17

17

2102444 Introduction to Embedded Systems

18

AP Parallel ll l I Input-Output t O t t port t with ith g signals g handshaking

Sophisticated S hi ti t d I Interfacing t f i of f the th y I/O Device in a System


I/O device Integrated with PCS (Physical C di S Coding Sub bl layer)) Analog A l audio di and d video id signals pulse code modulated at the sub layer. A l i Analog inputs t can b be di directly tl given i t to i interface. t f I/O device Integrated with PMA (Physical Media Attachment) pictures, Analog audio, video signals can be directly given interfaced for input and output.
2102444 Introduction to Embedded Systems 20

2102444 Introduction to Embedded Systems

19

Sophisticated S hi ti t d I Interfacing t f i of f the th I/O Device in a System y (2) ( )


I/O device Integrated with DAA (Direct Access Arrangement) For example in TMS320C54x DSP Serial IO master and 7 slave CODEC CODEC (Digital coding of analog input and decoding into analog output) means digital coding cod g includes c udes noise o se e exclusion, c us o , then e d digital g a conversion and compression and synchronization of two channels audio-video.

Ti i and Timing dC Counting ti D Devices i


A computer system needs at least one timing device (to function as system clock). System clock is one that on each tick interrupts the system and initiates a process. Both hardware timers and software timers are used in the systems. Examples: Real Time Clock, Pulse Accumulator Counter, Watchdog Timer, Serial Communication rate-control timer, OS timer for task scheduling
2102444 Introduction to Embedded Systems 22

2102444 Introduction to Embedded Systems

21

Communication Protocol
A protocol is a standard adopted, which tells the way y in which the bits of a frame must be sent from a device or system to another device or system [Even in personal [ p communication we follow a protocol we say Hello! then talk and then say good bye!]

Protocol Bits
Sent, synchronously or Iso-synchronously or asynchronously and at what interval(s)? Preceded by the header bits? How does the receiving device address communicate so that only destined device activate and receives the bits? [Needed when several devices addressed though a common line or bus]
2102444 Introduction to Embedded Systems 24

2102444 Introduction to Embedded Systems

23

Protocol Bits (2)


How does the transmitting device address defined so that receiving device know the source when receiving data from several sources? How the frame-length defined so that receiving d i k device know the h f frame-size i i in advance? d ?

Protocol Bits (3)


Frame-content specifications p ( (Are these control or device configuring or command bits or the data bits?) ) Frame has trailing bits so that receiving device can check the errors, if any in reception and detect end of the frame ?

2102444 Introduction to Embedded Systems

25

2102444 Introduction to Embedded Systems

26

Protocol Defines:
Frame bits minimum and maximum length permitted per frame Line supply and impedances and lineConnectors specifications

Protocol Features
The I/O p port bits to be sent in an embedded system first formatted according to a specified protocol, p , which is to be followed when in communication with a device through an I/O port or bus or channel.

2102444 Introduction to Embedded Systems

27

2102444 Introduction to Embedded Systems

28

Network Protocols
TCP/IP HTTP and HTTPS , ESMTP and POP3 SMTP, TELNET and FTP DNS IMAP4 DNS, IMAP4, Bootp, Bootp

Wireless Network Protocols


Bluetooth for short distance network IrDA for infrared data association IEEE 802.11 802 11 Wireless LAN

2102444 Introduction to Embedded Systems

29

2102444 Introduction to Embedded Systems

30

Serial Communication Buses


Inter- Integrated Circuit (I2C) Controller Area Network (CAN) Universal Serial Bus (USB)

I t Integrated InterI t t d Circuit Ci it (I2C)


I2C bus is a very cheap yet effective network used to interconnect peripheral devices within small-scale embedded systems. Three standards:
100 kbps Industrial I2C, 100 kbps Standard Mode I2C, C 2 400 kbps Fast Mode I C.

2102444 Introduction to Embedded Systems

31

2102444 Introduction to Embedded Systems

32

I2C Uses
The two wires:
SDA (serial data) for bi bi-directional directional data SCL (serial clock) for the clock

I2C Network

I 2C D Data t T Transfer f rate t


Synchronous Serial Communication 400 kbps up to 2 m and d 100 kbps kb f for l longer di distances. t

2102444 Introduction to Embedded Systems

33

2102444 Introduction to Embedded Systems

34

I2C

Network (2)

An I2C Packet

Device connected to the I2C bus has a unique q address and can operate as
a transmitter ( (a bus master), ) a receiver (a bus slave), or both

2102444 Introduction to Embedded Systems

35

2102444 Introduction to Embedded Systems

36

Controller Area Network (CAN)


The complexity of automotive electronics grew considerably y with:
engine-management systems, ABS braking, active suspension, electronic transmissions, automated lighting, air-conditioning, security, it central locking.
2102444 Introduction to Embedded Systems 37

Conventional C ti lS System t Interconnection


Point-to-point p wiring, g, which p provided discrete interconnection between each subsystem. added g greatly y to the cost of p producing g a car, ,
added unnecessary weight, reduced reliability, reliability made servicing a nightmare.

2102444 Introduction to Embedded Systems

38

Network Solutions
Replace complexity with simplicity Implement intersystem communication using a low-cost o cost digital d g ta network. et o Be able to cope with the noisy automotive electric environment Work reliably

F t Features and d St Standards d d


High-noise immunity Error detection and handling, with retransmission et a s ss o o of failed a ed pac packets. ets Three standards:
33 kbps CAN, CAN 110 kbps Fault Tolerant CAN, 1 Mbps High Speed CAN

2102444 Introduction to Embedded Systems

39

2102444 Introduction to Embedded Systems

40

A li ti Applications
B Bosch hd developed l d CAN i in E Europe i in th the l late t 1980s, 1980 originally for use in cars CAN has expanded beyond its automotive origins to
industrial automation, trains, ship navigation and control systems, medical systems, photocopiers, agricultural machinery, household appliances, office ffi automation, t ti elevators.

CAN Di Distributed t ib t d S System t

2102444 Introduction to Embedded Systems

41

2102444 Introduction to Embedded Systems

42

CAN protocol defines the frame bits


There is a CAN controller between the CAN bus-line and host nodes. CAN controller has BIU (Bus Interface Unit) consisting of the b ff and buffer d driver di Method for arbitration is CSMA/AMP (Carrier Sense Multiple Access with Arbitration on M Message Priority P i it b basis) i )

CAN Bus

2102444 Introduction to Embedded Systems

43

2102444 Introduction to Embedded Systems

44

Distributed Node
Twisted Pair Connection up p to 40 m for bidirectional data line, which pulls to Logic 1 through g a resistor between the line and + 4.5V to +12V Line Idle state is Logic 1

Distributed Node (2)


Uses a buffer gate between an input pin and the CAN line Detects Input Presence at the CAN line pulled down to dominant (active) state logic 0 (ground ~ 0V) by a sender to the CAN line Data D t frame f starts t t with ith logic l i 1 and d ends d with ith seven logic 0s after first detecting that dominant state t t is i not t present t at t the th CAN line. li

2102444 Introduction to Embedded Systems

45

2102444 Introduction to Embedded Systems

46

Universal Serial Bus (USB)


Three standards:
Low speed p USB1.1 at 1.5 Mbps p for slower p peripherals p High speed USB 1.1 at 12 Mbps High speed USB 2.0 at 480 Mbps

USB I Important t t Features F t


A USB device can be attached, configured and used reset used, reset, reconfigured and used used, share the bandwidth with other devices, detached (while others are in operation) and reattached and has plug and play device feature.

Examples:
Flash drive Printer Scanner Mobile playing station attachment to computer through a cradle
2102444 Introduction to Embedded Systems 47

2102444 Introduction to Embedded Systems

48

A USB System S stem

Robustness Features
Signal g integrity g y using g differential drivers, , receivers, and shielding Signal integrity verification of data fields by the CRC bits added for the error control

Hot attachment, which means computer system need not restart when the device is plugged-in plugged-in.
2102444 Introduction to Embedded Systems 49 2102444 Introduction to Embedded Systems 50

Robustness Features (2)


Data and control pipe constructs ensures an independence p from adverse interactions between functions in the device. Self-recovery recovery occurs using timeouts when there Self are lost or corrupted packets. Flow control for streaming iso iso-synchronous synchronous and hardware- buffer management.

USB Device Connection


USB devices are at the:
Hubs, which g gives the additional attachment p points to the USB device Functional nodes, which gives the applications for examples digital camera USB port, scanner USB port, ISDN connection

Two cables for supply +5V and ground and twisted pair or EMI shielded (>15 Mbps) for the USB frame bits transmission).
51 2102444 Introduction to Embedded Systems 52

2102444 Introduction to Embedded Systems

USB Uses
Bus Interconnection lines between the host device or system and number of interconnected devices (or systems) through a USB port driver (a software) and host controller (at root hub) in tree like topology.

USB Hierarchy
Host (Level 0) Level 1 Level 2 Level 3 Level 4
NODE
Root Hub

Host

HUB 1

NODE

HUB 2

NODE

NODE

HUB 4 HUB 3
NODE

NODE

NODE

2102444 Introduction to Embedded Systems

53

2102444 Introduction to Embedded Systems

54

USB Expansion using Hubs

Parallel Communication Buses


IBM Standard Architecture (ISA) and Extended ISA (EISA) Peripheral Component Interconnect (PCI), PCI Extended (PCI/X), ( C / ) Compact C PCI C ( (cPCI) C)

2102444 Introduction to Embedded Systems

55

2102444 Introduction to Embedded Systems

56

IBM Standard Architecture


IBM Standard Architecture (ISA) and Extended ISA (EISA) Two standards for the devices and systems interfacing i f i the h PC PC:
20-bit Address and 16-bit ISA Bus 32-bit Address and 32-bit EISA Bus

IBM Standard Architecture (2)


ISA and EISA buses - Compatible with IBM PC architecture, , Used for connecting devices following IO addresses and interrupt vectors as per IBM PC architecture. EISA is 32-bit 32 bit extension of ISA ISA. It also supports software interrupt functions and d Eth Ethernet t devices. d i

2102444 Introduction to Embedded Systems

57

2102444 Introduction to Embedded Systems

58

Peripheral Component Interconnect


Peripheral Component Interconnect (PCI), PCI Extended (PCI/X), Compact PCI (cPCI)
Independent from the IBM architecture. Three standards for the devices interfacing with the PC:

Peripheral Component Interconnect (2)


Parallel buses enables a host computer or system to communicate with other devices or systems, for example, to a network interface card (NIC). Number of embedded systems use PCI or PCI/X or cPCI bus when p placed in a computer p system.

2102444 Introduction to Embedded Systems

59

2102444 Introduction to Embedded Systems

60

Peripheral Component Interconnect (3)



Peripheral Component Interconnect (4)


If there are reasons for doing it so, a PCI driver can change g the default boot up p assignments g on configuration transactions. A device can initialize at booting g time, , avoid any address collision, device on boot up disables its interrupt p and closes its door to its address space except to the configuration registers g space, p ,

A PCI controller must access one device at a time. All the devices within the host device or system
can share the I/O port and memory addresses, cannot share the configuration registers, device cannot t modify dif other th configuration fi ti registers i t b but t can access other device resources or share the work or assist the other device device.

2102444 Introduction to Embedded Systems

61

2102444 Introduction to Embedded Systems

62

Peripheral Component Interconnect (5)


PCI BIOS with the device performs the configuration transactions and then, memory and address spaces automatically map to the address space in the device hosting system.

Exercise
1. Whats the difference in a synchronous and asynchronous communication? 2. Compare the advantages and disadvantages of data transfers using serial and parallel ports devices. 3. What are common and difference features in I2C, CAN, and USB? Give some example p devices in each bus system.

2102444 Introduction to Embedded Systems

63

2102444 Introduction to Embedded Systems

64

You might also like