Unit Iii - Networks
Unit Iii - Networks
Presented By
Mr.S.Kalimuthu Kumar
Asst. Prof./EEE
2
Networking for Embedded Systems
Why we use networks.
Network abstractions.
Example networks.
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
PE 1 PE 2 PE 3
link 1 link 2
PE 1 PE 2 PE 3 PE 4
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
Ring
Bus
Star
Tree
16
Multi-stage networks
Use several stages of switching elements.
Often blocking.
Often smaller than crossbar.
Critical communications
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
SDL ...
SDL
+
SCL
multi-byte write
S adrs 1 data P
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?
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
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
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)
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
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
DSP DSP
DSP DSP
A B C
CS 640 52
State Diagram for CSMA/CD
Packet?
No
Yes
Discard
Packet Jam channel
attempts < 16 b=CalcBackoff();
wait(b);
attempts++;
attempts == 16
CS 640 53
CSMA/CD
A starts at A B
time 0
Message almost
A B
there at time T when
B starts – 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
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.
User
TCP UDP Datagram
Protocol
IP
Assume:
single message;
no contention.
Delay:
tm = tx + t n + t r
= xmtr overhead + network xmit time + rcvr overhead
Acknowledgment time.
Transmission errors.
P1 P2
P4
floor
floor
floor
floor
floor
Hoistway 1 Hoistway 2
Overheads for Computers as Components 2nd
© 2008 Wayne Wolf ed.
Theory of operation
sensor
fine
coarse
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
Controller
car-floor[1..H]: integer
emergency-stop[1..H]:
integer
scan-cars()
scan-floors()
scan-master-panel()
operate()