5.5.27 · D4Embedded Systems & Real-Time Software

Exercises — SpaceWire — high-speed serial link standard for spacecraft

2,270 words10 min readBack to topic

Before we start, one shared picture: a SpaceWire link is two twisted pairs, one carrying Data (D) and one carrying Strobe (S). Keep this drawing in your head for the whole page.

Figure — SpaceWire — high-speed serial link standard for spacecraft

Level 1 — Recognition

Exercise 1.1

SpaceWire sends two signals down the cable instead of one data line plus a clock line. Name the two signals, and state in one sentence why there is no separate clock wire.

Recall Solution

The two signals are Data (D) and Strobe (S). There is no separate clock wire because the clock is recovered on the receiver as where means XOR ("output 1 only when the two inputs differ"). The encoding guarantees that on every bit period exactly one of the two lines toggles, so their combined transition activity is a clock. A physical clock wire would drift against the data across long cables (thermal, radiation damage) — this drift is called skew, and DS encoding sidesteps it entirely. See LVDS Signaling for how each of D and S is itself a differential pair.

Exercise 1.2

Match each acronym to its job: EOP, EEP, FCT.

Recall Solution

Answer ::: EOP = End of Packet (normal, clean end). EEP = Error End of Packet (the packet was cut off by a detected error). FCT = Flow Control Token (a control character the receiver sends back to grant the sender credit for 8 more data characters of buffer space).


Level 2 — Application

Exercise 2.1 (Parity)

Compute the odd-parity bit for the data byte 0x5C. Show the bit count.

Recall Solution

0x5C in binary is , i.e. . Count the ones: → an even number of ones. Equivalently the XOR of all eight bits is . Odd parity means "make the total number of ones odd." We have 4 ones (even), so we must add a one: (Check: 4 data-ones + 1 parity-one = 5 ones total, which is odd. ✓) Cross-connect: this single parity bit is the tripwire for a bit flipped by a cosmic ray.

Exercise 2.2 (DS transitions)

The transmitter must send the bit sequence starting from Data, Strobe. For each of the 4 bit periods, state which line toggles (D or S).

Recall Solution

Rule: Data always equals the current bit. Strobe toggles only when the bit is the same as the previous bit (so that if Data stays flat, Strobe still gives one edge).

period bit same as prev? Data Strobe line that toggled
start 1 0
1 1 yes (prev 1) 1 1 S
2 1 yes 1 0 S
3 1 yes 1 1 S
4 0 no 0 1 D

Exactly one line toggles each period, so RecoveredClock = D XOR S ticks four times. Look at figure s02: three flat runs on Data are "rescued" by Strobe edges, and the falling bit is carried by Data itself.

Figure — SpaceWire — high-speed serial link standard for spacecraft

Level 3 — Analysis

Exercise 3.1 (Wormhole vs store-and-forward)

A 512-byte packet crosses 4 switches at a line rate of 100 Mbps. Per-switch header forwarding delay is . Compute the total latency for (a) store-and-forward and (b) wormhole. State the speed-up.

Recall Solution

First the packet's transmission time (time to shove all bits onto the wire once):

(a) Store-and-forward: each switch must receive the entire packet before sending it on, so every hop costs one full :

(b) Wormhole: the header carves the path (4 hops × 1 μs = 4 μs), and then the body streams straight through all reserved switches — you pay only once because the tail is already flowing while the head reaches the far end:

Speed-up . The core idea from Wormhole Routing vs Store-and-Forward: wormhole overlaps transmission across all hops; store-and-forward serialises it.

Exercise 3.2 (Credit / RTT sizing)

A link runs at 200 Mbps over a 20 m cable with signal velocity m/s. Each data character is 8 bits. (a) Find the round-trip time (RTT). (b) How many data characters are "in flight" over one RTT? (c) How many FCTs (each granting 8 characters) must be outstanding to keep the pipe full?

Recall Solution

(a) One-way delay s ns. RTT ns .

(b) Bits sent in one RTT bits. As characters: data characters in flight.

(c) Each FCT grants 8 characters, so credits needed FCT. One outstanding FCT (8 characters of granted credit) already exceeds the 5 characters the RTT can hide — so this short, fast link is comfortably covered. This is the deep reason from the parent note: RTT — not line rate — sets how much buffered credit you need. Longer cables ⇒ bigger RTT ⇒ more outstanding FCTs. Ties into Real-Time Determinism: the buffer bound is analytically known in advance.


Level 4 — Synthesis

Exercise 4.1 (End-to-end frame budget)

An imaging instrument produces a 4096-byte frame every 2 ms (a 500 fps sensor). The link is 200 Mbps across 6 hops, , wormhole routing. (a) What is the delivery latency of one frame? (b) What fraction of the 2 ms frame period does one frame's transmission occupy (the duty)? (c) Does the link keep up?

Recall Solution

(a) Packet transmission time: Latency (wormhole) .

(b) Duty of the frame period spent transmitting.

(c) Yes: , and even the full delivery latency fits inside one 2 ms period with margin. The link is not the bottleneck; there is headroom for RMAP Protocol read/write overhead and retransmission after a single-event upset.

Exercise 4.2 (Effective payload throughput)

Every 8 data bits are protected by 1 parity bit (the ratio) and, in practice, control characters (FCTs, EOPs) add roughly another 5% overhead. For a 400 Mbps raw line, estimate the useful payload throughput in Mbps.

Recall Solution

Step 1 — parity: usable fraction after parity . Step 2 — control overhead: multiply by . So a 400 Mbps SpaceWire link delivers ≈ 338 Mbps of actual instrument bytes. The gap is the price of on-wire error detection plus flow control — cheap insurance against radiation, and the reason SpaceWire beats a heavier legacy bus like MIL-STD-1553.


Level 5 — Mastery

You must connect a radar processor to a downlink buffer with a hard rule: every packet must be delivered within 250 μs (hard real-time). Packets are 8192 bytes, path is 5 hops (), wormhole. (a) Find the minimum line rate that meets the deadline. (b) Round up to the nearest standard rate from {2, 10, 100, 200, 400} Mbps and report the achieved latency.

Recall Solution

(a) The deadline budget splits into header reservation + body streaming: So the body must fit in : Minimum line rate ≈ 267.5 Mbps.

(b) The smallest standard rate above 267.5 Mbps is 400 Mbps. Achieved latency: Margin — room to absorb one EEP-triggered retransmission before the deadline is threatened.

Exercise 5.2 (Why not just add a clock wire?)

In two or three sentences, argue from the DS invariant why a shared clock wire fails on a long spacecraft harness, and how DS makes the failure mode disappear. Use the words skew and XOR.

Recall Solution

Answer ::: A shared clock wire and the data wire travel slightly different physical paths; thermal expansion and radiation damage make them arrive at different times — this timing mismatch is skew, and once skew grows past half a bit period the receiver samples the wrong bit. DS carries no clock wire at all: because exactly one of {Data, Strobe} toggles per bit, the receiver rebuilds the clock locally as (XOR). Since both D and S ride the same twisted-pair harness and are compared against each other rather than against a distant clock, there is no separate reference to skew against — the failure mode is designed out.