5.5.27 · HinglishEmbedded Systems & Real-Time Software

SpaceWire — high-speed serial link standard for spacecraft

3,367 words15 min readRead in English

5.5.27 · Coding › Embedded Systems & Real-Time Software

SpaceWire Actually Hai Kya

Core Architecture Components

  1. Physical Layer: LVDS differential pairs (Data + Strobe signals), low power (~10 mW per link)
  2. Character Layer: 8-bit data bytes + parity bit, Data-Strobe transitions ke roop mein encoded
  3. Packet Layer: Variable-length packets with destination address, data payload, EOP/EEP markers
  4. Network Layer: Wormhole-routed switching fabric (header propagate hone ke saath packets path establish karte hain)
Figure — SpaceWire — high-speed serial link standard for spacecraft

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:

  1. Header byte switch par arrive hota hai → routing table se output port lookup karo
  2. Switch us output port ko reserve karta hai aur header byte forward karta hai
  3. Body bytes reserved path follow karte hain (switch unhe inspect nahi karta)
  4. 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

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.

  1. ErrorReset (power-on): ek fixed character-count interval ke liye dono lines ko reset par drive karo → purana state clear karo
  2. ErrorWait: ek fixed character-count interval wait karo (worst-case propagation se lamba choose kiya gaya) → ensure karo ki remote node bhi reset ho
  3. Ready: FCTs bhejo → buffer credits advertise karo
  4. Started: FCTs receive karo → confirm karo ki remote node alive hai
  5. Connecting: NULL/FCT pattern exchange karo → synchronize karo
  6. 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

SpaceWire Data-Strobe encoding mein, har bit period par kya guarantee hota hai, aur clock kaise recover hoti hai?
Exactly ONE of the do lines (Data ya Strobe) har bit period mein toggle karta hai; Strobe exactly tab toggle karta hai jab Data nahi karta. Data aur Strobe ki transition activity ko XOR karne se clock regenerate hoti hai, aur Data ko har recovered edge par sample kiya jaata hai. Koi alag clock wire nahi hai.
SpaceWire Data-Strobe alag clock line ki jagah kyun use karta hai?
Ek alag clock line cables ke across data ke against drift/skew karta hai (thermal expansion, radiation). DS guarantee karta hai ki kahin na kahin har bit mein ek transition ho, isliye timing do wires se self-generated hai — no clock skew, better radiation tolerance.
Byte 0xA7 (1010 0111) ke liye, saare aath bits ka XOR kya hai aur kitne ones hain?
Bits = 1,0,1,0,0,1,1,1 → paanch ones (odd) → saare 8 bits ka XOR = 1. (Saare aath bits XOR karne chahiye, chhe nahi.)
SpaceWire data character mein 8 data bits protect karne ke liye kitne bits hain, aur payload efficiency kya hai?
1 parity bit 8 data bits ko protect karta hai → 9-bit effective data character → efficiency = 8/9 ≈ 88.9% (roughly 11.1% overhead), 80% NAHI.
200 Mbps signaling par SpaceWire effective throughput 8/9 rule se compute karo.
T = (8/9) × 200 ≈ 177.8 Mbps ≈ 22.2 MB/s.
10 m SpaceWire cable ka ~2×10^8 m/s par round-trip time kya hai, aur yeh kyun matter karta hai?
One-way ≈ 50 ns/m → 10 m ke liye ~500 ns → RTT ≈ 1 μs. Credits ko is RTT ke dauran in-flight bytes cover karne chahiye link full rakhne ke liye, isliye lambe cables ko zyada outstanding credit/buffer chahiye.
FCT kya hai aur yeh kitna credit grant karta hai?
Flow Control Token ek SINGLE control character (kuch DS bit-times) hai. Har FCT sender ko 8 data characters ka credit grant karta hai — yeh 10 bytes NAHI hai.
SpaceWire startup/reset intervals fixed microsecond values kyun nahi hain?
Yeh character (bit) times ki count mein define hote hain, isliye unki absolute duration link bit rate ke saath scale karti hai — wahi interval 200 Mbps par 10 Mbps se shorter hota hai.
Data rate badhne par SpaceWire cable length ko actually kya limit karta hai?
Signal attenuation, jitter, aur inter-pair skew receiver ka timing margin shrink karte hain — koi simple RC formula NAHI. Higher rates → tighter timing budget → shorter cables.
RMAP kya hai aur yeh kaunsa problem solve karta hai?
Remote Memory Access Protocol — processors ko SpaceWire par remote nodes par registers aur memory read/write karne deta hai bina custom per-device firmware ke (Read 0x08, Write 0x09, RMW 0x0A), network across memory-mapped I/O standardize karta hai.

Concept Map

motivates

too heavy and slow

uses

structured as

physical layer

character layer

network layer

carries

guarantees

enables

avoids

routes

provides

Spacecraft constraints: radiation, mass, power, reliability

SpaceWire serial link

Old parallel buses MIL-STD-1553

LVDS differential pairs

Layered architecture

Data-Strobe encoding

Wormhole switches

One edge per bit

Recovered clock = Data XOR Strobe

No clock wire, no skew

Packets with EOP/EEP markers

Flow control and error detection