SpaceWire — high-speed serial link standard for spacecraft
What SpaceWire Actually Is
Core Architecture Components
- Physical Layer: LVDS differential pairs (Data + Strobe signals), low power (~10 mW per link)
- Character Layer: 8-bit data bytes + parity bit, encoded as Data-Strobe transitions
- Packet Layer: Variable-length packets with destination address, data payload, EOP/EEP markers
- Network Layer: Wormhole-routed switching fabric (packets establish path as header propagates)

How SpaceWire Works: The Signal Encoding
Derivation from First Principles:
- Problem: A separate clock line drifts against data across cables in space (thermal expansion, radiation damage) → skew corrupts sampling.
- Requirement: Guarantee at least one, and only one, transition per bit period so timing is recoverable from the wires themselves.
- Insight: If Data changes only when the bit value changes, then on a run of identical bits Data is flat — timing would be lost. So we add Strobe, which toggles precisely when Data does not. Now every bit period has exactly one transition (either on Data or on Strobe).
- Recovery: XOR the transition activity of Data and Strobe → one edge per bit = the clock. Sample Data on that edge.
Character Transmission
Each data character is 9 bits: 1 parity bit + 1 data-control flag bit + 8 data bits… more precisely, SpaceWire builds characters from a parity bit + control flag + payload; a data character is 10 bits on the wire only counting the leading parity+flag, but the payload is 8 data bits protected by 1 parity bit, giving the useful ratio . For efficiency accounting we use: 8 data bits are protected by 1 parity bit → 9-bit effective data character.
In SpaceWire the parity is odd parity computed over the previous character's data bits and the current control/flag bit (interleaved parity). For a first-principles understanding, treat parity as: "a bit chosen so the protected group has a fixed parity."
Why parity? Detects single-bit errors from cosmic rays. If parity fails, the receiver enters an error state and the link is re-established.
Packet Structure and Routing
Wormhole Routing Mechanism
Wormhole routing establishes a circuit as the packet header propagates:
- Header byte arrives at switch → lookup output port from routing table
- Switch reserves that output port and forwards header byte
- Body bytes follow the reserved path (switch doesn't inspect them)
- EOP releases the reserved path
Latency formula:
where = number of hops, = per-switch forwarding delay (~1 μs typical).
Why this step? Traditional store-and-forward would buffer entire packets (adding delay per hop). Wormhole cuts latency by ~10× for long packets.
Flow Control: Credit-Based BackPressure
SpaceWire uses character-level flow control to prevent buffer overflow:
- Each receiver has an N-character buffer, and each FCT it sends grants credit for 8 characters of space.
- Sender transmits only while it holds credit, decrementing as it sends.
- Receiver sends FCT (Flow Control Token) characters after freeing space → replenishes sender's credit.
Radiation Tolerance and Fault Handling
Link Reset and Hot-Swap
SpaceWire links progress through states: ErrorReset → ErrorWait → Ready → Started → Connecting → Run.
Key point on timing: the standard specifies the reset/wait intervals in numbers of character (bit) times, not fixed microseconds. Their absolute duration therefore scales with the link bit rate — the same character-count interval is shorter at 200 Mbps than at 10 Mbps.
- ErrorReset (power-on): drive both lines to reset for a fixed character-count interval → clears old state
- ErrorWait: wait a fixed character-count interval (chosen longer than worst-case propagation) → ensures remote node also reset
- Ready: send FCTs → advertise buffer credits
- Started: receive FCTs → confirm remote node alive
- Connecting: exchange NULL/FCT pattern → synchronize
- Run: normal operation
Why this step? Because the wait is measured in character times, it must be dimensioned so its worst-case absolute duration still exceeds the maximum cable propagation delay — guaranteeing both ends observe each other's reset before proceeding. This enables hot-swapping failed units without power-cycling the entire bus.
RMAP: Remote Memory Access Protocol
RMAP (Remote Memory Access Protocol) is the killer app for SpaceWire—lets processors read/write registers and memory on remote nodes without custom firmware.
Command types:
- Read (0x08): Request N bytes from address A
- Write (0x09): Write N bytes to address A
- Read-Modify-Write (0x0A): Atomic RMW for semaphores
Packet structure:
[Destination] [Protocol ID=0x01] [Command] [Address] [Data] [CRC] [EOP]
Performance Calculations
Cable length vs. speed — the real reason:
There is no simple RC formula in the standard. Practical cable length is limited by signal attenuation, jitter, and inter-pair skew as data rate rises. Faster rates → tighter timing budget → the receiver's edge sampling can't tolerate as much skew/jitter → shorter cables. Roughly: high rates (400 Mbps) → a few metres; low rates (2–10 Mbps) → tens of metres. Curiosity's cameras run around 10 Mbps over ~10 m; satellite backplanes run 200 Mbps over ~1–2 m.
Recall Explain to a 12-year-old
Imagine passing notes in class while the teacher (radiation) keeps shaking your desk. Instead of a separate "tick-tock" clock to keep time, you and your friend agree on a clever rule: on every single beat, exactly one of you claps — either the "value hand" or the "timing hand" moves, never both, never neither. Just by watching who clapped, your friend always knows a beat happened and can read your value. That's Data-Strobe: two signals where exactly one flips per bit, so the beat is always recoverable.
Now imagine ten friends who all need to swap notes. Instead of shouting across the noisy room, each note has an address on the front, and a "postmaster" at each desk reads just the address and instantly points it to the next desk — without opening the whole note. That's wormhole routing: super fast because nobody waits for the entire message.
Finally, you can't dump 100 notes on a friend's tiny desk. So they hand you tickets — each ticket lets you send a small batch. When they clear space, they hand you more tickets. That's credit-based flow control: nobody ever gets buried.
Connections
- LVDS Signaling — Physical layer differential pairs used by SpaceWire
- Wormhole Routing vs Store-and-Forward — Network switching architectures
- Cosmic Ray Effects on Electronics — Why radiation tolerance matters
- RMAP Protocol — Application layer for SpaceWire memory access
- MIL-STD-1553 — Older avionics bus that SpaceWire replaces
- CAN Bus — Automotive equivalent (lower speed, different fault model)
- Real-Time Determinism — Why bounded latency matters for spacecraft
- Serial vs Parallel Communication — Fundamental tradeoff in high-speed links
#flashcards/coding
In SpaceWire Data-Strobe encoding, what is guaranteed on every bit period, and how is the clock recovered?
Why does SpaceWire use Data-Strobe instead of a separate clock line?
For byte 0xA7 (1010 0111), what is the XOR of all eight bits and how many ones are there?
How many bits protect the 8 data bits in a SpaceWire data character, and what is the payload efficiency?
Compute SpaceWire effective throughput at 200 Mbps signaling using the 8/9 rule.
What is the round-trip time for a 10 m SpaceWire cable at ~2×10^8 m/s, and why does it matter?
What is an FCT and how much credit does it grant?
Why are SpaceWire startup/reset intervals not fixed microsecond values?
What really limits SpaceWire cable length as data rate rises?
What is RMAP and what problem does it solve?
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Chalo is SpaceWire ko simple tareeke se samajhte hain. Socho ek spacecraft ke andar cameras, radar aur sensors hain jo bahut saara data generate karte hain, aur ye data ko processor tak bhejna hai. Lekin space mein problems hain — radiation se cheezein kharab hoti hain, har extra gram weight fuel cost badhata hai, power limited hai, aur agar kuch tootta hai to koi repair karne nahi ja sakta. Purane heavy parallel buses in constraints mein fail ho jaate hain. Isliye SpaceWire banaya gaya — ek lightweight, fast (2 Mbps se 400 Mbps tak), fault-tolerant serial link jo "Ethernet for space" jaisa hai, par deterministic aur radiation-hard.
Ab iska sabse clever part hai Data-Strobe (DS) encoding. Normally data ke saath ek alag clock wire bheji jaati hai taaki receiver samajh sake kab bit sample karna hai. Par space mein thermal expansion aur radiation se clock aur data ke beech skew aa jaata hai, jisse sampling galat ho jaati hai. SpaceWire ka trick ye hai — wo clock bhejti hi nahi! Wo do signals bhejti hai: Data (jismein actual bit hai) aur Strobe (jo tab toggle karta hai jab do consecutive bits same hote hain). Iska result ye hai ki har bit period mein exactly ek line change hoti hai. Ab receiver simple XOR karta hai — Data XOR Strobe — aur usse apna khud ka clock nikaal leta hai! Matlab clock wire ki zaroorat hi khatam, aur skew ki problem gone.
Ye samajhna kyun important hai? Kyunki yahan ek beautiful engineering principle hai — jab aap ek constraint (extra clock wire) hata dete ho, tab aapko clever encoding se timing information ko data ke andar hi embed karna padta hai. Ye idea sirf space tak seedha nahi — SATA, USB jaise everyday protocols bhi similar self-clocking encoding use karte hain. To agar tum ye DS-encoding ki intuition pakad lo — "exactly one edge per bit guarantee karo, phir XOR se clock recover karo" — to tum embedded aur high-speed communication systems ki ek fundamental design philosophy samajh jaoge. Yahi cheez exams aur real projects dono mein kaam aayegi.