Contents • Real-time communication Lecture 6: Real-time communication • Muddy-card evaluation Mikael Asplund Real-Time Systems Laboratory Department of Computer and Information Science Linköpings universitet Sweden The lecture notes are partly based on lecture notes by Jan Jonsson's course PDRTS. These lecture notes should only be used for internal teaching purposes at Linköping University. Lecture 6: Real-time communication Mikael Asplund Lecture 6: Rea Mikael Asplund 2 Yesterday Today • >11000 electrical parts • 61 ECUs • 3 CAN buses • 250 CAN messages Lecture 6: Rea Mikael Asplund 3 Lecture 6: Rea Mikael Asplund Communication scheduling • Non-preemptive by nature 4 Message delay • Packetizing the message • Queueing delay, waiting for medium access • Distributed protocol required • Transmitting • Notifying receiver of message arrival P1 • Depacketizing the message Network P2 Lecture 6: Rea Mikael Asplund 5 Lecture 6: Rea Mikael Asplund 6 Communication media • Electrical medium (wire) Topologies • Bus • Optical fiber • Wireless • Ring Lecture 6: Rea Mikael Asplund 7 Lecture 6: Rea Mikael Asplund 8 Topologies Message routing • Packet switching • Hypercube • Circuit switching • Wormhole routing Lecture 6: Rea Mikael Asplund 9 Lecture 6: Rea Mikael Asplund Communication scheduling • Two things to schedule: tasks and transmissions 10 Integrated scheduling • Suitable for: – Homogeneous • Integrated scheduling – Hard real-time – Requires compatible dispatching strategies – Static allocation • Separated scheduling • Examples – Allows different dispatching strategies – Time driven dispatching + TDMA – Static priority dispatching + CAN – Static priority dispatching + Token Ring Lecture 6: Rea Mikael Asplund 11 Lecture 6: Rea Mikael Asplund 12 Separated scheduling • Suitable for: Medium access • Contention-free communication – Heterogeneous – Time based, each processor gets a slot – Dynamic allocation – Examples: Time-division, multiple access (TDMA) – Firm/soft real-time • Collision-based – Processors contend for the medium at run-time • Why – Examples: Ethernet, CAN – Transmission time might be zero • Token based – Number of hops can vary – A token is passed around that gives the right to send – Different policies for different links – Examples: FDDI, Token Ring Lecture 6: Rea Mikael Asplund 13 Lecture 6: Rea Mikael Asplund TDMA • Time-Division Multiple Access 14 TTA /TTP • The time triggered architecture [Kopetz et. al] • Requires synchronized clocks! • TDMA – Allocates pre-defined slots within which pre-defined nodes can send their pre-defined messages • Offline scheduling – Periodical architecture • Temporal firewall P1 Lecture 6: Rea Mikael Asplund P2 P3 • Replication & failure detection P4 15 Lecture 6: Rea Mikael Asplund TTA 16 Token-based Timed-Token Protocol • Target token-rotation time (TTRT) • Real-time and non-real-time traffic • Is token late? Yes => only RT. Lecture 6: Rea Mikael Asplund 17 Lecture 6: Rea Mikael Asplund 18 Feasability of Timed-Token Protocol • Necessary: Token Ring (IEEE 802.5) • Token format: P P T M R R R – R: reservation SD AC ED • Sufficient: • Message format: –The accumulated transmission quotas should not exceed TTRT-Overhead Lecture 6: Rea Mikael Asplund P – P: priority –The deadline of each message transmission must be at least 2*TTRT SD AC ED 19 packet data error ctrl ED FS Lecture 6: Rea Mikael Asplund Token Ring • Examine busy token, insert own priority in PPP if higher than RRR addresses 20 Controller Area Network (CAN) • Bus • Identifier used as priority • Grab free token only if priority higher than PPP • Wired-AND • Send message by adding to token • Reset the priorities you have set yourself! Lecture 6: Rea Mikael Asplund 21 Lecture 6: Rea Mikael Asplund Arbitration 22 Real-time CAN • With non-preemptive rate-monotonic • With EDF and DM by partitioning the identifier field Lecture 6: Rea Mikael Asplund 23 Lecture 6: Rea Mikael Asplund 24 Reading • Chapter 14 of Burns & Wellings • Paper by Herman Kopetz, The Time-Triggered Architecture Lecture 6: Rea Mikael Asplund 25