SpaceWire — high-speed serial link standard for spacecraft
5.5.27· Coding › Embedded Systems & Real-Time Software
SpaceWire Actually Hai Kya
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, Data-Strobe transitions ke roop mein encoded
- Packet Layer: Variable-length packets with destination address, data payload, EOP/EEP markers
- Network Layer: Wormhole-routed switching fabric (header propagate hone ke saath packets path establish karte hain)

SpaceWire Kaise Kaam Karta Hai: Signal Encoding
First Principles se Derivation:
- Problem: Ek alag clock line space mein cables ke across data ke against drift karta hai (thermal expansion, radiation damage) → skew sampling corrupt kar deta hai.
- Requirement: Guarantee karo ki kam se kam ek, aur sirf ek, transition har bit period mein ho taaki timing khud wires se recoverable ho.
- Insight: Agar Data sirf tab change kare jab bit value change ho, toh identical bits ki run mein Data flat hoga — timing lost ho jaati. Isliye hum Strobe add karte hain, jo exactly tab toggle karta hai jab Data nahi karta. Ab har bit period mein exactly ek transition hoti hai (ya toh Data par ya Strobe par).
- Recovery: Data aur Strobe ki transition activity ko XOR karo → ek edge per bit = the clock. Us edge par Data sample karo.
Character Transmission
Har data character 9 bits ka hai: 1 parity bit + 1 data-control flag bit + 8 data bits… zyada precisely, SpaceWire characters ko ek parity bit + control flag + payload se build karta hai; ek data character wire par 10 bits ka hota hai sirf leading parity+flag count karte huye, lekin payload 8 data bits hai jo 1 parity bit se protected hai, jo useful ratio deta hai. Efficiency accounting ke liye hum use karte hain: 8 data bits ko 1 parity bit protect karta hai → 9-bit effective data character.
SpaceWire mein parity odd parity hai jo previous character ke data bits aur current control/flag bit par compute ki jaati hai (interleaved parity). First-principles understanding ke liye, parity ko aise treat karo: "ek bit jo is liye choose ki gayi hai taaki protected group ki fixed parity ho."
Parity kyun? Cosmic rays se single-bit errors detect karta hai. Agar parity fail ho, receiver error state mein enter karta hai aur link re-establish hota hai.
Packet Structure aur Routing
Wormhole Routing Mechanism
Wormhole routing ek circuit establish karta hai jaise packet header propagate hota hai:
- Header byte switch par arrive hota hai → routing table se output port lookup karo
- Switch us output port ko reserve karta hai aur header byte forward karta hai
- Body bytes reserved path follow karte hain (switch unhe inspect nahi karta)
- EOP reserved path release karta hai
Latency formula:
jahaan = number of hops, = per-switch forwarding delay (~1 μs typical).
Yeh step kyun? Traditional store-and-forward poore packets buffer karta (har hop par delay add karta). Wormhole long packets ke liye latency ~10× cut karta hai.
Flow Control: Credit-Based BackPressure
SpaceWire buffer overflow rokne ke liye character-level flow control use karta hai:
- Har receiver ke paas N-character buffer hai, aur har FCT jo woh bhejta hai, woh 8 characters ki space ke liye credit grant karta hai.
- Sender sirf tab transmit karta hai jab uske paas credit ho, aur bhejte waqt decrement karta jaata hai.
- Receiver space free karne ke baad FCT (Flow Control Token) characters bhejta hai → sender ka credit replenish karta hai.
Radiation Tolerance aur Fault Handling
Link Reset aur Hot-Swap
SpaceWire links in states se progress karte hain: ErrorReset → ErrorWait → Ready → Started → Connecting → Run.
Timing ka key point: standard reset/wait intervals ko character (bit) times ki count mein specify karta hai, fixed microseconds mein nahi. Unki absolute duration isliye link bit rate ke saath scale karti hai — wahi character-count interval 10 Mbps se 200 Mbps par shorter hota hai.
- ErrorReset (power-on): ek fixed character-count interval ke liye dono lines ko reset par drive karo → purana state clear karo
- ErrorWait: ek fixed character-count interval wait karo (worst-case propagation se lamba choose kiya gaya) → ensure karo ki remote node bhi reset ho
- Ready: FCTs bhejo → buffer credits advertise karo
- Started: FCTs receive karo → confirm karo ki remote node alive hai
- Connecting: NULL/FCT pattern exchange karo → synchronize karo
- Run: normal operation
Yeh step kyun? Kyunki wait character times mein measure hota hai, ise isliye dimension karna hota hai ki uski worst-case absolute duration maximum cable propagation delay se zyada rahe — guarantee karta hai ki dono ends ek doosre ka reset observe karein aage badhne se pehle. Yeh poora bus power-cycle kiye bina failed units ki hot-swapping enable karta hai.
RMAP: Remote Memory Access Protocol
RMAP (Remote Memory Access Protocol) SpaceWire ke liye killer app hai — processors ko custom firmware ke bina remote nodes par registers aur memory read/write karne deta hai.
Command types:
- Read (0x08): Address A se N bytes request karo
- Write (0x09): Address A par N bytes write karo
- Read-Modify-Write (0x0A): Semaphores ke liye Atomic RMW
Packet structure:
[Destination] [Protocol ID=0x01] [Command] [Address] [Data] [CRC] [EOP]
Performance Calculations
Cable length vs. speed — asli reason:
Standard mein koi simple RC formula nahi hai. Practical cable length signal attenuation, jitter, aur inter-pair skew se limit hoti hai jaise data rate badhti hai. Faster rates → tighter timing budget → receiver ki edge sampling utna skew/jitter tolerate nahi kar sakti → shorter cables. Roughly: high rates (400 Mbps) → kuch metres; low rates (2–10 Mbps) → tens of metres. Curiosity ke cameras ~10 m par around 10 Mbps pe run karte hain; satellite backplanes 200 Mbps ~1–2 m par run karte hain.
Recall 12-saal ke bacche ko samjhao
Socho class mein notes pass kar rahe ho jab teacher (radiation) teri desk hilata rehta hai. Ek alag "tick-tock" clock line timing rakhne ki jagah, tum aur tumhara dost ek clever rule agree karte ho: har single beat par, exactly tumme se ek taali bajaata hai — ya toh "value hand" ya "timing hand" move karta hai, dono kabhi nahi, koi bhi kabhi nahi. Sirf dekh ke koi clap kiya, tumhara dost jaanta hai ek beat hua aur tumhari value padh sakta hai. Yahi hai Data-Strobe: do signals jahan exactly ek har bit par flip karta hai, isliye beat hamesha recoverable hai.
Ab socho das doston ko notes swap karne hain. Shor machate kamre mein cheekh-cheekh ke bolne ki jagah, har note ke aage address hota hai, aur har desk par ek "postmaster" sirf address padh ke turant next desk ki taraf point karta hai — poora note khole bina. Yahi hai wormhole routing: super fast kyunki koi poora message ka wait nahi karta.
Finally, tum ek dost ki choti si desk par 100 notes dump nahi kar sakte. Toh woh tumhe tickets deta hai — har ticket tumhe ek small batch bhejne deta hai. Jab woh space clear kare, aur tickets deta hai. Yahi hai credit-based flow control: koi kabhi bury nahi hota.
Connections
- LVDS Signaling — SpaceWire ke liye Physical layer differential pairs
- Wormhole Routing vs Store-and-Forward — Network switching architectures
- Cosmic Ray Effects on Electronics — Kyun radiation tolerance matter karta hai
- RMAP Protocol — SpaceWire memory access ke liye application layer
- MIL-STD-1553 — Purana avionics bus jo SpaceWire replace karta hai
- CAN Bus — Automotive equivalent (lower speed, alag fault model)
- Real-Time Determinism — Spacecraft ke liye bounded latency kyun matter karti hai
- Serial vs Parallel Communication — High-speed links mein fundamental tradeoff
#flashcards/coding