The idea: a timetable instead of a fight for the bus

On most buses a node sends when it has something to say. If two send at once, the bus has to decide who goes first: CAN does it bit by bit by priority, Ethernet's CSMA/CD lets the frames collide and retries after a random wait. This is event-triggered communication. A time-triggered bus works the other way round. Before the system runs, the designer writes a schedule table that gives each node its own slot in a repeating TDMA round (time-division multiple access). A node sends only in its slot, when its own clock says the slot has come. Nobody arbitrates, and nobody ever collides.

A TDMA round of 1000 microseconds split into four slots of 250 microseconds: slot 1 node A, slot 2 node B, slot 3 node C, slot 4 node D. In each slot a 200 microsecond frame sits between two 25 microsecond guard times. Zoom on slot 2: guard, frame B, guard; the frame starts at the action point, slot start plus 25 microseconds, by node B's own clock
Every node knows the whole timetable, so it knows when to send and when each other frame must arrive.

The page has four nodes, A to D, and one round of four 250 µs slots: A in slot 1, B in slot 2, C in slot 3, D in slot 4. Every node sends one 200 µs frame per round, so the round repeats every 1000 µs. The page uses the names of TTP/C (the Time-Triggered Protocol, class C, from Kopetz's group in Vienna), whose schedule table is called the MEDL (message descriptor list). The FlexRay static segment works the same way; its names are in a table at the end.

The slot, the action point and the guard times

A node does not start its frame right at the slot boundary. It waits until its own clock reads 25 µs into the slot (the action point), sends for 200 µs and stops 25 µs before the slot ends. The two empty 25 µs pieces are the guard times. They are there because the clocks never agree exactly. A receiver also knows when each frame should arrive. It accepts a frame only if it arrives within ±25 µs of that moment (its receive window), and it notes the difference, the deviation. A positive deviation means "this frame came late by my clock". Demo: one TDMA round, then FTA clock sync shows the four slots one by one, with each receiver's deviation.

Clocks drift: precision and guard times

Each node counts time with its own quartz crystal. A crystal is off by a few tens of ppm (parts per million): 50 ppm means 50 µs gained or lost per second. The page gives A +40, B −30, C +10 and D −50 ppm. A and D drift apart by 90 ppm, that is 0.09 µs per round or 90 µs per second. Just after start-up the clocks are also off by a few µs: A +6, B −4, C +2, D −8 µs from real time.

The largest difference between two good clocks is the precision Π. At the start it is 14 µs. Precision is what the guard times must cover: if Π grew past 25 µs, a frame would land outside some receiver's window, and soon after that on top of a neighbour's frame. So a time-triggered bus must keep re-synchronizing the clocks, every round.

Clock sync with no master: the fault-tolerant average

There is no time server. Every frame is already a time sample for free: every node knows when it should have arrived, so the deviation says how far the sender's clock is from its own. At the end of each round every node runs the fault-tolerant average (FTA):

  1. Take your own deviation, 0, and the deviations of the frames you accepted this round.
  2. Sort them and drop the k largest and the k smallest (here k = 1).
  3. The mean of the rest is how far you are from the group. Correct your clock by that much.
A number line of the deviations node A measured after round 1: own 0, C plus 4.02, B plus 10.02, D plus 14.07 microseconds. The smallest, own 0, and the largest, D plus 14.07, are dropped. The kept values C and B average to plus 7.02, so A is 7.02 microseconds ahead of the group and sets its clock back 7.02 microseconds
The two ends are dropped before averaging, so one clock that is far off cannot drag the others.

In round 1, A is 6 µs ahead of real time and the others are behind it, so their frames all look late to A: B +10.02, C +4.02, D +14.07 µs. A drops its own 0 and D's +14.07 and averages the rest: +7.02. It sets its clock back 7.02 µs. B corrects +3.01, C −3.01, D +7.02, and every clock lands near −1 µs: Π goes from 14.09 to 0.05 µs in one round. No node is in charge, and every node corrects only its own clock. In Demo: 100 rounds with FTA Π never gets above 0.15 µs, even just before a sync. The whole group slowly follows the middle clocks (B and C), here about 0.01 µs per round.

Kopetz gives the precision FTA can keep as Π = (ε + Γ) · (N − 2k) / (N − 3k), where N is the number of clocks, ε the reading error of a deviation and Γ the drift between two syncs (2 × 50 ppm × 1 ms = 0.1 µs here). With N = 4 and k = 1 the factor is 2. The page measures deviations exactly (ε = 0); on a real bus ε, the jitter of the arrival time, is usually the larger part. Compare NTP, which asks a server for the time and has to estimate the network delay; on a TDMA bus everyone already knows when each frame is due.

A wild clock, and why N ≥ 3k + 1

In Demo: wild clock at C C's counter jumps 20 µs ahead. C's frame is still inside the ±25 µs window, so it is accepted, but A measures it at −19.97 µs (early). That is the smallest value, so FTA drops it: A's correction is only +0.03 µs. A plain average of the same four values would have been −4.95, and A would have moved 4.95 µs toward the broken clock; B and D would have done the same. C itself sees every other frame about 20 µs late, keeps two of those 20 µs values and sets itself back 20.01 µs. Π goes from 20.10 to 0.08 µs. The good nodes outvoted the bad one.

A faulty clock may also lie differently to different nodes (it looks early to one and late to another). To keep the good clocks together in that case, FTA needs N ≥ 3k + 1 clocks to tolerate k faulty ones. Four nodes tolerate one; seven would tolerate two. This is the same counting as for Byzantine agreement, and the same idea of outvoting as in triple modular redundancy.

Without sync: the late node

Demo: sync off syncs once, then turns sync off and runs the rounds quickly. Each round, A gains 0.04 µs and D loses 0.05 µs. After 277 quiet rounds, in round 279, D's frame arrives 25.06 µs late by A's clock. That is outside A's receive window, so A rejects it, even though D did nothing wrong in its own eyes. B and C still accept it, because they sit between the two. In TTP/C, A would now count D as failed (the protocol keeps a membership list of nodes that sent correct frames), and the nodes would no longer agree who is alive. A little further on, D's frame would run into A's next frame. Sync is not optional on a time-triggered bus.

The babbling idiot and the bus guardian

A time-triggered bus has one weak point: a node that sends when it is not its turn. A crashed task in a loop can make a node a babbling idiot that sends in every slot. In Demo: babbling idiot B without a bus guardian B sends in slots 1, 3 and 4 too. Each of those frames collides with the rightful one, so A's, C's and D's messages are lost for everybody. Only 3 of 12 frames get through, and no node has enough deviations left to run FTA.

The fix is a bus guardian: a small, independent gate between the node and the bus, with its own clock and its own copy of the schedule. It opens the node's line only during the node's own slot. In Demo: babbling idiot B, the bus guardian blocks it B's extra frames stop at its guardian; all 12 frames arrive and FTA runs as usual. CAN handles a faulty node only after the fact: the node's error counters climb until it switches itself off (bus-off). A guardian stops the faulty frame before it reaches the bus.

Constant latency vs event-triggered

D reports a value every round. On the TDMA bus its frame always ends at 750 + 25 + 200 = 975 µs into the round. Demo: latency, time-triggered vs event-triggered sends the same 200 µs messages over an event-triggered priority bus (like CAN, with an alarm message above A, B, C and D). There, D waits for whoever else happens to have a frame.

Bar chart over eight rounds of the latency of D's message. The TDMA bars are 975 microseconds every round. The event-triggered bars are 800, 200, 400, 1000, 600, 400, 600 and 800 microseconds
The event-triggered bus is faster on average, but only the time-triggered bus gives the same answer every round.
BusD's latency over 8 roundsMeanJitter
time-triggered (TDMA slot 4)975 every round975 µs0 (only Π)
event-triggered (priority)800, 200, 400, 1000, 600, 400, 600, 800600 µs800 µs

The time-triggered bus is never the fastest: D always waits for its slot. But its timing is known before the system runs, does not change with the load, and can be tested once and for all. That is why it is used for brake-by-wire, flight controls and other safety-critical systems. The same idea on one processor is the time-triggered scheduler and the cyclic executive: a table made in advance decides what runs when.

TTP/C and FlexRay names

On this page (TTP/C)FlexRay static segment
TDMA roundcommunication cycle (static segment, then a dynamic segment)
slotstatic slot
MEDL (schedule table)the cluster's static schedule
action point, 25 µs into the slotaction point offset
µs of the local clockmacroticks (made of microticks)
FTA: drop k largest and smallest, take the meanfault-tolerant midpoint: drop the ends, take (max + min) / 2
bus guardianbus guardian (optional)

What the page leaves out

  • TTP/C's real sync uses the last four measured frames from nodes marked for clock sync (not its own 0), and it corrects the clock in small steps (rate correction) instead of a jump. FlexRay corrects both the offset and the rate.
  • Reading error: the model measures every deviation exactly, so precision comes only from drift. Real buses have arrival jitter of a fraction of a µs to a few µs.
  • Start-up (how the first round is found when no clock is set yet), the membership service and its clique avoidance, mode changes, and two redundant channels.
  • FlexRay's dynamic segment (event-triggered minislots after the static slots) and TTEthernet; how a schedule table is built and checked offline.
  • The physical layer: bit encoding, line drivers and the exact length of a frame.

On the mind map

Open the Computer Architecture mind mapComputerArchitectureAbstraction and numbers: layers and bit patternsAbstraction and numbersCombinational logic: output depends only on inputsCombinational logicSequential logic: state held by a clockSequential logicMIPS software: how C becomes machine wordsMIPS softwareThe processor: datapath plus controlThe processorPipelines and parallelism: more instructions at oncePipelines and parallelismMemory and I/O: small fast near, big slow farMemory and I/OMemory arraysMemory arraysdecoder picks wordline, bitlines readCPU cacheCPU cachetag, index, offset; hit or missCache address breakdownCache address breakdownsets = lines/ways; tag = rest of addressCache Write PoliciesCache Write PoliciesWrite-back sends dirty lines at evictionLoop tiling and interchangeLoop tiling and interchangeWalk rows; tile so reused data fitsMemory hierarchyMemory hierarchyAMAT = hit time + miss rate × penaltyDRAM timingDRAM timingopen row is fast, row change is slowMESI and false sharingMESI and false sharinga write invalidates other copiesVirtual memoryVirtual memoryTLB caches the page tableEmbedded I/OEmbedded I/Odevices are addresses; poll or interruptMCU startup to mainMCU startup to mainCopy .data, zero .bss, then mainButton debounce FSMButton debounce FSMTwo equal 10 ms samples = one pressI2C BusI2C BusWired-AND bus: ACK, stretch, arbitrateUSB enumerationUSB enumerationAddress 0, descriptors, SET_CONFIGURATIONCAN bus arbitrationCAN bus arbitrationDominant 0 wins: lowest ID sends unharmedModbus RTU and TCPModbus RTU and TCPone master asks; bad CRC means silenceTDMA time-triggered busFixed slots; FTA drops extremes, averagesAMBA AXI, AHB, APBAMBA AXI, AHB, APBVALID and READY both 1 on the edgePCIe TLPsPCIe TLPsRequests by address, completions by IDBus vs Crossbar vs NoCBus vs Crossbar vs NoCBus: one at a time; NoC: links in parallelADC and PWMADC and PWMSAR = binary search; duty = OC1RS/(PR2+1)PID ControlPID ControlI removes error; clamp stops windupOpen the Computer Architecture mind mapComputer Architecturesmall fast near, big slow farMemory and I/OMemory arraysMemory arraysdecoder picks wordline, bitlines readCPU cacheCPU cachetag, index, offset; hit or missCache address breakdownCache address breakdownsets = lines/ways; tag = rest of addressCache Write PoliciesCache Write PoliciesWrite-back sends dirty lines at evictionLoop tiling and interchangeLoop tiling and interchangeWalk rows; tile so reused data fitsMemory hierarchyMemory hierarchyAMAT = hit time + miss rate × penaltyDRAM timingDRAM timingopen row is fast, row change is slowMESI and false sharingMESI and false sharinga write invalidates other copiesVirtual memoryVirtual memoryTLB caches the page tableEmbedded I/OEmbedded I/Odevices are addresses; poll or interruptMCU startup to mainMCU startup to mainCopy .data, zero .bss, then mainButton debounce FSMButton debounce FSMTwo equal 10 ms samples = one pressI2C BusI2C BusWired-AND bus: ACK, stretch, arbitrateUSB enumerationUSB enumerationAddress 0, descriptors, SET_CONFIGURATIONCAN bus arbitrationCAN bus arbitrationDominant 0 wins: lowest ID sends unharmedModbus RTU and TCPModbus RTU and TCPone master asks; bad CRC means silenceTDMA time-triggered busFixed slots; FTA drops extremes, averagesAMBA AXI, AHB, APBAMBA AXI, AHB, APBVALID and READY both 1 on the edgePCIe TLPsPCIe TLPsRequests by address, completions by IDBus vs Crossbar vs NoCBus vs Crossbar vs NoCBus: one at a time; NoC: links in parallelADC and PWMADC and PWMSAR = binary search; duty = OC1RS/(PR2+1)PID ControlPID ControlI removes error; clamp stops windup
This page on the Computer Architecture mind map · 79 pages in 7 branches · open it to see the whole map and test yourself in recall mode.