Expedite packets
Expedite is the modem software at the ground station. When it decodes a frame from your spacecraft, it puts the frame's data in an Expedite packet: a short envelope with a start marker, a length, a type, a time tag and a checksum in front of the data, and an end marker after it. Umoja relays these packets to you exactly as the modem wrote them, so the telemetry you receive is an Expedite packet with your spacecraft's bytes inside.
spacecraft --radio frame--> station modem --Expedite packet--> Umoja --> you
decodes the frame, relays it
wraps its data unchanged
This page shows how to take the envelope off. You never wrap a telecommand yourself: you send the payload only and the station wraps it. See Sending a telecommand.
Where you receive packets
| Where | What it carries |
|---|---|
WebSocket telemetry |
One telemetry packet (type 0x00) per message. |
WebSocket command |
Per message, either your telecommand as the station handed it to the modem (type 0x01) or the modem's acknowledgement of it (type 0x02). |
WebSocket antenna, ephemeris |
One antenna-angle packet (type 0x03) per message. |
WebSocket doppler |
One predicted-Doppler packet (type 0x06) per message. |
TT&C archive, frame_b64 |
One complete packet (0x00, 0x01 or 0x02). See Replaying a session. |
Replay chunks antenna, ephemeris, doppler |
Each record's payload is one packet (0x03, 0x03, 0x06). |
Mission files .tm, and .trk, .ant, .dop when the station records them |
Complete packets back to back (0x00, 0x03, 0x03, 0x06), with no file header. |
portal-link tm, command, antenna, ephemeris, doppler |
Complete packets back to back on the TCP stream. See portal-link. |
TCP bridge tm, command, antenna, ephemeris, doppler, ext_antenna, ext_doppler |
One packet per frame, for your own bridge client. See TCP bridge protocol. |
spectrum and constellation carry float arrays, not Expedite packets, and
.iq files are raw samples. Neither is covered here.
A pass folder normally has a .tm file when telemetry was decoded. The
.dop, .trk and .ant files exist only if the station is set to record
them. The date and time in a mission file's name are the station's local
time, which need not be UTC. Take times from the time tags inside the file.
The packet
Layout
Every packet has the same frame. All multi-byte fields are little-endian, so
0xA1B2C3D4 arrives as D4 C3 B2 A1.
offset size field
0 4 preamble 0xA1B2C3D4, bytes D4 C3 B2 A1
4 4 length of the whole packet, preamble to postamble
8 4 message type
12 n body, which depends on the type
12+n 4 CRC-32 Expedite's own variant, over bytes 0 to 11+n
16+n 4 postamble 0x5E4D3C2B, bytes 2B 3C 4D 5E
The preamble and postamble are fixed markers for the start and end of a packet, so a receiver that joins a byte stream part way through can find where the next packet begins. The CRC (cyclic redundancy check) is a checksum over everything before it: recompute it, and a mismatch means the packet was damaged or cut on the way.
The length counts every byte of the packet, header and trailer included, so the shortest packet is 20 bytes.
Message types
| Type | Packet | Size in bytes | Where you meet it |
|---|---|---|---|
0x00 |
Telemetry | 44 + data | telemetry, portal-link tm, .tm files, archive |
0x01 |
Telecommand, as the station handed it to the modem | 20 + payload | command, archive |
0x02 |
Telecommand acknowledgement | 32 + echo | command, archive |
0x03 |
Antenna angles | 44 | antenna and .ant (the rotator), ephemeris and .trk (predicted) |
0x06 |
Predicted Doppler | 48 | doppler, .dop |
Every type in this table except 0x01 carries an 8-byte time tag at offset
12.
Types 0x04, 0x05, 0x07 and 0x08 are used only for external antenna
control and external Doppler, the one place where you write packets
yourself, with the layout above and the CRC below: on
portal-link's external antenna and Doppler ports, or on the TCP bridge's
ext_antenna and ext_doppler streams from your own client, one packet per
frame. See
External antenna control and external Doppler
and TCP bridge protocol.
The time tag
The time tag is 8 bytes, each holding two decimal digits in
binary-coded decimal (BCD): the high four bits are the tens and the low
four bits the units, so 0x56 means 56.
| Byte | Offset | Holds |
|---|---|---|
| 0 | 12 | Years since 1900. The tens digit can go above 9: 2026 is 126, written 0xC6 (12 tens, 6 units). |
| 1 | 13 | Day of the year modulo 100. |
| 2 | 14 | Day of the year divided by 100. |
| 3 | 15 | Hour. |
| 4 | 16 | Minute. |
| 5 | 17 | Second. |
| 6 | 18 | Millisecond divided by 10. |
| 7 | 19 | Millisecond modulo 10. |
The day of the year counts from zero: 1 January is day 0. So
C6 06 03 12 34 56 78 09 is year 126 + 1900 = 2026, day 3 × 100 + 6 = 306,
which is 3 November, 12:34:56 and 78 × 10 + 9 = 789 ms.
The time is UTC, taken from the station's clock when the modem wrapped the
packet. That is shortly after the frame was decoded, not the moment the
signal arrived, and it is not your spacecraft's onboard time. It is only as
accurate as the station's clock, which can be off. To line archived frames up
with other data, use the archive's at; see
Replaying a session.
Telemetry (0x00)
| Offset | Size | Field |
|---|---|---|
| 0 | 4 | preamble |
| 4 | 4 | length, 44 + N |
| 8 | 4 | type 0x00 |
| 12 | 8 | time tag |
| 20 | 4 | NORAD catalogue number, u32 |
| 24 | 4 | slant range in km, f32 |
| 28 | 4 | azimuth in degrees, f32 |
| 32 | 4 | elevation in degrees, f32 |
| 36 | N | data: your spacecraft's bytes |
| 36 + N | 4 | CRC |
| 40 + N | 4 | postamble |
Bytes 20 to 35 come from the station, not from your spacecraft: the satellite the station is tracking and its predicted look angles to it, from the latest tracking step of the pass. All four are zero when no pass is being tracked. Some stations write the NORAD number as a float32 instead. Read it as a u32, and if that gives 0x3F800000 (1,065,353,216) or more, which no NORAD number reaches, read the same four bytes as a float32. The code below does this.
N is at least 1. Packets carry no sequence number, so use your spacecraft's own counters to spot a gap.
Telecommand (0x01)
| Offset | Size | Field |
|---|---|---|
| 0 | 4 | preamble |
| 4 | 4 | length, 20 + N |
| 8 | 4 | type 0x01 |
| 12 | N | payload |
| 12 + N | 4 | CRC |
| 16 + N | 4 | postamble |
There is no time tag. The payload is the command as you sent it. You see this
packet on the command stream and in the archive once the station has handed
your command to the modem. That is not proof that the modem accepted it: the
acknowledgement is.
Telecommand acknowledgement (0x02)
| Offset | Size | Field |
|---|---|---|
| 0 | 4 | preamble |
| 4 | 4 | length, 32 + N |
| 8 | 4 | type 0x02 |
| 12 | 8 | time tag |
| 20 | 4 | status, u32 |
| 24 | N | echo |
| 24 + N | 4 | CRC |
| 28 + N | 4 | postamble |
| Status | Meaning | Echo |
|---|---|---|
0 |
The modem accepted the command and queued it for the transmitter. | your payload |
1 |
The modem received the command damaged: its length or CRC did not match. Nothing was transmitted. See Troubleshooting. | the whole packet as the modem received it, preamble to postamble |
2 |
The command does not fit the configured error-correction code. Nothing was transmitted. | your payload |
3 |
The modem's data format for this satellite (command.data) refused the command. Nothing was transmitted. |
your payload |
Status 0 is the modem's answer, not the spacecraft's: it says the command
was queued to go out, not that it was transmitted or received on board.
An acknowledgement carries no command id. Match it to what you sent by its
echo. The telecommand packet (0x01) and its acknowledgement can arrive in
either order.
Antenna angles (0x03) and predicted Doppler (0x06)
Both have a fixed size and layout:
0x03, 44 bytes 0x06, 48 bytes
offset field offset field
12 time tag 12 time tag
20 status u32: on ephemeris, 20 Doppler in Hz, f32, normalised
0 tracking, 1 parked; on to a 100 MHz carrier (for its
antenna, always 0 sign, see below)
24 satellite id u32, always 0 24 NORAD number, u32
28 azimuth in degrees, f32 28 slant range in km, f32
32 elevation in degrees, f32 32 altitude in km, f32
36 CRC 36 elevation in degrees, f32
40 postamble 40 CRC
44 postamble
On the antenna stream and in .ant files, 0x03 is where the rotator
reports it is pointing. On ephemeris and in .trk files it is where the
station predicts the satellite to be. Read the NORAD number in 0x06 as in
Telemetry.
The Doppler value follows the sign of the range rate: it is positive while the satellite moves away, so it is the negative of the frequency shift you receive. At your own carrier, the shift you receive is −value × (carrier frequency / 100 MHz).
The CRC
The CRC is Expedite's own variant of CRC-32:
crc = 0xFFFFFFFF
for each byte b, from the preamble to the last byte before the CRC:
crc = crc XOR b
repeat 8 times:
if crc is odd: crc = (crc >> 1) XOR 0x04C11DB7
else: crc = crc >> 1
crc = crc XOR 0xFFFFFFFF
It is stored little-endian in the four bytes before the postamble.
It is not the standard CRC-32. zlib.crc32, binascii.crc32, Java's
CRC32 and most JavaScript CRC libraries give different values, so use the
few lines above. To test an implementation: the Expedite CRC of the ASCII
string 123456789 is 0xFC4F2BE9, while the standard CRC-32 of it is
0xCBF43926.
The CRC protects the packet between the station and you. It says nothing about whether the radio frame was received cleanly, so keep a check of your own in your spacecraft's data.
Finding packets in a byte stream
Nothing inside a packet is escaped. The preamble and postamble bytes can occur in the data, in the time tag or in the CRC, so a marker alone does not prove a packet starts or ends there.
To read packets from a stream, frame them by their length and then confirm:
- Find the preamble,
D4 C3 B2 A1. Drop anything before it. - Read the length at bytes 4 to 7. If it is below 20 or above 16428, this was
not a real preamble: drop one byte and search again. No packet from the
modem is longer than 16428 bytes. The one longer packet you can see is the
copy, on
command, of a telecommand longer than 16368 bytes, which the modem never transmits; keep telecommands within that limit. - Wait until you hold that many bytes. If the input ends first, this was not a real packet: drop one byte and search again.
- Check that the last four are the postamble and that the CRC matches.
- If both hold, that is a packet: take it and carry on after it. If not, drop one byte and search again.
Never end a packet at the first postamble you see. Telemetry data contains
2B 3C 4D 5E whenever your spacecraft happens to send those bytes.
Decoding packets
The CRC, time-tag, parse_packet and iter_packets blocks build on each
other: paste them into one file in order, then add the blocks under
Test packets to check it. The file, socket and WebSocket
examples are templates: put in your own file name, port, station and token
before you run them. The Python needs 3.10 or later and nothing outside the
standard library, except the WebSocket client.
Python
The CRC:
import struct
import zlib
PREAMBLE = 0xA1B2C3D4
POSTAMBLE = 0x5E4D3C2B
def expedite_crc32(data: bytes) -> int:
"""The CRC in every Expedite packet. It is not zlib.crc32."""
crc = 0xFFFFFFFF
for byte in data:
crc ^= byte
for _ in range(8):
crc = ((crc >> 1) ^ 0x04C11DB7) if crc & 1 else (crc >> 1)
return crc ^ 0xFFFFFFFF
print(hex(expedite_crc32(b"123456789"))) # Expedite
print(hex(zlib.crc32(b"123456789"))) # standard CRC-32, not what Expedite uses
It prints:
0xfc4f2be9
0xcbf43926
The time tag:
from datetime import datetime, timedelta, timezone
def _bcd(byte: int) -> int:
return (byte >> 4) * 10 + (byte & 0x0F)
def decode_time_tag(tag: bytes) -> datetime:
"""Packet bytes 12-19, as a UTC datetime."""
year = 1900 + _bcd(tag[0])
day_index = _bcd(tag[2]) * 100 + _bcd(tag[1]) # 1 January is 0
return datetime(year, 1, 1, tzinfo=timezone.utc) + timedelta(
days=day_index,
hours=_bcd(tag[3]),
minutes=_bcd(tag[4]),
seconds=_bcd(tag[5]),
milliseconds=_bcd(tag[6]) * 10 + _bcd(tag[7]),
)
print(decode_time_tag(bytes.fromhex("c6 06 03 12 34 56 78 09")).isoformat(timespec="milliseconds"))
It prints:
2026-11-03T12:34:56.789+00:00
One packet, unwrapped. It raises ValueError for bytes that are not a
packet, and reports a CRC mismatch as crc_ok rather than raising, so you
can decide what to do with a damaged packet:
NO_TIME_TAG = {0x01, 0x07}
MIN_LENGTH = {0x00: 44, 0x02: 32, 0x03: 44, 0x06: 48} # the types decoded below
def _norad(body: bytes, offset: int) -> int:
raw, = struct.unpack_from("<I", body, offset)
if raw >= 0x3F800000: # too large for a NORAD number: the field is a float32
return round(struct.unpack_from("<f", body, offset)[0])
return raw
def parse_packet(packet: bytes) -> dict:
"""Unwrap one complete Expedite packet."""
if len(packet) < 20:
raise ValueError("shorter than the smallest packet (20 bytes)")
preamble, length, msg_type = struct.unpack_from("<III", packet, 0)
if preamble != PREAMBLE:
raise ValueError("no preamble at byte 0")
if length != len(packet):
raise ValueError(f"length field says {length} bytes, got {len(packet)}")
crc, postamble = struct.unpack_from("<II", packet, length - 8)
if postamble != POSTAMBLE:
raise ValueError("no postamble at the end")
smallest = MIN_LENGTH.get(msg_type, 20 if msg_type in NO_TIME_TAG else 28)
if length < smallest:
raise ValueError(f"a type {msg_type:#04x} packet has at least {smallest} bytes, got {length}")
body = packet[12:length - 8]
out = {"type": msg_type, "length": length,
"crc_ok": crc == expedite_crc32(packet[:length - 8])}
if msg_type not in NO_TIME_TAG:
out["time"] = decode_time_tag(body[0:8])
if msg_type == 0x00: # telemetry
slant, azimuth, elevation = struct.unpack_from("<fff", body, 12)
out.update(norad_id=_norad(body, 8), slant_km=slant, azimuth_deg=azimuth,
elevation_deg=elevation, data=body[24:])
elif msg_type == 0x02: # telecommand acknowledgement
out["status"], = struct.unpack_from("<I", body, 8)
out["data"] = body[12:] # the echo
elif msg_type == 0x03: # antenna angles
out["status"], _, out["azimuth_deg"], out["elevation_deg"] = (
struct.unpack_from("<IIff", body, 8))
elif msg_type == 0x06: # predicted Doppler
doppler, slant, altitude, elevation = struct.unpack_from("<f4xfff", body, 8)
out.update(doppler_hz_at_100mhz=doppler, norad_id=_norad(body, 12),
slant_km=slant, altitude_km=altitude, elevation_deg=elevation)
else: # the rest, telecommands included: what follows the header
out["data"] = body[8:] if msg_type not in NO_TIME_TAG else body
return out
Reading a stream, a file or a socket
A WebSocket message and an archived frame_b64 each hold exactly one packet,
so parse_packet is enough for them. A mission file and a portal-link port
are byte streams with packets back to back, and a read from them can end in
the middle of a packet. This splitter follows the rules in
Finding packets in a byte stream:
import itertools
MAX_PACKET = 16428
def iter_packets(chunks):
"""Yield whole packets from byte chunks: a file read in blocks, a TCP stream."""
buf = bytearray()
for chunk in itertools.chain(chunks, [None]): # None: the input has ended
ended = chunk is None
if not ended:
buf += chunk
while True:
start = buf.find(b"\xd4\xc3\xb2\xa1")
if start < 0:
del buf[:-3] # keep a preamble that may be split across chunks
break
del buf[:start]
if len(buf) < 8:
break
length = int.from_bytes(buf[4:8], "little")
if not 20 <= length <= MAX_PACKET:
del buf[:1] # not a real preamble: search again one byte on
continue
if len(buf) < length:
if not ended:
break # wait for the rest
del buf[:1] # the input ended first: not a real packet
continue
packet = bytes(buf[:length])
crc = int.from_bytes(packet[-8:-4], "little")
if packet[-4:] == b"\x2b\x3c\x4d\x5e" and crc == expedite_crc32(packet[:-8]):
yield packet
del buf[:length]
else:
del buf[:1]
Feeding it a mission file and portal-link's tm port:
import socket
with open("pass.tm", "rb") as f:
for packet in iter_packets(iter(lambda: f.read(65536), b"")):
p = parse_packet(packet)
print(p["time"].isoformat(timespec="milliseconds"), len(p["data"]))
with socket.create_connection(("localhost", 10025)) as tm:
for packet in iter_packets(iter(lambda: tm.recv(65536), b"")):
p = parse_packet(packet)
print(p["time"].isoformat(timespec="milliseconds"), p["data"].hex())
From the WebSocket
With the websockets package
(pip install websockets), authenticating as
WebSockets (realtime)
describes:
import asyncio
import websockets
URL = "wss://umoja.remosspace.com/ws/realtime?stream=telemetry&station_id=<station-uuid>"
async def watch(access_token: str) -> None:
async with websockets.connect(URL, subprotocols=["bearer", access_token]) as ws:
async for message in ws:
if isinstance(message, str): # the "ready" frame
print(message)
continue
p = parse_packet(message) # one message, one packet
print(p["time"].isoformat(timespec="milliseconds"), p["crc_ok"], p["data"].hex())
asyncio.run(watch("<access token>"))
JavaScript
The same in JavaScript, for a browser or Node 18 and later. packet is a
Uint8Array holding one whole packet:
const PREAMBLE = 0xa1b2c3d4;
const POSTAMBLE = 0x5e4d3c2b;
// The CRC in every Expedite packet. It is not the standard CRC-32.
function expediteCrc32(bytes) {
let crc = 0xffffffff;
for (const byte of bytes) {
crc ^= byte;
for (let i = 0; i < 8; i++) {
crc = crc & 1 ? (crc >>> 1) ^ 0x04c11db7 : crc >>> 1;
}
}
return (crc ^ 0xffffffff) >>> 0;
}
const bcd = (b) => (b >> 4) * 10 + (b & 0x0f);
function decodeTimeTag(t) {
const year = 1900 + bcd(t[0]);
const dayIndex = bcd(t[2]) * 100 + bcd(t[1]); // 1 January is 0
const ms = bcd(t[6]) * 10 + bcd(t[7]);
return new Date(Date.UTC(year, 0, 1 + dayIndex, bcd(t[3]), bcd(t[4]), bcd(t[5]), ms));
}
function parsePacket(packet) {
const view = new DataView(packet.buffer, packet.byteOffset, packet.byteLength);
if (packet.length < 20 || view.getUint32(0, true) !== PREAMBLE) {
throw new Error("not an Expedite packet");
}
const length = view.getUint32(4, true);
if (length !== packet.length) {
throw new Error(`length field says ${length} bytes, got ${packet.length}`);
}
if (view.getUint32(length - 4, true) !== POSTAMBLE) {
throw new Error("no postamble at the end");
}
const type = view.getUint32(8, true);
const hasTimeTag = type !== 0x01 && type !== 0x07;
const smallest = { 0x00: 44, 0x02: 32, 0x03: 44, 0x06: 48 }[type] ?? (hasTimeTag ? 28 : 20);
if (length < smallest) {
throw new Error(`a type ${type} packet has at least ${smallest} bytes, got ${length}`);
}
const out = {
type,
length,
crcOk: view.getUint32(length - 8, true) === expediteCrc32(packet.subarray(0, length - 8)),
};
const norad = (offset) => {
const raw = view.getUint32(offset, true);
return raw >= 0x3f800000 ? Math.round(view.getFloat32(offset, true)) : raw; // float32 on some stations
};
if (hasTimeTag) out.time = decodeTimeTag(packet.subarray(12, 20));
if (type === 0x00) {
out.noradId = norad(20);
out.slantKm = view.getFloat32(24, true);
out.azimuthDeg = view.getFloat32(28, true);
out.elevationDeg = view.getFloat32(32, true);
out.data = packet.subarray(36, length - 8);
} else if (type === 0x02) {
out.status = view.getUint32(20, true);
out.data = packet.subarray(24, length - 8); // the echo
} else if (type === 0x03) {
out.status = view.getUint32(20, true);
out.azimuthDeg = view.getFloat32(28, true);
out.elevationDeg = view.getFloat32(32, true);
} else if (type === 0x06) {
out.dopplerHzAt100MHz = view.getFloat32(20, true);
out.noradId = norad(24);
out.slantKm = view.getFloat32(28, true);
out.altitudeKm = view.getFloat32(32, true);
out.elevationDeg = view.getFloat32(36, true);
} else {
out.data = packet.subarray(hasTimeTag ? 20 : 12, length - 8);
}
return out;
}
const fromHex = (s) => Uint8Array.from(s.replace(/\s+/g, "").match(/../g) ?? [], (h) => parseInt(h, 16));
const toHex = (bytes) => Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join(" ");
console.log(expediteCrc32(new TextEncoder().encode("123456789")).toString(16));
const tm = parsePacket(fromHex(
"d4c3b2a1 30000000 00000000 c6060312 34567809 c8630000" +
"00509a44 00003443 00003442 cafebabe 1e6a3bff 2b3c4d5e",
));
console.log(tm.time.toISOString(), tm.noradId, tm.slantKm, tm.azimuthDeg, tm.elevationDeg, toHex(tm.data));
It prints:
fc4f2be9
2026-11-03T12:34:56.789Z 25544 1234.5 180 45 ca fe ba be
Receiving in a browser, with the subprotocol login from WebSockets (realtime):
const ws = new WebSocket(
"wss://umoja.remosspace.com/ws/realtime?stream=telemetry&station_id=<station-uuid>",
["bearer", accessToken],
);
ws.binaryType = "arraybuffer";
ws.onmessage = (event) => {
if (typeof event.data === "string") return; // the "ready" frame
const p = parsePacket(new Uint8Array(event.data)); // one message, one packet
console.log(p.time.toISOString(), p.crcOk, toHex(p.data));
};
Test packets
Four packets to test a decoder against: a telemetry packet with four bytes of spacecraft data, a second one whose data holds both markers, a telecommand and its acknowledgement.
TM = bytes.fromhex(
"d4 c3 b2 a1 30 00 00 00 00 00 00 00 c6 06 03 12"
"34 56 78 09 c8 63 00 00 00 50 9a 44 00 00 34 43"
"00 00 34 42 ca fe ba be 1e 6a 3b ff 2b 3c 4d 5e")
TM_MARKERS = bytes.fromhex(
"d4 c3 b2 a1 34 00 00 00 00 00 00 00 c6 06 03 12"
"34 57 00 00 c8 63 00 00 00 40 9a 44 00 80 35 43"
"00 00 36 42 2b 3c 4d 5e d4 c3 b2 a1 6b 1a 4e fc"
"2b 3c 4d 5e")
TC = bytes.fromhex(
"d4 c3 b2 a1 18 00 00 00 01 00 00 00 01 02 03 04"
"42 8c 67 f8 2b 3c 4d 5e")
ACK = bytes.fromhex(
"d4 c3 b2 a1 24 00 00 00 02 00 00 00 c6 06 03 12"
"35 00 12 00 00 00 00 00 01 02 03 04 48 39 66 f9"
"2b 3c 4d 5e")
tm = parse_packet(TM)
print(tm["time"].isoformat(timespec="milliseconds"), tm["norad_id"], tm["slant_km"],
tm["azimuth_deg"], tm["elevation_deg"], tm["data"].hex(" "), tm["crc_ok"])
ack = parse_packet(ACK)
print(ack["time"].isoformat(timespec="milliseconds"), ack["status"],
ack["data"] == parse_packet(TC)["data"])
It prints:
2026-11-03T12:34:56.789+00:00 25544 1234.5 180.0 45.0 ca fe ba be True
2026-11-03T12:35:00.120+00:00 0 True
The acknowledgement has status 0, and its echo is the telecommand's
payload.
Annotated, the telemetry packet reads:
d4 c3 b2 a1 preamble
30 00 00 00 length 48
00 00 00 00 type 0x00, telemetry
c6 06 03 12 34 56 78 09 time tag, 2026-11-03 12:34:56.789 UTC
c8 63 00 00 NORAD 25544
00 50 9a 44 slant range 1234.5 km
00 00 34 43 azimuth 180.0
00 00 34 42 elevation 45.0
ca fe ba be data, 4 bytes
1e 6a 3b ff CRC 0xFF3B6A1E
2b 3c 4d 5e postamble
The splitter, given all four in one stream behind a false preamble, and in 7-byte reads:
stream = b"\x00\xd4\xc3\xb2\xa1junk" + TM + TM_MARKERS + TC + ACK
chunks = [stream[i:i + 7] for i in range(0, len(stream), 7)]
for packet in iter_packets(chunks):
p = parse_packet(packet)
print(f"{p['type']:#04x} {p['length']:2} {p['crc_ok']} {p['data'].hex(' ')}")
It prints:
0x00 48 True ca fe ba be
0x00 52 True 2b 3c 4d 5e d4 c3 b2 a1
0x01 24 True 01 02 03 04
0x02 36 True 01 02 03 04
The false preamble at the start is skipped, and the second packet is kept whole although its data holds a postamble and a preamble.
Troubleshooting
| Symptom | Cause | What to do |
|---|---|---|
| The CRC never matches. | You use the standard CRC-32 (zlib.crc32 and the like), or the wrong range. |
Use Expedite's CRC, over the preamble up to the byte before the CRC. Check that 123456789 gives 0xFC4F2BE9. |
| Times are a day out, or the month is wrong. | Bytes 13 and 14 swapped, or the day counted from 1. | Day = byte 14 × 100 + byte 13, and 1 January is day 0. See The time tag. |
| The year decodes as 2126. | 2000 added to the year byte. | Add 1900. |
| The NORAD number reads as 0.0, a tiny float, or above 1,000,000,000. | Read as the wrong type. | Read a u32, and reread it as a float32 only when it is 0x3F800000 or more. Zero means no pass was being tracked. See Telemetry. |
| Packets go missing or come out garbled after a while. | Each recv() or read treated as a packet, or packets cut at the first postamble. |
Frame by the length and confirm, as iter_packets does. |
crc_ok is true, but the data is damaged. |
The CRC covers only the trip from the station to you, not the radio link. | Keep a check of your own in your spacecraft's data. |
Acknowledgement status 1, nothing transmitted. |
You sent a complete Expedite packet as the payload, or the payload, or the CRC the station adds to it, contains 2B 3C 4D 5E, which the modem reads as the end of the packet. |
Send the payload only. Change a byte that does not matter, such as a counter, and send it again. |
ttc.ack says ok: true, but no acknowledgement packet follows, or one with status 1. |
The payload is longer than 16368 bytes. | Keep telecommands to 16368 bytes. |
Acknowledgement status 2. |
The command does not fit the configured error-correction code. | Check its length against the command FEC settings. See Configure the radio. |
Acknowledgement status 3. |
The modem's data format for this satellite refused the command. | Check the satellite's command.data settings and the command's size. See Configure the radio. |