Reconfigurable computing
Small Embedded Systems
Unit 5.5
Networking for Embedded Systems
Introduction
Approaches to networking
Classification of networks
Collisions and how they are detected
Cyclic redundancy check (CRC)
Embedded networks that adapt standard computer network technology
Ethernet
EtherCAT
Embedded Networks compared to Internet
Computer networks (e.g. Internet, home local area networks)
Have obvious similarities to embedded system networks
Have led to enormous economies of scale so that very sophisticated equipment is affordable
However, there are also important differences:
Internet Embedded
Dynamic configuration
Devices join and leave networks in a casual way and are auto discovered
Adds to complexity of protocols Fixed configuration
Networks normally don’t change
Very high data throughput Lower throughput needed
Poor guarantees on timing of data arrival May need very precise guarantees on timing
Access devices are medium/high cost Some very tight cost constraints
Layering
The Internet has clearly defined protocol layers:
Physical: Move the bits around
Datalink: Arrange the bits in frames
Route within a LAN or point-to-point link
Detect corrupt data
Network: Move packets between networks
Transport: Steer data to correct processes/service
Cause retransmission of lost packets
Application Do what the user wants, e.g.
Display a web page,
Send an email
etc.
Layering
Embedded systems normally have a simpler layer system:
Physical: Move the bits around
Datalink: Arrange the bits in frames
Route within a network
Detect corrupt data
Specialist protocol that sends its data over physical/datalink
May be application-specific
May be vendor-specific
This lecture will look at the issues involved in physical and datalink layers for common embedded protocols
Issues in Multiple Access Networks
Multiple devices share a medium
If two devices speak at the same time:
Collision
Communication is garbled
How do we deal with this?
Humans in a seminar
(shared air, acoustical)
shared RF
(e.g., 802.11 WiFi)
shared wire (e.g.,
cabled Ethernet)
Controlling Access
Three broad classes:
Channel partitioning
divide channel into smaller “pieces”
e.g. time slots, frequency, code
allocate piece to node for exclusive use
Taking turns
nodes take turns, but nodes with more to send can take longer turns
Random access
channel not divided, allow collisions
detect collisions and recover from them
Controlling Access: Channel Partition
TDMA: Time Division Multiple Access
Access to channel in “rounds”
Each device gets fixed length slot in each round
Unused slots go idle
Example: 6-station LAN, 1,3,4 have packet, slots 2,5,6 idle
Disadvantages
Node limited to average rate of 1/N of available rate even if it’s the only one transmitting
For TDMA, node must always wait its turn to transmit
1
3
4
1
3
4
6-slot
frame
6-slot
frame
Controlling Access: Taking Turns
Only one device (“Master”) can take initiative in communication
Other devices (“Slaves”) must await invitation of master
Master invites (“polls”) each of slave device to transmit in turn
Concerns:
Polling overhead
Latency
Single point of failure
Master
Slaves
poll
data
data
Random Access
Anyone who has something to say can just go ahead and shout it out
How do we make this work?
Humans in a seminar
(shared air, acoustical)
shared wire (e.g.,
cabled Ethernet)
Approach 1: CSMA/CD
We expect people to listen and wait until they can hear that no one else is speaking
In networks this is called “Carrier sense”
Many possible speakers: “Multiple Access”
CSMA: Carrier Sense Multiple Access
When no else is talking, we can now speak
If two people start speaking at the same time:
Collision
Communication is garbled
They can hear that collision has occurred
CSMA/CD – Collision Detect
They go silent, wait a while, then try again
Humans in a seminar
(shared air, acoustical)
shared wire (e.g.,
cabled Ethernet)
This is the method used by the original Ethernet standard
Approach 2: CSMA/CA
We expect people to listen and wait until they can hear that no one else is speaking: CSMA
The meeting has a chairperson who gives permission to speak
When no else is talking, we could now speak
We raise our hand to show the chairperson that we want to speak
The chairperson picks one person with a raised hand and announces to all a fixed time slot in which only that person can speak
CSMA/CA: Collision Avoidance
This is one of the main methods used by WiFi
Humans in a seminar
(shared air, acoustical)
shared RF
(e.g., 802.11 WiFi)
Approach 3: CSMA/CR
We expect people to listen and wait until they can hear that no one else is speaking: CSMA
People have a pre-assigned priority
When no else is talking, we can now speak
Before saying anything else, we must state our priority
If two people start speaking at the same time, during the statement of priorities we find out who has priority
Lower priority speaker stops; higher priority continues uninterrupted
Humans in a seminar
(shared air, acoustical)
Standards such as CAN bus have clever ways to ensure that priority resolution can be carried out without obscuring anything said by higher priority speaker
Most common standard for wired links is Ethernet
Devices use physical (e.g. MAC) addresses to deliver data
To keep the diagrams simple, we’ll only show the last 2 digits of the MAC address
C8:60:00:BD:C0:A5
C8:60:00:17:AD:46
1C:C1:DE:83:73:F1
C8:60:00:75:1C:83
Ethernet
Ethernet
A5
46
83
F1
Devices use physical (e.g. MAC) addresses to deliver data
Most common standard for wired links is Ethernet
To keep the diagrams simple, we’ll only show the last 2 digits of the MAC address
Suppose A5 has data to send to F1
It creates a frame containing:
Header: Destination address (Dst) and Source address (Src)
Payload: Data to be transmitted
Trailer: Frame check sequence (FCS)
Receiver uses FCS to tell if the frame was corrupted during transmission
A5
46
83
F1
Data
FCS
Dst:F1
Src:A5
Ethernet Frames
Ethernet Unicast
When the link is available A5 sends frame (one bit at a time)
All devices receive the frame
Devices that don’t match the address discard the frame
Device that matches the destination address processes the frame
A5
46
83
F1
Not for me
Not for me
This is for me
Dst:F1
Src:A5
Data
FCS
Ethernet Broadcast
Sending to one recipient machine is called Unicast
Sometimes we need to send the same data to all machines in the network: Broadcast
Special address: FF:FF:FF:FF:FF:FF is used for broadcast
A5
46
83
F1
This is for me
This is for me
This is for me
Dst:
Src:A5
data
FCS
FF
Wired Ethernet Collision
Two devices send at the same time: result is garbage
Frames contain powerful error detecting code:
Cyclic Redundancy Check (CRC)
Recipients recognise frame is garbage and discard it
Senders know that what they hear on wire is not what they sent
Collision has occurred: they must re-send
That’s not what I sent
This is garbage
This is garbage
That’s not what I sent
Cyclic redundancy check
Powerful error-detection coding
View data bits, D, as a binary number
Choose r+1 bit pattern (generator), G
Divide D by G (modulo 2) to give remainder R
Transmit R along with D
Receiver takes received D and divides by G to get R
Compares its computed R with value of R received
If there is a discrepancy then error has been detected
D: data bits to be sent
R: CRC bits
d bits
r bits
Division Algorithm
Division with Decimal Numbers:
Divide 1222 by 35. What is the remainder?
17
4
105
32
35 ) 1222
3
2
140
divisor
quotient
dividend
remainder
1222 = 34 × 35 + 32
Dividend = quotient x divisor + remainder
CRC Example
All subtraction is done modulo 2 (i.e. no carries, bits just XORed)
Transmitted data word:
101110011
Any burst error of up to 4 bits is guaranteed detectable by this generator G
R
D
Collision-Free Ethernet
Collisions occur because of shared bus structure
Modern high-speed Ethernet uses star connection into switch
Switch buffers frames until link is free, so no collisions
switch
Industrial Ethernet
Widely used in the manufacturing industry
Uses ruggedized connectors and cables
Applies modifications to improve determinism of timing
We’ll look at one example:
EtherCAT:
Ethernet for Control Automation Technology
Uses physical and datalink standards for Ethernet, but modifies usage to give rapid and deterministic response times
Efficient handling of small data items
Better cost
Problems with Standard Ethernet
Standard Ethernet generates a lot of traffic, even when the desired task is simple and the data small,
e.g. read 1 register on the bottling machine to check status
This can need a lot of bandwidth (expensive), but give poor control over timing guarantees for actual return of data
https://www.clipartkey.com/view/TRbTJb_factory-clipart-cottage-industry-industrial-automation-vector-png/
EtherCAT
EtherCAT nodes are daisy-chained in a ring
Single master: only that node can initiate frames
Frame circulates around the ring:
Nodes read or write data to/from appropriate slot in frame and then forward frame on
Summary
Requirements for embedded networks
May require precise control of timing
Flexibility of standard Internet technologies is not needed, and may be undesirable overhead
Types of network
Event triggered (Random access)
Time triggered (TDMA)
Solving collisions in random access
CSMA/CD
CSMA/CA
CSMA/CR
/docProps/thumbnail.jpeg