Embedded System Communication

advertisement
Setha Pan-ngum
Introduction
 Embedded & Real-time systems could be standalone
or connected
 A real-time system is often composed from a number
of periodic (time triggered) and sporadic (event
triggered) tasks which communicate their result by
passing messages.
 In a distributed real-time systems these messages are
sometimes sent between processors across a
communication device. (from Urban Bilstrup)
Introduction (cont.)
 To guarantee that the timing requirements of all tasks
are met, the communications delay between a sending
task and a receiving task being able to access that
message must be bounded.
For examples
 Control systems: between sensors and actuators via
central computer
 Multiprocessors: between processors, tasks
communicating
Open System Interconnection
•Intended for computers
•Designed to solve compatibility
problem
•Layers provide standard
interface and services
•Embedded systems use some
standardisation ideas
•Higher layers require lower
layers to work
OSI
Layers
 Application – user interface e.g. Internet explorer
 Presentation – data formatting e.g. compression and
encoding
 Session – handle overall connection e.g. OS,
scheduling programs
 Transport – ensures data transfer, error checking e.g.
TCP
 Network – logical addressing, routing e.g. IP (from
TCP/IP)
OSI cont.
 Data link – prepares data for transfer, physical
addressing such as Media Access Control (MAC)
 Physical – wires and cables, hubs, repeaters.
Embedded Communication
 Point-to-point networks
 Each node connected to every node
 Simple and reliable
 Dedicated links make it easy to meet real-time deadlines
 Costly due to many wires required
 Shared media networks
 Nodes are connected via bus or other topologies
 Less wiring and hence cheaper
 Easily extendable by adding new nodes to network
 Complex network protocol
 Being the system of focus from now on
Basic network architectures
From Urban Bilstrup
P1
P2
P1
P2
P1
P2
memory
P3
P4
P1
P2
Internet
P3
P4
P3
P4
P3
P4
Complex distributed architecture
From Urban Bilstrup
External
Wireless
Communication
System
Internal
Wireless
Communication
System
GREEN CAN
LIN
HMI
Gateway
MOST
Tuners
Playback
Audio
Audio
Audio
modules
Audio
modules
modules
module
RED CAN
Concepts
 Event based communication
 E.g. alarm, user inputs, requests for data from other
systems
 State based communication
 E.g. regular sensor readings
 Predictability
Network resources &
qualitative parameters
 Network resources
 Bandwidth
 Buffer space
 Protocol efficiency (data bits/bandwidth). Depends on


Message overhead
Media access overhead
 Determinacy (ability to calculate worst-case response
time)
 Robustness
 cost
Event based system
 Efficient use of network resource
 Needs high reliability (event based data comes once in
a while)
 May need acknowledgement
 Hard to predict delay in case of overloading (e.g.
alarm)
State based system
 Messages sent at predefined, regular intervals.
 Less efficient due to regular occupation of
communication channel by nodes.
 More tolerance. Missed message may be ok, since the
next one will be coming.
 Transient data problem. Sending node has to keep
data long enough for other to see. E.g. button pressed
may need to be repeated.
Protocol
 No best protocol, depends on applications.
 Embedded systems tends to focus on level 1 and 2 of
OSI model, for simplicity and overhead reduction.
 Physical link (Layer 1) – transmission medium
 Data link (Layer 2) provides Media Access Control
(MAC)
Advanced communication principles [6]
 Layering
 Break complexity of communication protocol into pieces easier to design and
understand
 Lower levels provide services to higher level

Lower level might work with bits while higher level might work with packets of data
 Physical layer


Lowest level in hierarchy
Medium to carry data from one actor (device or node) to another
 Parallel communication
 Physical layer capable of transporting multiple bits of data
 Serial communication
 Physical layer transports one bit of data at a time
 Wireless communication
 No physical connection needed for transport at physical layer
15
Parallel communication [6]
 Multiple data, control, and possibly power wires
 One bit per wire
 High data throughput with short distances
 Typically used when connecting devices on same IC or
same circuit board
 Bus must be kept short


long parallel wires result in high capacitance values which requires more
time to charge/discharge
Data misalignment between wires increases as length increases
 Higher cost, bulky
16
Serial communication [6]
 Single data wire, possibly also control and power wires
 Words transmitted one bit at a time
 Higher data throughput with long distances
 Less average capacitance, so more bits per unit of time
 Cheaper, less bulky
 More complex interfacing logic and communication protocol
 Sender needs to decompose word into bits
 Receiver needs to recompose bits into word
 Control signals often sent on same wire as data increasing protocol
complexity
17
Wireless communication [6]
 Infrared (IR)
 Electronic wave frequencies just below visible light spectrum
 Diode emits infrared light to generate signal
 Infrared transistor detects signal, conducts when exposed to
infrared light
 Cheap to build
 Need line of sight, limited range
 Radio frequency (RF)
 Electromagnetic wave frequencies in radio spectrum
 Analog circuitry and antenna needed on both sides of transmission
 Line of sight not needed, transmitter power determines range
18
Media Access Control (MAC)
 Many protocols are taken from computer networks
 Connection oriented protocols
 CSMA/CD
 CSMA/CA
 Polling
 Token passing
 TDMA
 Binary countdown (Bit dominance)
Protocol overview [1]
Connection oriented protocols
[5]
 2 nodes per each connection only
 If nodes are not directly connected, data is relayed
 Deterministic delay between directly connected nodes,
high delay for indirectly connected nodes
Connection oriented protocols
cont.
 Suitable to systems with low communication
requirements.
 Node with pass-through traffic can be fully occupied.
 E.g. telephone network service
Polling [5]
 Simple and deterministic
 Needs a master node
 Master periodically polls slave nodes
 Consumes bandwidth
 E.g. military aircraft communication
 Simple slave nodes, complex master
Time Division Multiple Access (TDMA)
[5]
 Masters broadcasts sync signal to synchronise all
clocks
 Then each node sends data on its time slot.
 Similar but more efficient than polling (synchronise
once vs polling all nodes individually.
 more complex nodes due to timing requirements.
TDMA cont.
 Fixed length messages (inflexible)
 E.g. satellite communications
.
Token ring [5]
 Ring shape network
 Token (signal) is passed from node to node
 Node can hold token, send message all the way round
the ring, and pass token on
 Deterministic under heavy load
Token ring cont.
 Some token overhead
 Can add priority by having extra field in token
 More complexity in detecting token lost
 Cable break disrupts network (needs dual ring)
 E.g. many Wide Area Networks (WANs)
Token bus [5]
 Similar to token ring
 Token is passed via bus simultaneously
 Cable break can be dealt with by reconfiguration (like
when a node is added to or taken off the network.
 Applied in manufacturing
Binary countdown (Bit
Dominance)
 All nodes wait for channel to be free before sending.
 Simultaneous channel access (contention) resolved by
detecting broadcasting signal for unique identification
 Bus must provide dominance bit e.g. ‘1’ can override ‘0’
 A node stop transmitting when seeing dominance bit
opposite to its own broadcasting.
 Hence messages require priority as IDs rather than
node IDs.
 Good throughput & high efficiency (no contention
loss)
Binary countdown cont. [5]
Binary countdown cont.
 Heavy load can cause long delay for low priority
messages (no bound)
 Applied in industrial and automotive Controller Area
Network (CAN) and SAE standard J 1850
Carrier Sense Multiple Access with
Collision Dectection (CSMA/CD) [5]
 Nodes wait for idle channel before transmitting.
 When simultaneously transmission is detected, each
node stops and waits for random time before
resending.
CSMA/CD cont.
 Easy to add or take off new nodes without
initialisation and configuration
 Low overhead at light traffic
 Unbound overhead at heavy traffic (messages keeps
colliding) hence low determinacy and efficiency.
 Requires detection circuit
Carrier Sense Multiple Access with
Collision Avoidance (SCMA/CA) [5]
CSMA/CA cont.
 Hybrid between light traffic efficiency of CSMA/CA
and heavy traffic efficiency of token-based protocols.
 Nodes waits for free network before sending.
 When collision happens, jam signal is sent to notify all
nodes, synchronises clocks and start contention time
slot.
 Unique time slot is assigned to each node
 Rotate time slot for fairness
 Network return to normal state when all slots are
unused.
CSMA/CA cont.
 Variations
 Reservation CSMA – no. of slots equal to no. of nodes

Not practical if networks has many nodes.
 No. of slots less than no. of nodes – randomly allocate
slots to nodes.
Media access comparison [5]
Automotive standards [7]
 Controller Area Network (CAN)
 Event triggered, Arbitration
 Time Triggered Protocol (TTP)
 Time triggered, TDMA
 Local Interconnect Network (LIN)
 Time triggered, master-slave
 Media Oriented System Transport (MOST)
Manufacturing Automation
Standards [7]
 Controller Area Network (CAN)
 Arbitration
 Process Network (P-NET)
 Token passing and master-slave
 PROcess Field Bus (PROFIBUS)
 Token passing and master-slave
 Factory Instrumentation Protocol (World FIP)
 Centralised arbitration
Military Standards [7]
 MIL-STD 1553
 The current 1553 data bus is widely used in military applications, with a
nominal throughput of 1 Mb/s.
 MIL-STD 1773
 Mil-Std-1773 defines a fiber optic bus. This system is widely used for on-
board command and telemetry transfer between military spacecraft
components, subsystems and instruments, and within complex
components themselves. 1773 AS, has a dual rate of 1 Mb/s or 20 Mb/s.
 ARINC 429
 A commercial aircraft data bus. It is widely implemented in the
commercial aircraft avionics industry. Performance is 100Kb/s or 12.5Kb/s.
References
1.
2.
3.
4.
5.
6.
7.
Upender B, Koopman P, Embedded communication protocol
options, Proc. to the 5th annual embbeded system conference, 1993
Rollins L, Embedded communication
Kopetz H, Real-time system design principles for distributed
embedded applications, Kluver, 1997
Liu J, Real-time systems, Prentice-Hall, 2000
Upender B, Koopman P, Communication protocols for embedded
systems, Embedded systems programming, Nov 1994.
Vahid F, Givargis T, Embedded system design a unified
hardware/software introduction, Wiley, 2002
Bilstrup U, Real-time communication
Download