communication protocols for embedded systems · set of rules i only the station in ... basic...
TRANSCRIPT
CommunicationProtocols forEmbeddedSystems
Kammerer
Communication Protocols for EmbeddedSystems
Roland Kammerer
Institute of Computer EngineeringVienna University of Technology
10. November 2010
CommunicationProtocols forEmbeddedSystems
Kammerer
Overview
1. Definition of a protocol
2. Protocol properties
3. Basic Principles
4. Embedded system communication protocols
CommunicationProtocols forEmbeddedSystems
Kammerer
Definition
Part I
Definition of a protocol
CommunicationProtocols forEmbeddedSystems
Kammerer
Definition
What is a communication protocol?
A set of formal rules describing how to exchange data
Low-level protocols define the electrical and physicalstandards to be observed, bit- and byte-ordering andthe transmission and error detection and correction ofthe bit stream
High-level protocols deal with the data formatting,including the syntax of messages, the terminal tocomputer dialogue, character sets, sequencing ofmessages etc.
CommunicationProtocols forEmbeddedSystems
Kammerer
Definition
Requirements for communication
I Agreed code space:I How is the data encoded?
I Agreed time space:I When is the data valid?
I Agreed name space:I What does the transmitted data mean?
CommunicationProtocols forEmbeddedSystems
Kammerer
Properties
Part II
Protocol properties
CommunicationProtocols forEmbeddedSystems
Kammerer
Properties
Properties of data exchange
I Message-based data exchangeI Data flowI Control flow (controlling the information exchange
between sender and receiver)
I Shared memory-based data exchangeI No control flow over borders of shared memory
CommunicationProtocols forEmbeddedSystems
Kammerer
Properties
State/Event messages
I State messages: periodic exchange of state informationI State Information := < Name,Value, tobs >I Time-triggered communication
I Event messages: sporadic exchange of event informationI Event Information := < Name, ∆Value, tevent >I Event-triggered communication
CommunicationProtocols forEmbeddedSystems
Kammerer
Properties
State/Event information
State Information:I At sender:
I At-least-oncetransmission
I At Receiver:I Update in placeI Non-consuming read
(one can read thelast valid message)
I No statesynchronization
Event Information:I At sender:
I Exactly-oncetransmission
I At Receiver:I QueuingI Consumed upon
read
I History state required⇒ queuing
CommunicationProtocols forEmbeddedSystems
Kammerer
Properties
Communication parameters
I Message delayI Latency - time interval between the start of message
transmission at the sender node and the time of receptionof the message at the receiver node
I dmax maximum delayI dmin minimum delayI Jitter ε = dmax − dmin
I BandwidthI Payload vs. total bandwidth
I Fault handlingI Message retransmissionI Forward error correction (Redundancy at sender in
message)I Message redundancy
CommunicationProtocols forEmbeddedSystems
Kammerer
Properties
Control flow: Push and Pull style
I Push style communication:
I Pull style communication:
CommunicationProtocols forEmbeddedSystems
Kammerer
Properties
The PAR Principle
I Positive Acknowledge or Retry
I Sender initiates communication (Push principle)
I Sender waits for receivers answer or timeout
I Communication errors are detected by the sender
I Time redundancy is used to correct an error (increasedlatency and traffic in the presence of errors)
I Problems:I JitterI Thrashing (throughput decreases above particular load)
I PAR principle used in TCP
CommunicationProtocols forEmbeddedSystems
Kammerer
Properties
Time-Triggered vs. Event-Triggered
I Time-triggered communication protocolsI sending and receiving actions are driven by the timeI exchange of state messagesI All communicating partners need to have a priory
knowledge of the message send/receive instants
I Event-triggered communication protocolsI sending and receiving actions are driven by an eventI exchange of event messagesI No a priory knowledge of the message send/receive
instants is needed
CommunicationProtocols forEmbeddedSystems
Kammerer
Properties
Time-Triggered communication
I Sender: Push style
I Receiver: Pull style
I Control flow is interrupted by memory element (i.e.,Temporary Firewall)
I Communication between memory element occurs atpredefined instants
CommunicationProtocols forEmbeddedSystems
Kammerer
Properties
Message-based Clock Synchronization
I Simple Method - message transmission times are known:I A sends message containing its local timeI Receiver B can correct with term ( dmin+dmax
2 )I Jitter effects precision
I Round-Trip Method - message transmission times are notknown:
I B requests timestamp message from AI B measures duration ∆t until reception of answerI B corrects with term ∆t
2I No need to know dmin and dmaxI Jitter effects precision
CommunicationProtocols forEmbeddedSystems
Kammerer
Properties
Time-Triggered communication schedule
1 2 3 4A Send Receive ReceiveB Receive Send Receive SendC Receive Receive Send ReceiveD Receive Receive Receive
CommunicationProtocols forEmbeddedSystems
Kammerer
BasicPrinciples
Part III
Basic Principles
CommunicationProtocols forEmbeddedSystems
Kammerer
BasicPrinciples
Token Principle
I Token is passed from one station to another according to aset of rules
I Only the station in possession of the token is allowed totransmit data
I Token ring is a logical ring topology, but can be physicallyimplemented as bus, star, or ring
I Recovery from lost/duplicate tokens?I Token hold timeI Token rotation time
I IEEE 802.5 (IBM token ring), FDDI (Fiber Distributed DataInterface)
CommunicationProtocols forEmbeddedSystems
Kammerer
BasicPrinciples
Master/Slave Principle - Polling
I Master sends request message
I Slave answers on request
I Usually cyclic polling (e.g., ASi, LIN bus)
I Multiple masters as token ring (e.g., Profibus)
CommunicationProtocols forEmbeddedSystems
Kammerer
BasicPrinciples
TDMA Principle - Time Division Multiple Access
I The time is the token
I Requires common time base and predefined schedule inall nodes
I Common time base via distributed reference clocks(TTP/C)
I Common time base via master reference clock (TTP/A)
CommunicationProtocols forEmbeddedSystems
Kammerer
BasicPrinciples
CSMA/CD Principle (Push) - Carrier Sense MultipleAccess/Collision Detection
I Listen before transmit. If channel is sensed busy, defertransmission
I Collisions may still exist, since two stations may sense thechannel idle at the same time
I Verify transmission by read back
I If collision, back off and retransmit later
I CSMA/CD principle used in 10Mbps Ethernet (IEEE 802.3),Fast Ethernet (100Mbps), Gigabit Ethernet (1000 Mbps)
CommunicationProtocols forEmbeddedSystems
Kammerer
BasicPrinciples
CSMA/CD Principle (Push) (2)
I There are two states on the communication channel:dominant and recessive
I Listen before transmit. If channel is sensed busy, defertransmission
I Node first sends an ID and verifies bit by bit by read back
I Node stops transmit if a bit of the ID is overwritten byother node
I ID with dominant bits at beginning have higher priority
I Requires: Bit time > 2 ∗ LineDelayI E.g., Bus length 40m, propagation delay 200 nsec (CAN)
CommunicationProtocols forEmbeddedSystems
Kammerer
BasicPrinciples
CSMA/CD Principle (Push) (3)
CommunicationProtocols forEmbeddedSystems
Kammerer
BasicPrinciples
Minislotting (e.g., ARINC 629)
I Minislotting requires that each node waits for a certainperiod after sending a message before it sends anothermessage
I Advantage: No bus monopolizationI Media access controlled by three intervals
I SG: Synchronization GapI same for all nodesI controls the sequence of entrance in the waiting room
I TG: Terminal Gap controlling the access to the busI different for every nodeI longer than propagation delay of the channel
I TI: Transmit IntervalI disables the host from monopolizing the busI same for all nodes
I TI > SG > max(TGi)
CommunicationProtocols forEmbeddedSystems
Kammerer
EmbeddedprotocolsTTP/C
CAN
Arinc 629
FlexRay
TT Ethernet
Part IV
Embedded system communication protocols
CommunicationProtocols forEmbeddedSystems
Kammerer
EmbeddedprotocolsTTP/C
CAN
Arinc 629
FlexRay
TT Ethernet
TTP/C
I Synchronous system
I Common communication schedule - TDMA
I Known upper bound on the transmission time of amessage
I Bus and/or star topologyI Fault tolerant
I two communication channelsI fault tolerant midpoint (clock synchronization)I using a priori knowledge (guardian)
I Aerospace industry
CommunicationProtocols forEmbeddedSystems
Kammerer
EmbeddedprotocolsTTP/C
CAN
Arinc 629
FlexRay
TT Ethernet
CAN protocol
I Event-triggered
I Bandwidth up to 1 Mbit/s
I Bus topology
I Different variants (e.g., TTCAN)
I Automotive industry
CommunicationProtocols forEmbeddedSystems
Kammerer
EmbeddedprotocolsTTP/C
CAN
Arinc 629
FlexRay
TT Ethernet
Arinc 629 protocol
I Aerospace industry (Boeing 777)I Synchronization Gap (SG)I Terminal Gap (TG): 4 - 128µsI Transmit Interval (TI): 0.5 - 64 ms
I Bandwidth: 2 Mbit/s
CommunicationProtocols forEmbeddedSystems
Kammerer
EmbeddedprotocolsTTP/C
CAN
Arinc 629
FlexRay
TT Ethernet
FlexRay protocol
I Combination of TDMA and mini-slottingI Communication bandwidth is divided into two segments:
I Static segment (TDMA): State messagesI Dynamic segment (minislotting): Event messages
I Bandwidth up to 10 Mbit/s
I Bus or star topology
I Automotive industry
CommunicationProtocols forEmbeddedSystems
Kammerer
EmbeddedprotocolsTTP/C
CAN
Arinc 629
FlexRay
TT Ethernet
Time-Triggered Ethernet
I Integration of time-triggered and event triggered trafficinto same communication infrastructure
I TT traffic (periodic with 16 different periods)
I ET traffic - standard Ethernet, TCP/IP, UDP/IP, . . .
I Star topology
I Bandwidth: 100 Mbit/s, 1 Gbit/s
CommunicationProtocols forEmbeddedSystems
Kammerer
EmbeddedprotocolsTTP/C
CAN
Arinc 629
FlexRay
TT Ethernet
Time-Triggered Ethernet (2)
CommunicationProtocols forEmbeddedSystems
Kammerer
EmbeddedprotocolsTTP/C
CAN
Arinc 629
FlexRay
TT Ethernet
Time-Triggered Ethernet (3)
I TT Ethernet switch: transmits TT msg. with a constantdelay
I Transmission of ET msg. is preempted,I if during the transmission a TT msg. arrives at a switch
port. ET msg. is stored in the buffer of the switch, andretransmitted as soon as the transmission of the TT msg. isfinished
I If during the transmission of TT msg. an ET msg. arrives ina port of the switch, the ET msg. is stored in the buffer ofthe switch and transmitted after the transmission of TTmsg. is finished
CommunicationProtocols forEmbeddedSystems
Kammerer
EmbeddedprotocolsTTP/C
CAN
Arinc 629
FlexRay
TT Ethernet
Conclusion
I Communication needs a set of rules describing how totransmit data
I Push style communication in combination withretransmission mechanism leads to high jitter
I Polling, Token ring and TDMA are deterministic
I Usually tradeoff: Flexibility <-> Determinism
CommunicationProtocols forEmbeddedSystems
Kammerer
EmbeddedprotocolsTTP/C
CAN
Arinc 629
FlexRay
TT Ethernet
Thank you for your attention
Any questions?