0% found this document useful (0 votes)
73 views91 pages

Unit Iii - Networks

Uploaded by

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

Unit Iii - Networks

Uploaded by

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

EMBEDDED SYSTEM DESIGN/ EEE18R423

Presented By
Mr.S.Kalimuthu Kumar
Asst. Prof./EEE

Kalasalingam Academy of Research & Education


UNIT II (Understand the network protocols-CO 3)

2
Networking for Embedded Systems
 Why we use networks.
 Network abstractions.
 Example networks.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Network elements

distributed computing platform:

PE
PE

communication link
network

PE
PEs may be CPUs or ASICs.
Overheads for Computers as Components 2nd
© 2008 Wayne Wolf ed.
Networks in embedded systems

initial processing
more processing
PE sensor
PE

PE actuator

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Why distributed?
 Higher performance at lower cost.
 Physically distributed activities---time constants may not allow
transmission to central site.
 Improved debugging---use one CPU in network to debug others.
 May buy subsystems that have embedded processors.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Network abstractions
 International Standards Organization (ISO) developed the Open
Systems Interconnection (OSI) model to describe networks:
 7-layer model.
 Provides a standard way to classify network components and
operations.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
OSI model

application end-use interface


presentation data format
session application dialog control
transport connections
network end-to-end service
data link reliable data transport
physical mechanical, electrical

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
OSI layers
 Physical: connectors, bit formats, etc.
 Data link: error detection and control across a single link (single hop).
 Network: end-to-end multi-hop data communication.
 Transport: provides connections; may optimize network resources.
 Session: services for end-user applications: data grouping, check pointing,
etc.
 Presentation: data formats, transformation services.
 Application: interface between network and end-user programs.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Hardware architectures

 Many different types of networks:


 topology;
 scheduling of communication;
 routing.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Point-to-point networks

 One source, one or more destinations, no data switching


(serial port):
 Full duplex or half duplex

PE 1 PE 2 PE 3
link 1 link 2

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Bus networks
 Common physical connection:
 PE’s have unique address
 Transmitting PE divides data into packets

PE 1 PE 2 PE 3 PE 4

header address data ECC packet format

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Bus arbitration

 Fixed: Same order of resolution every time.


 Fair: every PE has same access over long periods.
 round-robin: rotate top priority among PE’s

fixed A B C A B C
round-robin
A B C B C A
A,B,C A,B,C
Overheads for Computers as Components 2nd
© 2008 Wayne Wolf ed.
Crossbar

out4

out3

out2

out1
in1 in2 in3 in4
Overheads for Computers as Components 2nd
© 2008 Wayne Wolf ed.
Crossbar characteristics

 Reduce communication conflicts of bus based


connection
 Allows all possible input and output connection
 Cross point is a switch that connects an input to an output
 Non-blocking.
 Can handle arbitrary multi-cast combinations.
 Size proportional to n2.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
TOPOLOGIES

 Ring
 Bus
 Star
 Tree

16
Multi-stage networks
 Use several stages of switching elements.
 Often blocking.
 Often smaller than crossbar.
 Critical communications

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Message-based programming
 Embedded systems communicate by passing
message
 Transport layer provides message-based
programming interface:
send_msg(adrs,data1);
 Data must be broken into packets at source,
reassembled at destination.
 Data-push programming: make things happen in
network based on data transfers.
Overheads for Computers as Components 2nd
© 2008 Wayne Wolf ed.
Data push network:

Sensors transmit data


automatically at regular interval
rather than waiting for the
controller to request it

19
I2C bus
 Designed for low-cost, medium data rate
applications.
 Characteristics:
 serial;
 multiple-master;
 fixed-priority arbitration.
 Several microcontrollers come with
built-in I2C controllers.
 It is used in micro controlled based
systems
Overheads for Computers as Components 2nd
© 2008 Wayne Wolf ed.
I2C bus
 Inter integrated circuit bus is effective networks used to
interconnect peripheral devices with in small scale embedded
system
 IIC,I2C
 Two wire communication
 Bi directional communication
 Speed upto 100 Kbps in standard mode, 400 Kbps in fast mode
 SDA(serial data)
 SCL(serial data)
 Multimaster operation

21
CSMA/CD
 Carrier Sensor Multiple Access/Collision Detect (CSMA/CD)
 when several stations try to access the bus simultaneously when
it is at rest, a contention message is detected. The transmission is
then halted and all the stations withdraw from the network. After
a certain period, different for each station, each station again
tries to access the network.
CSMA/CD
 data transfer cancellations decrease the carrying capacity
of the network.
 The network may even be totally blocked at peak traffic
times
 unacceptable for 'real-time' applications.
CSMA/CA
 Carrier Sensor Multiple Access/Collision Avoidance (CSMA/CA).
 This device operates with a contention procedure not at the time
of the attempt to access the bus, but at the level of the bit itself
(bitwise contention - conflict management within the duration of
the bit).
 by assigning a level of priority, the message having the highest
priority will always gain access to the bus
I2C physical layer

master 1 master 2
data line
SDL
clock line
SCL

slave 1 slave 2

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
I2C data format

SCL ... ...

SDL ...

start MSB ack

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
I2C electrical interface
 Open collector interface: +

SDL
+

SCL

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
I2C signaling
 Sender pulls down bus for 0.
 Sender listens to bus---if it tried to send a 1 and heard a 0,
someone else is simultaneously transmitting.
 Transmissions occur in 8-bit bytes.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
I2C data link layer
 Every device has an address (7 bits in standard, 10
bits in extension).
 Bit 8 of address signals read or write.
 General call address allows broadcast.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
I2C bus arbitration
 Sender listens while sending address.
 When sender hears a conflict, if its address is higher, it stops
signaling.
 Low-priority senders resign control early enough in clock cycle to
allow bit to be transmitted reliably.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
I2C transmissions

multi-byte write

S adrs 0 data data P

read from slave

S adrs 1 data P

write, then read


S adrs 0 data S adrs 1 data P

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Introduction to CANBUS

32
1. CANBUS Introduction
 What is CANBUS?
 Who uses CANBUS?
 CANBUS history
 CANBUS timeline
2. CANBUS Characteristics
 OSI Model
 Physical Layer
 Transmission Characteristics
3. Message Oriented Communication
4. Message Format
5. Bus Arbitration
33
What is CANBUS?

CANBUS or CAN bus – Controller Area Network bus

An automotive serial bus system developed to satisfy


the following requirements:

 Network multiple microcontrollers with 1 pair of wires.


 Allow microcontrollers communicate with each other.
 High speed, real-time communication.
 Provide noise immunity in an electrically noisy environment.
 Low cost

34
Who uses CANBUS?
 Designed specifically for automotive applications
 Today - industrial automation / medical equipment

35
CANBUS History

 First idea - The idea of CAN was first conceived by engineers at Robert Bosch
Gmbh in Germany in the early 1980s.
 Early focus - develop a communication system between a number of ECUs
(electronic control units).
 New standard - none of the communication protocols at that time met the
specific requirements for speed and reliability so the engineers developed
their own standard.

36
CANBUS Timeline

 1983 : First CANBUS project at Bosch


 1986 : CAN protocol introduced
 1987 : First CAN controller chips sold
 1991 : CAN 2.0A specification published
 1992 : Mercedes-Benz used CAN network
 1993 : ISO 11898 standard
 1995 : ISO 11898 amendment
 Present : The majority of vehicles use CAN bus.

37
CANBUS and the OSI Model
 CAN is a closed network
 – no need for security, sessions or logins.
 - no user interface requirements.
 Physical and Data Link layers in silicon.

38
CANBUS Physical Layer
 Physical medium – two wires terminated at both ends by resistors.
 Differential signal - better noise immunity.
 Benefits:
 Reduced weight, Reduced cost

 Fewer wires = Increased reliability


CAN bus network
Conventional multi-wire looms

vs.

http://canbuskit.com/what.php

39
Transmission Characteristics

 Up to 1 Mbit/sec.
 Common baud rates: 1 MHz, 500 KHz and 125 KHz
 All nodes – same baud rate
 Max length:120’ to 15000’ (rate dependent)

© esd electronics, Inc. • 525 Bernardston Road • Greenfield, MA 01301 40


Message Oriented Transmission Protocol
 Each node – receiver & transmitter
 A sender of information transmits to all devices on the bus
 All nodes read message, then decide if it is relevant to them
 All nodes verify reception was error-free
 All nodes acknowledge reception

CAN bus © 2005 Microchip Technology Incorporated. All Rights Reserved.

41
Message Format
 Each message has an ID, Data and overhead.
 Data –8 bytes max
 Overhead – start, end, CRC, ACK

42
Example of Message Transaction

43
Bus Arbitration
 Arbitration – needed when multiple nodes try to transmit at the same time
 Only one transmitter is allowed to transmit at a time.
 A node waits for bus to become idle
 Nodes with more important messages continue transmitting

© 2005 Microchip Technology Incorporated. All Rights Reserved.


CAN bus

44
Bus Arbitration
 Message importance is encoded in message ID.
Lower value = More important
 As a node transmits each bit, it verifies that it sees the same bit value on the bus
that it transmitted.
 A “0” on the bus wins over a “1” on the bus.
 Losing node stops transmitting, winner continues.

45
Bus arbitration
A “0” (low voltage) on the bus by 1 node wins over a “1” (high
voltage) on the bus.

46
Bus Arbitration Flowchart

47
Multiprocessor networks

 Multiple DSPs are often connected by high-speed


networks for signal processing:

DSP DSP

DSP DSP

© 2000 Morgan Kaufman Overheads for Computers as Components


SHARC link ports

 Six per CPU.


 Four bits per link port.
 Packets have 32- or 48-bit payload.
 Can be controlled by DMA.
 Are half-duplex---must be turned around by program.

© 2000 Morgan Kaufman Overheads for Computers as Components


Ethernet
 Dominant non-telephone LAN.
 Versions: 10 Mb/s, 100 Mb/s, 1 Gb/s
 Goal: reliable communication over an unreliable medium.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Ethernet topology

 Bus-based system, several possible physical layers:

A B C

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Ethernet’s MAC Algorithm
 Ethernet uses CSMA/CD – listens to line before/during sending
 If line is idle (no carrier sensed)
 send packet immediately
 upper bound message size of 1500 bytes
 must wait 9.6us between back-to-back frames
 If line is busy (carrier sensed)
 wait until idle and transmit packet immediately
 called 1-persistent sending
 If collision detected
 Stop sending and jam signal
 Try again later

CS 640 52
State Diagram for CSMA/CD

Packet?
No

Sense Send Detect


Carrier Collision

Yes
Discard
Packet Jam channel
attempts < 16 b=CalcBackoff();
wait(b);
attempts++;
attempts == 16

CS 640 53
CSMA/CD

© 2000 Morgan Kaufman Overheads for Computers as Components


Collisions
Collisions are caused when two adaptors transmit at the same
time (adaptors sense collision based on voltage differences)
• Both found line to be idle
• Both had been waiting to for a busy line to become idle

A starts at A B
time 0
Message almost
A B
there at time T when
B starts – collision!

How can we be sure A knows about the collision?

CS 640 55
Collision Detection
 How can A know that a collision has taken place?
 There must be a mechanism to insure retransmission on collision
 A’s message reaches B at time T
 B’s message reaches A at time 2T
 So, A must still be transmitting at 2T

 Send jamming signal after collision is detected to insure all hosts see collision
 48 bit signal

CS 640 56
Collision Detection contd.
A B
time = 0

A B
time = T

A B
time = 2T

CS 640 57
Ethernet packet format

start source dest data


preamble length padding CRC
frame adrs adrs payload

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Ethernet performance

 Quality-of-service tends to non-linearly decrease at high


load levels.
 Can’t guarantee real-time deadlines. However, may
provide very good service at proper load levels.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Myrinet

 High performance network


 Full duplex with 640 MB/S at BW 1.28 GB/S
 Parallel processing systems
 It constructed in a variety of topologies
 Frame format based on system configuration

© 2000 Morgan Kaufman Overheads for Computers as Components


Internet Protocol

 Internet Protocol (IP) is basis for Internet.


 Provides an internetworking standard: between two
Ethernets, Ethernet and token ring, etc.
 Higher-level services are built on top of IP.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
IP in communication
application application
presentation presentation
session session
transport IP transport
network network network
data link data link data link
physical physical physical

node A router
node B
Overheads for Computers as Components 2nd
© 2008 Wayne Wolf ed.
IP packet

 Includes:
 version, service type, length
 time to live, protocol
 source and destination address
 data payload
 Maximum data payload is 65,535 bytes.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
IP addresses

 32 bits in early IP, 128 bits in IPv6.


 Typically written in form xxx.xx.xx.xx.
 Names (foo.baz.com) translated to IP address by domain
name server (DNS).

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Internet routing

 Best effort routing:


 doesn’t guarantee data delivery at IP layer.
 Routing can vary:
 session to session;
 packet to packet.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Higher-level Internet services

 Transmission Control Protocol (TCP) provides connection-


oriented service.
 Quality-of-service (QoS) guaranteed services are under
development.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
The Internet service stack(IP&
higher level)

FTP HTTP SMTP telnet SNMP

User
TCP UDP Datagram
Protocol
IP

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Communication analysis

 First, understand delay for single message.


 Delay for multiple messages depends on:
 network protocol;
 devices on network.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Message delay

 Assume:
 single message;
 no contention.
 Delay:
 tm = tx + t n + t r
 = xmtr overhead + network xmit time + rcvr overhead

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Example: I2C message delay
 Network transmission time dominates.
 Assume 100 kbits/sec, one 8-bit byte.
 Number of bits in packet:
 npacket = start + address + data + stop
 = 1 + 8 + 8 + 1 = 18 bits
 Time required to transmit: 1.8 x 10-4 sec.
 20 instructions on 8 MHz controller adds 2.5 x 10-6 delay on xmtr,
rcvr.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Multiple messages

 If messages can interfere with each other, analysis is


more complex.
 Model total message delay:
 t y = t d + tm
 = wait time for network + message delay

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Arbitration and delay

 Fixed-priority arbitration introduces unbounded delay for


all but highest-priority device.
 Unless higher-priority devices are known to have limited rates
that allow lower devices to transmit.
 Round-robin arbitration introduces bounded delay
proportional to N.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Further complications

 Acknowledgment time.
 Transmission errors.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
System performance analysis

 System analysis is difficult in general.


 multiprocessor performance analysis is hard;
 communication performance analysis is hard.
 Simple example: uncertainty in P1 finish time ->
uncertainty in P2 start time.

P1 P2

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Analysis challenges
 P2 and P3 can delay each
other, even though they are in P1
separate tasks.
 Delays in P1 propagate to P2, P2
then P3, then to P4. P3

P4

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Networks

 Example: elevator controller.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Terminology

 Elevator car: holds passengers.


 Hoistway: elevator shaft.
 Car control panel: buttons in each car.
 Floor control panel: elevator request, etc. per floor.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Elevator system

floor

floor

floor

floor

floor

Hoistway 1 Hoistway 2
Overheads for Computers as Components 2nd
© 2008 Wayne Wolf ed.
Theory of operation

 Each floor has control panel, display.


 Each car has control panel:
 one button per floor;
 emergency stop.
 Controlled by a single controller.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Elevator position sensing

sensor

fine

coarse

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Elevator control

 Elevator control has up and down.


 To stop, disable both.
 Master controller:
 reads elevator positions;
 reads requests;
 schedules elevators;
 controls movement;
 controls doors.
Overheads for Computers as Components 2nd
© 2008 Wayne Wolf ed.
Elevator system requirements
name elevator system
inputs F floor control, N position, N car
control, 1 master
outputs F displays, N motor controllers
functions responds to requests, operates
safely
performance elevator control is time-critical
manufacturing cost electronics is small part of total

power Not important


physical size/weight cabling is important

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Elevator system class diagram
1
Coarse-sensor*
Master-control-panel*
1 1
1 N 1
Fine-sensor* Car 1
1 1
1
1 Controller
Car-control-panel* 1
1
1 Floor F N
Floor-control-panel* 1 Motor*

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Physical interfaces
Sensor* Car-control-panel*
hit: boolean Floors[1..F]: boolean
emergency-stop:
boolean
open-door, close-door:
Coarse-sensor* Fine-sensor* boolean

Master-control-panel...
Motor* Floor-control-panel*
speed: off,slow,fast} up, down: boolean
Overheads for Computers as Components 2nd
© 2008 Wayne Wolf ed.
Car and Floor classes

Car Floor
request-lights[1..F]:
up-light, down-light:
boolean
boolean
current-floor: integer

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Controller class

Controller
car-floor[1..H]: integer
emergency-stop[1..H]:
integer
scan-cars()
scan-floors()
scan-master-panel()
operate()

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Architecture

 Computation and I/O occur at:


 floor control panels/displays;
 elevator cars;
 system controller.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Network in the
Elevator system

© 2000 Morgan Kaufman Overheads for Computers as Components


Panels and cab controller

 Panels are straightforward---no real-time requirements.


 Cab controller:
 read buttons and send events to system controller;
 read sensor inputs and send to system controller.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
System controller

 Must take inputs from many sources:


 car controllers;
 floors.
 Must control cars to hard real-time deadlines.
 User interface, scheduling are soft deadlines.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.
Testing

 Build an elevator simulator using an FPGA:


 simulate multiple elevators;
 simulate real-time control demands.

Overheads for Computers as Components 2nd


© 2008 Wayne Wolf ed.

You might also like