All docsStellar LinkRF bench · by Stellar Systems v0.4.0

Control & Automation

Datapath and Transmission

Claiming the modem, blocks and flushing, stream and slot framing, pushing packets, the receive feed, and capture and loopback measurements.

The datapath is the path that carries bytes between stellarlinkd and the modem, in both directions. This page covers how bytes get in and out.

Claiming the modem#

The daemon must acquire the datapath before it can transmit or receive. With the shipped configuration ([datapath] autostart = false) the daemon claims nothing until something asks it to.

Shell
stellarlinkctl datapath status       # who holds the modem, and is the transmit output enabled
stellarlinkctl datapath enable       # claim it, then read back whether the claim took
stellarlinkctl datapath disable      # release it
RoutePurpose
GET /api/v1/datapathCurrent state
POST /api/v1/datapath/enableAcquire
POST /api/v1/datapath/disableRelease

chain up acquires the datapath as its last step. The measurement commands (capture, loopback) claim it themselves and want it exclusively: release it first, or they return 409.

Blocks and latency#

Data moves between the daemon and the modem in blocks of 4096 bytes (reported as block_useful_bytes). Only full blocks are sent, so:

  • a packet does not go on the air until its block is full;
  • at a low packet rate you must flush, or the packets wait indefinitely;
  • on the receive side, a block is returned only once it is full, and the first frame of a freshly armed chain is used for acquisition. Flush two blocks whenever you want to see the result come back.
Shell
stellarlinkctl tx flush --blocks 2          # POST /api/v1/datapath/flush {"blocks": 2}

The flush reply gives the bytes sent (padding included; zero when nothing was pending) and tx_chain_running, which says whether the transmit output is enabled. There is no automatic flush timer: padding goes on the air, so when to spend it is the caller's decision.

Framing: stream or slot#

The modem cuts the byte stream into frames of the profile's frame length without looking at packet boundaries. How you lay packets out decides whether their boundaries survive:

ModeBoundariesOverheadUse for
streamNone: the receiver gets the bytes re-cut at the frame lengthZeroBulk payloads that carry their own delimiting
slotOne packet per slot, recoverableThe fill of each slotA packet feed (CSP, CCSDS)

A slot is [length: 2 bytes, big-endian][packet][padding…], exactly slot_len bytes. The length prefix is needed because CSP has no length field: without it the padding would be indistinguishable from payload.

Two constraints on slot_len, both enforced by refusal:

  • it must equal the modem's frame length (the profile's framing.mtu_bytes without coding);
  • it must divide 4096: 1024, 512, 256, 128, 64, 16 work; 223 does not, so slot framing is unavailable with Reed-Solomon coding.

Pushing packets#

One-off: POST /api/v1/datapath/transmit#

JSON
{
  "packets": [
    {"protocol": "csp",
     "header": {"priority": "normal", "src": 10, "dst": 1, "dport": 7, "sport": 31,
                "flags": {"crc32": false, "xtea": false, "rdp": false, "hmac": false}},
     "payload_hex": "01020304"},
    {"protocol": "raw", "payload_hex": "deadbeef"}
  ],
  "framing": {"mode": "slot", "slot_len": 256}
}
ProtocolEffect
rawThe bytes are passed through untouched
cspStellar Link builds a CSP packet (4-byte header) from header and the payload
ccsdsStellar Link builds a CCSDS space packet (6-byte primary header)

Packet shapes (the same JSON is accepted by /ws/tx and returned by the frames store):

JSON
{"protocol": "raw", "payload_hex": "deadbeef"}

{"protocol": "csp",
 "header": {"priority": "normal", "src": 10, "dst": 1, "dport": 7, "sport": 31,
            "flags": {"crc32": false, "xtea": false, "rdp": false, "hmac": false}},
 "payload_hex": "01020304"}

{"protocol": "ccsds",
 "header": {"version": 0, "kind": "tc", "secondary_header": false, "apid": 42,
            "seq_flags": "standalone", "seq_count": 0, "data_length": 3},
 "payload_hex": "01020304"}

Every CSP header field is required: priority is critical, high, normal or low; addresses are 5 bits (0 to 31) and ports 6 bits (0 to 63). CSP payloads are limited to 256 bytes. In slot mode the encoded packet, header included, must fit in slot_len − 2 bytes. For CCSDS, kind is tm or tc and seq_flags is continuation, first, last or standalone.

The reply reports packets, useful_bytes, wire_bytes, boundaries_preserved, tx_chain_running and block_useful_bytes. It returns once the data is queued, not once it has been transmitted. When the chain cannot carry an emission the request is refused with 409, naming the first missing prerequisite and the command that clears it; "force": true transmits anyway, on an unconditioned chain.

From the CLI, which builds the request and always flushes:

Shell
stellarlinkctl tx send --protocol csp --src 10 --dst 1 --hex 01020304
stellarlinkctl tx send --file payload.bin --framing slot --slot-len 256

Sustained feed: ws://<unit>:8080/ws/tx#

For continuous traffic, keep one WebSocket open rather than issuing one HTTP request per packet. The first message fixes the framing for the session:

JSON
{"framing": {"mode": "slot", "slot_len": 256}}
JSON
{"type": "ready", "framing": {"mode": "slot", "slot_len": 256},
 "boundaries_preserved": true, "block_useful_bytes": 4096}

Then push as often as you like:

JSON
{"packets": [{"protocol": "raw", "payload_hex": "01020304"}]}
JSON
{"type": "queued", "packets": 1, "useful_bytes": 256}

A malformed packet is answered {"type": "rejected", "reason": "…"} and the socket stays open.

The ZeroMQ PUSH socket of the link service is the other way to feed the modem continuously.

Receiving#

Real time: ws://<unit>:8080/ws/frames#

text
/ws/frames?framing=slot&slot_len=256&payload=true
ParameterMeaning
framingslot to parse slots, stream (default) to receive whole blocks
slot_lenSlot length for slot
payloadInclude the payload as hex (off by default: it doubles the volume)

Messages:

typeWhen
packetOne recovered packet per slot (slot, len, payload)
fillA padding slot; never reported as a zero-length packet
unparsedA slot whose length prefix does not fit; reported, not dropped
blockStream mode: one received block, 4096 bytes
laggedThe subscriber fell behind by blocks blocks

Polling: GET /api/v1/frames#

Returns a page from a ring of recently received blocks:

JSON
{"granularity": "dma_block", "clock": "boot_relative", "empty_reason": null, "frames": [ ... ]}

Each entry is one received block, not one protocol frame. Times are relative to the unit's start. When the page is empty, empty_reason says whether the link carried nothing or nothing was reading the modem. There is no per-frame FEC or CRC verdict here: fec_status and crc_ok stay "none"/null (the link service reports frame quality when transfer frames are configured). DELETE /api/v1/frames clears the ring.

Capture and loopback measurements#

Three routes measure the link at the byte level. They claim the datapath themselves.

RouteCLIWhat it does
POST /api/v1/datapath/capturestellarlinkctl capture -o rx.bin --blocks 4Returns the raw received blocks, concatenated
POST /api/v1/datapath/loopbackstellarlinkctl loopback --payload p.bin --blocks 4Feeds a payload while capturing, returns the capture
POST /api/v1/datapath/measure—Loopback plus comparison, returns per-block match counts

Captures and loopback payloads use the modem's raw block format, in which each payload byte occupies a 4-byte word; use stellarlinkctl loopback and stellarlinkctl compare rather than comparing such files by hand.

Parameters common to all three:

ParameterDefaultMeaning
blocks4Blocks to collect in a row. Getting them proves a sustained link; a short capture fails (504) rather than being truncated
warmup0Blocks to obtain and discard first. Every capture re-arms the chain, so the first block can carry an acquisition transient. Zero by default, so errors at the head of a capture are never discarded silently
timeout_ms30000Give up after this long
release / --keepreleaseRelease the datapath afterwards

stellarlinkctl loopback compares the capture with the payload and prints a verdict (BytePerfect, Degraded, …). stellarlinkctl compare capture.bin payload.bin does the same offline on the host. See Measurement Tools for how to read the result.

↑↓ to moveEnter to open