Imagine you're on a satellite 500 km above Earth. You have temperature readings, battery levels, and a freshly captured photo. You need to get all of it to a ground station. You only get a few minutes per pass, the link is noisy, and nobody can walk over and plug in a cable.

How do you package that data so the ground knows what each piece is?

Most space agencies and many commercial missions use standards from CCSDS (the Consultative Committee for Space Data Systems). Two of those standards handle the "packaging" step:

  • SPP: Space Packet Protocol
  • EPP: Encapsulation Packet Protocol

This post explains both with plain analogies, a few diagrams, and a small bit of Python. No space background needed.

🗺️ The big picture: it's a postal system

If you know networking, you already know layered protocols. CCSDS uses the same idea:

Application Layer → "What I want to send" | SPP / EPP → Put it in a labelled envelope | Data Link (TM/TC/AOS) → Load envelopes into a delivery truck | Physical (RF/Optical) → The road the truck drives on | Ground Station 

The analogy we'll use throughout:

Real world 📮 CCSDS 🛰️
Letter contents Application data
Envelope with a label Space Packet (SPP)
Label on the envelope APID
Delivery truck Transfer Frame (data link)
Separate lanes on the highway Virtual Channels
The road itself RF / optical link

💡 Remember: A Space Packet is not a Transfer Frame. Envelopes ride inside trucks. Many people mix these up.

You'll also hear about CCSDS "books":

  • 📗 Green Books explain the concepts and architecture (good for learning).
  • 📘 Blue Books are the official rules you implement against.

✉️ Part 1: The Space Packet

A Space Packet has two parts:

+------------------+--------------------------------------+ | Primary Header | Packet Data Field | | (6 bytes) | [optional secondary header] + data | +------------------+--------------------------------------+ 
  • The primary header is always exactly 6 bytes. It's the label on the envelope.
  • The packet data field holds your payload. It can also start with an optional secondary header, which the mission defines (timestamps are a common choice).

What's on the label?

Here are the 6 bytes (48 bits), broken down:

| Version | Type | Sec Hdr | APID | Seq Flags | Seq Count | Data Length | | 3 bits | 1 | 1 | 11 bits | 2 bits | 14 bits | 16 bits | 
Field What it means Analogy
Version (PVN) 000 means "this is a Space Packet" Envelope format
Type 0 = telemetry, 1 = telecommand Outgoing vs incoming mail
Sec Hdr Flag Is there a secondary header? "See attached note" checkbox
APID Which data stream this belongs to Department name on the label
Seq Flags Is this a whole message or part of one? "Part 2 of 5"
Seq Count Running number per APID Page number
Data Length Size of the data field, minus 1 Weight on the label

Packets are "self-delimiting"

The receiver never has to guess where a packet ends. The length field tells it:

Total Packet Length = 6 (header) + Packet Data Length + 1 

Example: Packet Data Length = 99 → 6 + 99 + 1 = 106 bytes.

Why the +1? A data field can never be empty, so the standard stores "length minus one". That lets 16 bits describe up to 65,536 bytes of data instead of 65,535.

Let's decode one in Python 🐍

import struct def parse_primary_header(data: bytes) -> dict: word1, word2, length = struct.unpack(">HHH", data[:6]) # big-endian return { "version": word1 >> 13, "type": "TC" if (word1 >> 12) & 1 else "TM", "has_sec_hdr": bool((word1 >> 11) & 1), "apid": word1 & 0x7FF, # lowest 11 bits "seq_flags": word2 >> 14, "seq_count": word2 & 0x3FFF, # lowest 14 bits "total_length": 6 + length + 1, } print(parse_primary_header(bytes.fromhex("0864C02A0063"))) # {'version': 0, 'type': 'TM', 'has_sec_hdr': True, 'apid': 100, # 'seq_flags': 3, 'seq_count': 42, 'total_length': 106} 

That's a telemetry packet on APID 100, number 42 in its stream, 106 bytes long. Once you see it as bit-shifting, the header isn't scary.

🏷️ Part 2: APID, the label that matters most

The APID (Application Process Identifier) is an 11-bit number, so it ranges from 0 to 2047.

Think of it like Slack channels or Kafka topics. It says which stream a packet belongs to, so the ground knows where to send it:

 Received Space Packet | Read the APID | Look up the mission's APID table | +----------+----------+ v v v APID 100 APID 101 APID 102 Thermal Battery Camera 
APID Example stream
100 Temperature telemetry
101 Battery telemetry
102 Camera data

These numbers are made-up examples. Each mission picks its own.

Things to keep in mind:

  • ✅ The mission decides what each APID means. CCSDS doesn't assign them.
  • ✅ APIDs only need to be unique within a naming domain, such as one spacecraft.
  • 🚫 APID 2047 (0x7FF) is reserved for Idle Packets, which are filler sent when there's nothing else to send.
  • ❌ An APID is not an IP address. It labels a stream; it doesn't route anything across a network.

🧱 Part 3: Two ways to use SPP

SPP can sit in two different places in the stack. A given path uses one or the other.

Option A: SPP as the application layer. Your flight software builds packets directly.

Application → SPP → Data Link → Physical 

Option B: SPP as a "shim". Something else (IP, UDP, Bundle Protocol) already made a packet, and SPP wraps it so it can travel over CCSDS links.

TCP / UDP / IP / BP → SPP (shim) → Data Link → Physical 

A shim is a thin adapter layer, like a travel plug adapter. Your device is unchanged; the adapter just makes it fit a different socket.

Two quick terms:

  • SDU (Service Data Unit): what you hand to a protocol.
  • PDU (Protocol Data Unit): what the protocol produces, with its header added.

Wrapping one protocol's PDU inside another is called encapsulation, which is the Russian-doll idea behind most networking.

📦 Part 4: What SPP promises (and what it doesn't)

Applications talk to SPP through a Service Access Point (SAP), which works like a mail slot. SPP offers two services:

Service You hand over… SPP does…
Packet Service A fully built Space Packet Sends it unchanged
Octet String Service Raw bytes Builds the Space Packet for you

If you've used UDP, SPP's behaviour will feel familiar. It is:

Property Meaning
Preconfigured Paths are set up in advance by mission management
Unidirectional One direction per path
Asynchronous Send whenever you want
Unconfirmed No "delivered!" receipt
Incomplete Packets can be lost, and nothing retransmits them
Not sequence-preserving Packets may arrive out of order end to end
No flow control Not defined between the user and SPP

Two-way communication means two separate one-way paths:

Spacecraft Ground |---- Telemetry (TM) ------>| |<--- Telecommand (TC) -----| 

💡 Mental model: SPP is the post office's basic service. It labels and sends your letter, but it doesn't promise delivery or send a receipt.

🔢 Part 5: Detecting lost packets

So how do you know a packet went missing? Use the Packet Sequence Count.

  • 14-bit counter, range 0 to 16383
  • Counted separately per APID
  • Wraps back to 0 after 16383

Think of numbered pages in a book. If you go from page 101 to page 103, page 102 is missing.

Satellite Ground |---- Seq 100 ----------->| ✓ |---- Seq 101 ----------->| ✓ |---- Seq 102 -----X | ✗ lost |---- Seq 103 ----------->| ✓ | "Gap: 101 → 103!" ...but SPP won't resend it. 

SPP lets you detect a gap. It does not fix it. For recovery you add other mechanisms:

Mechanism What it gives you
Sequence Count Spot possible gaps
COP-1 Reliable delivery of telecommand frames
CFDP File delivery, with optional reliability
Command ACK Mission-defined confirmation of command status

📸 Part 6: A real-world walkthrough

Let's follow one command from start to finish: "Take a picture."

GROUND: "Capture image" command | SPP packet (APID 200) | TC Uplink ⬆️ | SATELLITE: camera takes the picture | +------+------+ v v Command ACK Image data (APID 201) (APID 300) +------+------+ | TM Downlink ⬇️ | GROUND: check status + rebuild the image 

Some points that trip people up:

  • 📨 SPP carries the command; it doesn't execute it. Flight software does that.
  • 🚚 TC/TM (data link) is what physically moves packets across the space link.
  • ⚠️ "The link delivered my packet" is not the same as "the satellite executed my command." You need a mission-level ACK to know the second one.
  • 🧩 SPP won't reassemble the image for you. Your ground software does.

🎁 Part 7: EPP, the gift-wrap for other protocols

What if you already have a packet from another protocol, like a CFDP file-transfer PDU or an IP packet, and you want to send it over CCSDS links?

That's what EPP (Encapsulation Packet Protocol) is for. Think of it as gift wrap: it adds an outer layer with a label, and the gift inside stays exactly as it was.

 CFDP PDU (the gift 🎁) | EPP → +-------------+ | EPP Header | ← the wrapping + tag +-------------+ | CFDP PDU | ← unchanged +-------------+ | Space Data Link (TM/TC/AOS) 

EPP rules:

  • One PDU per EPP packet. No bundling.
  • The inner PDU is never modified.
  • No automatic retransmission. Same as SPP.

How does the receiver tell SPP from EPP?

The first 3 bits, the Packet Version Number (PVN):

PVN Packet type
000 Space Packet (SPP)
111 Encapsulation Packet (EPP)

It works like a file's "magic number": read the first bits and you know how to parse the rest.

The EPP header is stretchy

Unlike SPP's fixed 6 bytes, an EPP header can be 1, 2, 4, or 8 bytes long. The first byte says which:

+---------+-------------+--------+ | PVN | Protocol ID | LID | | 3 bits | 3 bits | 2 bits | +---------+-------------+--------+ 
LID Header size
00 1 byte
01 2 bytes
10 4 bytes
11 8 bytes
  • Protocol ID / EPI tells the receiver which protocol is inside (for example, "this is CFDP").
  • EPP doesn't use APIDs. It identifies its user by combining PVN + EPI + data link channel.

The decoding steps on the ground:

Check PVN → Decode LID → Read header length → Read packet length → Identify protocol (EPI) → Extract original PDU → Hand to CFDP/IP handler 

SPP vs EPP at a glance

SPP EPP
Main job Package application data Wrap existing protocol PDUs
Can act as a shim? Yes Yes (its main role)
PVN 000 111
Header Fixed 6 bytes 1, 2, 4, or 8 bytes
Uses APID? Yes No
Max size 65,536-byte data field ~4.29 GB

🤔 Part 8: Which one should I use?

 What are you sending? | +---------+---------+ | | Your own app data An existing PDU (telemetry, etc.) (CFDP, IP, ...) | | SPP Consider EPP 
You need… Use
Housekeeping telemetry SPP
Your own application data SPP
Streams identified by APID SPP
CFDP PDUs EPP
IP packets EPP
Carry an existing protocol's PDUs EPP or SPP as a shim

You can use both in the same mission. It's common, and neither one does routing or retransmission.

🛡️ Part 9: Reliability, big files, and long delays

SPP and EPP move packets. Other protocols handle the harder jobs:

Problem Tool Analogy
Regular telemetry SPP Postcards
Reliable file transfer CFDP (acknowledged mode) Registered mail with tracking
Very long delays (deep space) LTP Mail that expects slow replies
Keep traffic types apart Virtual Channels Separate highway lanes
Links that keep dropping DTN / Bundle Protocol Store-and-forward relay stations
Urgent telemetry first High-priority Virtual Channel Express lane

⏱️ SPP and EPP make no real-time promise. They don't guarantee a maximum delivery time.

Sending a big image

A large image won't fit in one packet, so you split it into segments:

 Large Image | Split into segments +---+---+ v v v Pkt1 Pkt2 Pkt3 → Ground → Reassemble 
  • SPP's Sequence Flags mark the first, middle, and last segments.
  • A secondary header can carry mission-defined segment info.
  • Your application does the reassembly, not SPP.

🌍 Part 10: The whole system, end to end

Here's everything together:

 SPACECRAFT +---------+---------+ Housekeeping Image File | | SPP CFDP | | | EPP +---------+---------+ | CCSDS Data Link (TM / AOS / USLP) | Transfer Frames | Channel Coding | RF Downlink 📡 | GROUND SYSTEM | Frame Processing +-------+-------+ SPP Decoder EPP Decoder | | Telemetry CFDP Receiver Processor | Image File 🖼️ 

Who does what

Component Job
Application Creates and interprets mission data
SPP Packages and labels application data
EPP Wraps other protocols' PDUs
APID Identifies a packet stream
Virtual Channel Organizes traffic on the data link
Transfer Frame Carries packets across the space link
CFDP Delivers files, optionally with recovery
Physical Layer Sends and receives the actual signal

🧠 Cheat sheet: 7 rules to remember

  1. Space Packet ≠ Transfer Frame. Envelopes ride inside trucks.
  2. APID labels packet streams; VCID labels data link channels. Different layers, different IDs.
  3. SPP/EPP don't route. They label and package.
  4. SPP/EPP don't guarantee delivery or retransmit. Add CFDP, COP-1, etc. when you need that.
  5. "Packet delivered" ≠ "command executed." Use mission-level ACKs.
  6. The mission defines APIDs, command formats, and telemetry formats.
  7. For real implementation work, read the CCSDS Blue Books.

🚀 Wrapping up

The whole flow fits in one line:

Application → Packet Protocol → Data Link → Physical Link → Ground Processing

Each layer has one job. Most confusing satellite comms bugs come from expecting a layer to do something it was never designed to do, like assuming SPP retransmits, or treating an APID as a network address. Once those boundaries are clear, debugging gets much easier.

If you write flight software or ground systems, or you're just curious how satellites talk, I hope this made CCSDS packets feel approachable. 🛰️

Questions or corrections? Leave a comment below. 👇