VARA HF protocol specification#
Version 1.0 (draft), 2026-11-24. Describes the VARA HF protocol as implemented by SPEEDBIRD's open-source VARA HF modem (speedbird-python).
Status and scope. This document describes VARA HF as SPEEDBIRD's modem implements it, layer by layer: physical layer, control frames and link establishment, ARQ data link, and host (TNC) interface. Every number in it comes from the modem's source code. Levels 1–4 (the levels open to unregistered stations) have been compared black-box against VARA HF 4.9.0 (bandwidths, frame lengths, connect codewords, header layout). Higher levels follow the reference implementation and are not yet independently verified against VARA HF. Items marked [uncertain] are behaviour the code shows but whose purpose, or whose match with the original modem, has not been confirmed. Corrections from on-air testing are welcome via Support.
Provenance. SPEEDBIRD's VARA HF modem is a Python port of xara (MIT licence, © 2026 x0rro), an independent open-source implementation of the VARA HF protocol. Neither contains code from VARA. VARA is a product of EA5HVK; this document is independent of, and not endorsed by, EA5HVK. See our position on VARA, xara and VarAC.
About this document#
Why this document exists#
US amateur rules, 47 CFR §97.309(a)(4), allow a data emission not listed in §97.309(a) only if its technical characteristics are publicly documented. This document is that public documentation for VARA HF as SPEEDBIRD transmits it. Nothing in the protocol is encrypted. The ENCRYPTION host command is always refused (§97.113(a)(4)). The caller's callsign is sent in clear in the header frame, and stations can send CW ID on 1500 Hz (§97.119). A second goal is interoperability: anyone should be able to build a compatible modem, monitor or decoder from this page.
Conventions#
- MUST, SHOULD and MAY are normative. Sections or tables marked informative are not.
- Audio is real-valued, 48 000 samples/s, centred on 1500 Hz (USB dial + 1500 Hz). A "tick" is 64 samples (1.333 ms) unless stated otherwise.
- Bytes are written in hex (
0x14). Multi-byte integers are big-endian. Bit order within a byte is given at each layout. - "The reference implementation" means the modem this document is derived from. File references point to
code/libs/speedbird-python/src/speedbird_python/in the SPEEDBIRD source tree. - Example callsigns are N0CALL and N0CALL-1.
Protocol stack at a glance#
host program (Winlink Express, Pat, VarAC)
│ TCP: command port 8300 (CR-terminated text), data port 8301 (byte stream), KISS 8100
┌──────┴─────────────────────────────────────────────────────────────┐
│ Host interface commands, async status, buffering §Host │
├────────────────────────────────────────────────────────────────────┤
│ ARQ data link stop-and-wait bursts of 1–2 frames, │
│ ACK/NAK codewords, turn-taking, │
│ receiver-driven speed adaptation, │
│ TEXT / deflate compression §ARQ │
├────────────────────────────────────────────────────────────────────┤
│ Control frames MFSK codewords keyed by callsign hashes: │
│ connect request/reply, ACK/NAK, BREAK, │
│ IDLE, QRT; header frame; CW ID; busy §Ctrl │
├────────────────────────────────────────────────────────────────────┤
│ Physical layer 500 / 2300 / 2750 Hz; hopped M-FSK, │
│ multi-carrier DPSK, OFDM DPSK/QAM; │
│ turbo code, CRC-16, whitening §PHY │
└────────────────────────────────────────────────────────────────────┘
│ audio, 48 kHz, centre 1500 Hz
radio (USB)
A session in one paragraph: the caller sends a connect request control frame whose codeword depends only on the called station's callsign hash. The called station answers with a connect reply that also tells the caller which level to send its header data frame at. The header carries the caller's callsign in clear, its flags (compression, registered) and the start level it offers. After that, the two stations take turns. The sender transmits bursts of one or two data frames, and the receiver replies with a control codeword that acknowledges them and sets the next level (ACK up/stay/down, NAK). The turn passes with a LAST frame plus BREAK/GO_AHEAD. Either side ends the link with QRT, optionally followed by CW ID.
Physical layer#
This section specifies the VARA HF data-frame waveforms: how a data frame (a byte string with a CRC) is turned into 48 kHz audio and back. Control frames (ACK/NACK/BREAK/IDLE codewords, the connect call and reply, the start-level exchange), CW ID, tune carrier and busy detection are specified in Control frames and are not repeated here.
Everything below is taken from the reference implementation's level tables and modulators. Numbers are exact unless a derivation is shown. Where the text says MUST, a transmitter that deviates will not be decoded by the reference receiver (or by VARA HF). Paragraphs marked (informative) describe one working receiver and are not requirements.
Conventions#
| Symbol | Meaning |
|---|---|
Fs |
Audio sample rate, 48 000 Hz (real, mono). |
Fs3 |
Receiver baseband rate, 3 000 Hz complex (Fs/16). Several waveform parameters are defined at this rate. |
r |
Record (speed level) number, 1-based, 1..17. |
S |
Code parameter "symbols per frame" (spf) of a level. A frame occupies S − 1 symbol periods on air. |
K |
Turbo information block length in bits. |
N |
Channel (coded) bits per frame = data cells × bits per cell. |
F |
Frame length in bytes = ⌊K/8⌋ (control byte and CRC included). |
bps |
Bits per modulation symbol (FSK: log2 of tone count). |
P |
Puncturing period of the turbo code. |
Rnd |
The VB6-compatible 24-bit LCG defined in Pseudo-random generator. |
draw(m) |
One LCG step, then ⌊float32(state/2²⁴) · float32(m)⌋ (see below); a value in 0..m−1. |
Bit strings are MSB-first: byte 0xA5 gives bits 1,0,1,0,0,1,0,1. "Carrier-major" means all symbols of carrier 0, then all symbols of carrier 1, and so on.
Audio interface, centre frequency and bandwidths#
| Parameter | Value |
|---|---|
| Sample rate | 48 000 Hz. Every waveform is defined on this grid (FSK and OFDM directly; PSK at 3 000 Hz, then interpolated ×16). |
| Centre frequency | 1 500 Hz. All OFDM carrier sets are centred on FFT bin 32 (= 1 500.000 Hz). |
| Bandwidth modes | 500, 2300 and 2750 Hz. The nominal passband is 1500 ± BW/2: 1250–1750, 350–2650 and 125–2875 Hz. |
| Speed levels in the normal ladder | 500 Hz: 1–13 · 2300 Hz: 1–16 · 2750 Hz: 1–17 |
| Table entries per bandwidth | always 17. Entries above the ladder are "extra" records (marked (x), see Extra records). |
Each record belongs to one of three waveform families:
| Family | Used for | Coherence |
|---|---|---|
| M-FSK with frequency hopping | the lowest levels (1–3 at 500 Hz, 1–4 at 2300/2750 Hz) | non-coherent |
| Parallel single-carrier DPSK ("PSK") | the middle levels | differential |
| OFDM, DPSK or coherent QAM | the upper levels | differential (Q/8PSK) or pilot-aided coherent (16/32QAM) |
Registration gate. Levels 1–4 are the "free" levels: an unregistered station MUST NOT send data at records above 4 (UNREGISTERED_MAX_LEVEL = 4). The waveforms do not depend on registration. How the starting level is chosen and capped is part of the link protocol. The reference caps it at record 7 (500 Hz) or 6 (2300/2750 Hz), or at the highest non-QAM record for file transfers.
Speed-level tables#
Notes on the columns:
- T_s: symbol period. FSK:
16·sps/48000withsps ∈ {128, 64, 32}. PSK:32/3000 s(93.75 Bd). OFDM:(1024+128)/48000 = 24 ms. - Frame (ms) =
(S − 1) · T_s, the time one frame occupies without lead-in. - 1-frame burst =
(lead-in + (S − 1) + flush) · T_s, the nominal airtime of a burst that carries one frame. Flush isround(2·span)symbols for PSK (RC: 1, RRC ±1: 2, RRC ±2: 4) and 0 otherwise. A two-frame burst adds another(S − 1) · T_s. - Raw ch. bit/s =
N / frame time, the coded bit rate excluding pilots, markers and lead-in. - Net bit/s =
8·F / frame time, which counts the 3 overhead bytes. ¹Payload =F − 3. A frame that also carries the next-level byte has one byte less (see Data-frame layout). - Code rate:
Pcomes from the code-rate index (2→1, 3→2, 4→4, 5→6, 6→8, 7→10). The nominal rate isP/(P+2). "K÷used" is K divided by the punctured length before zero padding (see Puncturing). - Thr SNR: the SNR threshold the reference adaptation uses (VARA SN scale, dB). Skip↓: the adaptation never steps down into this level. Both are informative for the PHY.
- (x): extra record, outside the normal ladder.
500 Hz#
| Lvl | Family | Constellation | Carriers / tones | Frequencies (Hz) | Spacing (Hz) | T_s (ms) | Pulse / guard | S (spf) | Markers per carrier |
|---|---|---|---|---|---|---|---|---|---|
| 1 | M-FSK (hopped) | 8-FSK | 1 of 8 tones, grid bins 54–74 (step 2) | 1265.6–1734.4 | 23.4375 (tone step 46.875) | 42.667 | rect, no guard | 125 | 24 pilot symbols |
| 2 | M-FSK (hopped) | 8-FSK | 1 of 8 tones, grid bins 27–37 (step 1) | 1265.6–1734.4 | 46.8750 | 21.333 | rect, no guard | 229 | 24 pilot symbols |
| 3 | M-FSK (hopped) | 8-FSK | 1 of 8 tones, grid bins 27–37 (step 1) | 1265.6–1734.4 | 46.8750 | 21.333 | rect, no guard | 227 | 24 pilot symbols |
| 4 | single-carrier DPSK ×N | DBPSK | 2 | 1350, 1650 | 300 | 10.667 | RC β=1 | 394 | 18 |
| 5 | single-carrier DPSK ×N | DQPSK | 2 | 1350, 1650 | 300 | 10.667 | RC β=1 | 395 | 18 |
| 6 | single-carrier DPSK ×N | DQPSK | 3 | 1320, 1500, 1680 | 180 | 10.667 | RRC β=1, ±2 sym | 376 | 12 |
| 7 | OFDM DPSK | DQPSK | 11 (bins 27–37) | 1265.62–1734.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 4 |
| 8 | OFDM DPSK | DQPSK | 11 (bins 27–37) | 1265.62–1734.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 4 |
| 9 | OFDM DPSK | DQPSK | 11 (bins 27–37) | 1265.62–1734.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 4 |
| 10 | OFDM DPSK | D8PSK | 11 (bins 27–37) | 1265.62–1734.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 4 |
| 11 | OFDM DPSK | D8PSK | 11 (bins 27–37) | 1265.62–1734.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 4 |
| 12 | OFDM coherent | 16QAM | 11 (bins 27–37) | 1265.62–1734.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 155 | 4 (+QAM pilots) |
| 13 | OFDM coherent | 32QAM | 11 (bins 27–37) | 1265.62–1734.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 155 | 4 (+QAM pilots) |
| 14 (x) | single-carrier DPSK ×N | DQPSK | 2 | 1350, 1650 | 300 | 10.667 | RC β=1 | 451 | 18 |
| 15 (x) | M-FSK (hopped) | 8-FSK | 1 of 8 tones, grid bins 54–74 (step 2) | 1265.6–1734.4 | 23.4375 (tone step 46.875) | 42.667 | rect, no guard | 93 | 24 pilot symbols |
| 16 (x) | OFDM coherent | 32QAM | 11 (bins 27–37) | 1265.62–1734.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 51 | 4 (+QAM pilots) |
| 17 (x) | OFDM coherent | 32QAM | 11 (bins 27–37) | 1265.62–1734.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 51 | 4 (+QAM pilots) |
| Lvl | Code-rate idx → P | Rate (nominal / K÷used) | K (info bits) | Frame bytes | Payload bytes¹ | Data cells | N (coded bits) | Pad bits | Lead-in sym | Frame (ms) | 1-frame burst (ms) | Raw ch. bit/s | Net bit/s | Thr SNR (dB) | Skip↓ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2 → 1 | 1/3 / 0.3200 | 96 | 12 | 9 | 100 | 300 | 0 | 2 | 5290.7 | 5376.0 | 56.7 | 18.1 | -13.6 | |
| 2 | 2 → 1 | 1/3 / 0.3268 | 200 | 25 | 22 | 204 | 612 | 0 | 4 | 4864.0 | 4949.3 | 125.8 | 41.1 | -11.2 | yes |
| 3 | 3 → 2 | 1/2 / 0.4901 | 297 | 37 | 34 | 202 | 606 | 0 | 4 | 4821.3 | 4906.7 | 125.7 | 61.4 | -10.4 | |
| 4 | 3 → 2 | 1/2 / 0.4920 | 368 | 46 | 43 | 748 | 748 | 0 | 8 | 4192.0 | 4288.0 | 178.4 | 87.8 | -8.4 | |
| 5 | 3 → 2 | 1/2 / 0.4960 | 744 | 93 | 90 | 750 | 1500 | 0 | 8 | 4202.7 | 4298.7 | 356.9 | 177.0 | -5.4 | |
| 6 | 3 → 2 | 1/2 / 0.4972 | 1080 | 135 | 132 | 1086 | 2172 | 0 | 8 | 4000.0 | 4128.0 | 543.0 | 270.0 | -3.8 | |
| 7 | 3 → 2 | 1/2 / 0.4981 | 1578 | 197 | 194 | 1584 | 3168 | 0 | 4 | 3576.0 | 3672.0 | 885.9 | 440.7 | -1.2 | |
| 8 | 4 → 4 | 2/3 / 0.6641 | 2104 | 263 | 260 | 1584 | 3168 | 0 | 4 | 3576.0 | 3672.0 | 885.9 | 588.4 | 0.6 | |
| 9 | 6 → 8 | 4/5 / 0.7970 | 2524 | 315 | 312 | 1584 | 3168 | 1 | 4 | 3576.0 | 3672.0 | 885.9 | 704.7 | 2.6 | |
| 10 | 4 → 4 | 2/3 / 0.6650 | 3160 | 395 | 392 | 1584 | 4752 | 0 | 4 | 3576.0 | 3672.0 | 1328.9 | 883.7 | 5.0 | yes |
| 11 | 6 → 8 | 4/5 / 0.7980 | 3792 | 474 | 471 | 1584 | 4752 | 0 | 4 | 3576.0 | 3672.0 | 1328.9 | 1060.4 | 6.4 | |
| 12 | 7 → 10 | 5/6 / 0.8316 | 4755 | 594 | 591 | 1430 | 5720 | 2 | 5 | 3696.0 | 3816.0 | 1547.6 | 1285.7 | 8.0 | |
| 13 | 6 → 8 | 4/5 / 0.7987 | 5708 | 713 | 710 | 1430 | 7150 | 3 | 5 | 3696.0 | 3816.0 | 1934.5 | 1543.3 | 10.6 | |
| 14 (x) | 3 → 2 | 1/2 / 0.4965 | 856 | 107 | 104 | 862 | 1724 | 0 | 8 | 4800.0 | 4896.0 | 359.2 | 178.3 | -5.4 | |
| 15 (x) | 2 → 1 | 1/3 / 0.3137 | 64 | 8 | 5 | 68 | 204 | 0 | 2 | 3925.3 | 4010.7 | 52.0 | 16.3 | -13.6 | |
| 16 (x) | 6 → 8 | 4/5 / 0.7955 | 1704 | 213 | 210 | 429 | 2145 | 3 | 5 | 1200.0 | 1320.0 | 1787.5 | 1420.0 | 5.4 | |
| 17 (x) | 6 → 8 | 4/5 / 0.7955 | 1704 | 213 | 210 | 429 | 2145 | 3 | 5 | 1200.0 | 1320.0 | 1787.5 | 1420.0 | 5.4 |
2300 Hz#
| Lvl | Family | Constellation | Carriers / tones | Frequencies (Hz) | Spacing (Hz) | T_s (ms) | Pulse / guard | S (spf) | Markers per carrier |
|---|---|---|---|---|---|---|---|---|---|
| 1 | M-FSK (hopped) | 8-FSK | 1 of 8 tones, grid bins 33–96 (step 2) | 773.4–2250.0 | 23.4375 (tone step 46.875) | 42.667 | rect, no guard | 125 | 24 pilot symbols |
| 2 | M-FSK (hopped) | 8-FSK | 1 of 8 tones, grid bins 17–48 (step 2) | 796.9–2250.0 | 46.8750 (tone step 93.750) | 21.333 | rect, no guard | 229 | 24 pilot symbols |
| 3 | M-FSK (hopped) | 16-FSK | 1 of 16 tones, grid bins 17–48 (step 2) | 796.9–2250.0 | 46.8750 (tone step 93.750) | 21.333 | rect, no guard | 229 | 24 pilot symbols |
| 4 | M-FSK (hopped) | 16-FSK | 1 of 16 tones, grid bins 9–24 (step 1) | 843.8–2250.0 | 93.7500 | 10.667 | rect, no guard | 396 | 24 pilot symbols |
| 5 | single-carrier DPSK ×N | DQPSK | 3 | 900, 1500, 2100 | 600 | 10.667 | RC β=1 | 376 | 12 |
| 6 | single-carrier DPSK ×N | DQPSK | 4 | 750, 1250, 1750, 2250 | 500 | 10.667 | RC β=1 | 365 | 9 |
| 7 | single-carrier DPSK ×N | DQPSK | 6 | 700, 1020, 1340, 1660, 1980, 2300 | 320 | 10.667 | RRC β=1, ±2 sym | 355 | 6 |
| 8 | single-carrier DPSK ×N | DQPSK | 8 | 702, 930, 1158, 1386, 1614, 1842, 2070, 2298 | 228 | 10.667 | RRC β=1, ±2 sym | 352 | 5 |
| 9 | single-carrier DPSK ×N | DQPSK | 10 | 555, 765, 975, 1185, 1395, 1605, 1815, 2025, 2235, 2445 | 210 | 10.667 | RRC β=1, ±1 sym | 349 | 4 |
| 10 | OFDM DPSK | DQPSK | 49 (bins 8–56) | 375.00–2625.00 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 1 |
| 11 | OFDM DPSK | DQPSK | 49 (bins 8–56) | 375.00–2625.00 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 1 |
| 12 | OFDM DPSK | DQPSK | 49 (bins 8–56) | 375.00–2625.00 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 1 |
| 13 | OFDM DPSK | D8PSK | 49 (bins 8–56) | 375.00–2625.00 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 1 |
| 14 | OFDM DPSK | D8PSK | 49 (bins 8–56) | 375.00–2625.00 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 1 |
| 15 | OFDM coherent | 16QAM | 49 (bins 8–56) | 375.00–2625.00 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 155 | 1 (+QAM pilots) |
| 16 | OFDM coherent | 32QAM | 49 (bins 8–56) | 375.00–2625.00 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 155 | 1 (+QAM pilots) |
| 17 (x) | OFDM coherent | 32QAM | 11 (bins 27–37) | 1265.62–1734.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 51 | 4 (+QAM pilots) |
| Lvl | Code-rate idx → P | Rate (nominal / K÷used) | K (info bits) | Frame bytes | Payload bytes¹ | Data cells | N (coded bits) | Pad bits | Lead-in sym | Frame (ms) | 1-frame burst (ms) | Raw ch. bit/s | Net bit/s | Thr SNR (dB) | Skip↓ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2 → 1 | 1/3 / 0.3200 | 96 | 12 | 9 | 100 | 300 | 0 | 2 | 5290.7 | 5376.0 | 56.7 | 18.1 | -13.6 | |
| 2 | 2 → 1 | 1/3 / 0.3268 | 200 | 25 | 22 | 204 | 612 | 0 | 4 | 4864.0 | 4949.3 | 125.8 | 41.1 | -11.2 | |
| 3 | 3 → 2 | 1/2 / 0.4926 | 402 | 50 | 47 | 204 | 816 | 0 | 6 | 4864.0 | 4992.0 | 167.8 | 82.2 | -9.4 | |
| 4 | 3 → 2 | 1/2 / 0.4960 | 736 | 92 | 89 | 371 | 1484 | 0 | 12 | 4213.3 | 4341.3 | 352.2 | 174.7 | -6.6 | |
| 5 | 3 → 2 | 1/2 / 0.4972 | 1080 | 135 | 132 | 1086 | 2172 | 0 | 8 | 4000.0 | 4096.0 | 543.0 | 270.0 | -3.6 | |
| 6 | 3 → 2 | 1/2 / 0.4979 | 1410 | 176 | 173 | 1416 | 2832 | 0 | 8 | 3882.7 | 3978.7 | 729.4 | 362.6 | -2.4 | |
| 7 | 3 → 2 | 1/2 / 0.4986 | 2076 | 259 | 256 | 2082 | 4164 | 0 | 8 | 3776.0 | 3904.0 | 1102.8 | 548.7 | -0.6 | yes |
| 8 | 3 → 2 | 1/2 / 0.4989 | 2754 | 344 | 341 | 2760 | 5520 | 0 | 8 | 3744.0 | 3872.0 | 1474.4 | 735.0 | 0.4 | yes |
| 9 | 3 → 2 | 1/2 / 0.4991 | 3424 | 428 | 425 | 3430 | 6860 | 0 | 8 | 3712.0 | 3818.7 | 1848.1 | 922.4 | 1.3 | |
| 10 | 3 → 2 | 1/2 / 0.4996 | 7197 | 899 | 896 | 7203 | 14406 | 0 | 4 | 3576.0 | 3672.0 | 4028.5 | 2011.2 | 5.4 | |
| 11 | 4 → 4 | 2/3 / 0.6661 | 9596 | 1199 | 1196 | 7203 | 14406 | 0 | 4 | 3576.0 | 3672.0 | 4028.5 | 2682.3 | 7.2 | yes |
| 12 | 6 → 8 | 4/5 / 0.7993 | 11512 | 1439 | 1436 | 7203 | 14406 | 4 | 4 | 3576.0 | 3672.0 | 4028.5 | 3219.2 | 8.5 | |
| 13 | 4 → 4 | 2/3 / 0.6663 | 14398 | 1799 | 1796 | 7203 | 21609 | 0 | 4 | 3576.0 | 3672.0 | 6042.8 | 4024.6 | 11.2 | |
| 14 | 6 → 8 | 4/5 / 0.7996 | 17276 | 2159 | 2156 | 7203 | 21609 | 2 | 4 | 3576.0 | 3672.0 | 6042.8 | 4830.0 | 13.2 | yes |
| 15 | 7 → 10 | 5/6 / 0.8329 | 21710 | 2713 | 2710 | 6517 | 26068 | 4 | 5 | 3696.0 | 3816.0 | 7053.0 | 5872.3 | 14.2 | |
| 16 | 6 → 8 | 4/5 / 0.7997 | 26056 | 3257 | 3254 | 6517 | 32585 | 3 | 5 | 3696.0 | 3816.0 | 8816.3 | 7049.8 | 17.2 | |
| 17 (x) | 6 → 8 | 4/5 / 0.7955 | 1704 | 213 | 210 | 429 | 2145 | 3 | 5 | 1200.0 | 1320.0 | 1787.5 | 1420.0 | 5.4 |
2750 Hz#
| Lvl | Family | Constellation | Carriers / tones | Frequencies (Hz) | Spacing (Hz) | T_s (ms) | Pulse / guard | S (spf) | Markers per carrier |
|---|---|---|---|---|---|---|---|---|---|
| 1 | M-FSK (hopped) | 8-FSK | 1 of 8 tones, grid bins 24–103 (step 2) | 562.5–2414.1 | 23.4375 (tone step 46.875) | 42.667 | rect, no guard | 125 | 24 pilot symbols |
| 2 | M-FSK (hopped) | 8-FSK | 1 of 8 tones, grid bins 12–51 (step 2) | 562.5–2390.6 | 46.8750 (tone step 93.750) | 21.333 | rect, no guard | 229 | 24 pilot symbols |
| 3 | M-FSK (hopped) | 16-FSK | 1 of 16 tones, grid bins 12–51 (step 2) | 562.5–2390.6 | 46.8750 (tone step 93.750) | 21.333 | rect, no guard | 229 | 24 pilot symbols |
| 4 | M-FSK (hopped) | 16-FSK | 1 of 16 tones, grid bins 6–25 (step 1) | 562.5–2343.8 | 93.7500 | 10.667 | rect, no guard | 396 | 24 pilot symbols |
| 5 | single-carrier DPSK ×N | DQPSK | 3 | 600, 1500, 2400 | 900 | 10.667 | RC β=1 | 376 | 12 |
| 6 | single-carrier DPSK ×N | DQPSK | 4 | 510, 1170, 1830, 2490 | 660 | 10.667 | RC β=1 | 365 | 9 |
| 7 | single-carrier DPSK ×N | DQPSK | 6 | 450, 870, 1290, 1710, 2130, 2550 | 420 | 10.667 | RRC β=1, ±2 sym | 355 | 6 |
| 8 | single-carrier DPSK ×N | DQPSK | 8 | 380, 700, 1020, 1340, 1660, 1980, 2300, 2620 | 320 | 10.667 | RRC β=1, ±2 sym | 352 | 5 |
| 9 | single-carrier DPSK ×N | DQPSK | 10 | 375, 625, 875, 1125, 1375, 1625, 1875, 2125, 2375, 2625 | 250 | 10.667 | RRC β=1, ±1 sym | 349 | 4 |
| 10 | single-carrier DPSK ×N | DQPSK | 13 | 240, 450, 660, 870, 1080, 1290, 1500, 1710, 1920, 2130, 2340, 2550, 2760 | 210 | 10.667 | RRC β=1, ±1 sym | 349 | 3 |
| 11 | OFDM DPSK | DQPSK | 59 (bins 3–61) | 140.62–2859.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 1 |
| 12 | OFDM DPSK | DQPSK | 59 (bins 3–61) | 140.62–2859.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 1 |
| 13 | OFDM DPSK | DQPSK | 59 (bins 3–61) | 140.62–2859.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 1 |
| 14 | OFDM DPSK | D8PSK | 59 (bins 3–61) | 140.62–2859.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 1 |
| 15 | OFDM DPSK | D8PSK | 59 (bins 3–61) | 140.62–2859.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 150 | 1 |
| 16 | OFDM coherent | 16QAM | 59 (bins 3–61) | 140.62–2859.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 155 | 1 (+QAM pilots) |
| 17 | OFDM coherent | 32QAM | 59 (bins 3–61) | 140.62–2859.38 | 46.875 | 24.000 | CP 128 smp (2.667 ms) | 155 | 1 (+QAM pilots) |
| Lvl | Code-rate idx → P | Rate (nominal / K÷used) | K (info bits) | Frame bytes | Payload bytes¹ | Data cells | N (coded bits) | Pad bits | Lead-in sym | Frame (ms) | 1-frame burst (ms) | Raw ch. bit/s | Net bit/s | Thr SNR (dB) | Skip↓ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2 → 1 | 1/3 / 0.3200 | 96 | 12 | 9 | 100 | 300 | 0 | 2 | 5290.7 | 5376.0 | 56.7 | 18.1 | -13.6 | |
| 2 | 2 → 1 | 1/3 / 0.3268 | 200 | 25 | 22 | 204 | 612 | 0 | 4 | 4864.0 | 4949.3 | 125.8 | 41.1 | -11.2 | |
| 3 | 3 → 2 | 1/2 / 0.4926 | 402 | 50 | 47 | 204 | 816 | 0 | 6 | 4864.0 | 4992.0 | 167.8 | 82.2 | -9.4 | |
| 4 | 3 → 2 | 1/2 / 0.4960 | 736 | 92 | 89 | 371 | 1484 | 0 | 12 | 4213.3 | 4341.3 | 352.2 | 174.7 | -6.6 | |
| 5 | 3 → 2 | 1/2 / 0.4972 | 1080 | 135 | 132 | 1086 | 2172 | 0 | 8 | 4000.0 | 4096.0 | 543.0 | 270.0 | -3.6 | |
| 6 | 3 → 2 | 1/2 / 0.4979 | 1410 | 176 | 173 | 1416 | 2832 | 0 | 8 | 3882.7 | 3978.7 | 729.4 | 362.6 | -2.4 | |
| 7 | 3 → 2 | 1/2 / 0.4986 | 2076 | 259 | 256 | 2082 | 4164 | 0 | 8 | 3776.0 | 3904.0 | 1102.8 | 548.7 | -0.6 | yes |
| 8 | 3 → 2 | 1/2 / 0.4989 | 2754 | 344 | 341 | 2760 | 5520 | 0 | 8 | 3744.0 | 3872.0 | 1474.4 | 735.0 | 0.4 | yes |
| 9 | 3 → 2 | 1/2 / 0.4991 | 3424 | 428 | 425 | 3430 | 6860 | 0 | 8 | 3712.0 | 3818.7 | 1848.1 | 922.4 | 1.3 | yes |
| 10 | 3 → 2 | 1/2 / 0.4993 | 4466 | 558 | 555 | 4472 | 8944 | 0 | 8 | 3712.0 | 3818.7 | 2409.5 | 1202.6 | 2.3 | |
| 11 | 3 → 2 | 1/2 / 0.4997 | 8667 | 1083 | 1080 | 8673 | 17346 | 0 | 4 | 3576.0 | 3672.0 | 4850.7 | 2422.8 | 6.0 | |
| 12 | 4 → 4 | 2/3 / 0.6662 | 11556 | 1444 | 1441 | 8673 | 17346 | 0 | 4 | 3576.0 | 3672.0 | 4850.7 | 3230.4 | 8.0 | yes |
| 13 | 6 → 8 | 4/5 / 0.7994 | 13864 | 1733 | 1730 | 8673 | 17346 | 4 | 4 | 3576.0 | 3672.0 | 4850.7 | 3877.0 | 9.3 | |
| 14 | 4 → 4 | 2/3 / 0.6664 | 17338 | 2167 | 2164 | 8673 | 26019 | 0 | 4 | 3576.0 | 3672.0 | 7276.0 | 4847.9 | 11.8 | |
| 15 | 6 → 8 | 4/5 / 0.7996 | 20804 | 2600 | 2597 | 8673 | 26019 | 2 | 4 | 3576.0 | 3672.0 | 7276.0 | 5816.6 | 14.0 | yes |
| 16 | 7 → 10 | 5/6 / 0.8330 | 26145 | 3268 | 3265 | 7847 | 31388 | 2 | 5 | 3696.0 | 3816.0 | 8492.4 | 7073.6 | 15.0 | |
| 17 | 6 → 8 | 4/5 / 0.7998 | 31376 | 3922 | 3919 | 7847 | 39235 | 3 | 5 | 3696.0 | 3816.0 | 10615.5 | 8489.2 | 18.0 |
Derived constants (all bandwidths)#
| Quantity | FSK | PSK | OFDM |
|---|---|---|---|
| Symbols on air per frame | S − 1 |
S − 1 (symbol 0 = phase reference) |
S − 1 (row 0 = reference row for DPSK) |
| Data cells per frame | S − 1 − 24 |
nc · (S − 2 − markers) |
DPSK: nc · (S − 2 − markers) · QAM: nc · (S − 1 − markers − ((S−3)//8 + 1)) |
N |
cells · bps |
cells · bps |
cells · bps |
| Lead-in symbols | ⌈t_L / T_s⌉ with t_L = 80 ms when bps < 4, else 120 ms |
same | same |
F = ⌊K/8⌋. For several levels K is not a multiple of 8 (for example 297, 1578, 7197). The K − 8F trailing information bits (1–7) are zero before whitening (see Bit pipeline).
Extra records#
Entries 14–17 at 500 Hz and entry 17 at 2300 Hz are outside the normal ladder. 500 Hz record 15 (a short 8-FSK frame of 8 bytes) carries the CQ broadcast frame. Record 16 at 500 Hz is identical to 17, and 2300 Hz record 17 is that same 500 Hz-wide 32QAM OFDM waveform (bins 27–37). Uses of records 14, 16 and 17 beyond this are not confirmed by the reference implementation. They are listed because each entry consumes draws from the table generator, so their parameters are normative for interoperability even where they are never sent (see Per-record tables).
Pseudo-random generator (VbRnd)#
All fixed pseudo-random sequences (whitening, scrambling phasors, interleavers, hop patterns, marker positions) come from a clone of the Visual Basic 6 Rnd/Randomize generator. Implementations MUST reproduce it bit-exactly, including its single-precision rounding.
MASK = 0xFFFFFF
MUL, INC = 0xFD43FD, 0xC39EC3 # x' = (x*1140671485 + 12820163) mod 2^24
START_STATE = 0x050000
def advance(s): return (s * MUL + INC) & MASK
def stream(seed: float) -> int: # Rnd(-1) followed by Randomize(seed)
s = START_STATE
b = float32_bits(-1.0) # 0xBF800000
s = (b + (b >> 24)) & MASK # Rnd(-1): reseed from the float32 bit pattern
s = advance(s) # ...and step once -> 0x395886
hi = float64_bits(seed) >> 32 # Randomize(seed)
mid = ((hi & 0xFFFF) ^ (hi >> 16)) & 0xFFFF
return (s & 0xFF0000FF) | (mid << 8)
def draw(s, m): # returns (new_state, value in 0..m-1)
s = advance(s)
v = floor(float32(float32(s) / float32(2**24)) * float32(m)) # product rounded to float32 (RNE)
return s, int(v)
float32(s)/2²⁴ is exact. Only the product ·m needs rounding to a 24-bit mantissa (round half to even) before truncation. Check values: stream(292.0) gives state 0x007286 and stream(43.0) gives 0xC04586. The first draw(128) values from stream(292) are 78 83 81 38 79 22 91 52.
Two seeds are used:
| Seed | Name | Generates |
|---|---|---|
| 292 | HF_SEED |
whitening sequence, PSK phasor table, OFDM phasor table (each from a fresh stream(292)) |
| 43 | TABLE_SEED |
per-record tables: channel interleaver, turbo interleaver, FSK hop/pilot grid, PSK/OFDM marker map (one stream per bandwidth) |
Fixed sequences (seed 292)#
| Sequence | Definition | Size |
|---|---|---|
Whitening w |
w[i] = draw(2), i = 0..149 999, from a fresh stream(292) |
150 000 bits (75 086 ones) |
PSK phasor index Ip[c][k] |
fresh stream(292). Draw 13·411 values of draw(129) and fill Ip[0..12][0..410] row by row (carrier-major). Then draw 13·60 more and fill Ip[0..12][411..470] the same way. |
13 carriers × 471 symbols |
OFDM phasor index Io[b][r] |
fresh stream(292). Draw 65 000 values D[j] = draw(129). Io[0..127][0..408] takes D[0 : 128·409] bin by bin, then Io[0..127][409..468] takes the next 128·60. |
128 FFT bins × 469 rows |
| Phasor | P[·][·] = exp(j·2π·I/128). Index 128 is equivalent to 0. |
The first 64 whitening bits are 1110101011111110000110000010111001011110001101100000111110101111. Io[8][0..15] = 75 119 91 111 11 97 51 65 35 12 124 43 59 100 55 76.
Transmit bit pipeline#
For a frame of F bytes (built as in Data-frame layout) at record r:
info = bits_msb_first(frame)[:K] + [0] * (K - 8*F) # K bits; 0..7 zero fill bits
for i in range(K): info[i] ^= w[i] # whitening (restarts at w[0] every frame)
coded = turbo_encode(info, turbo_perm[r], P) # see Turbo code / Puncturing
coded += [0] * (N - len(coded)) # zero pad to N
tx = [coded[chan_perm[r][i]] for i in range(N)] # channel interleaver
# tx is then mapped to symbols in order (see Mapping)
Every frame in a burst goes through this pipeline independently.
CRC#
| Parameter | Value |
|---|---|
| Algorithm | CRC-16/GENIBUS (also called CRC-16/EPC, CRC-16/I-CODE, CRC-16/DARC) |
| Width / polynomial | 16 / 0x1021 (x¹⁶+x¹²+x⁵+1) |
| Init / XorOut | 0xFFFF / 0xFFFF |
| RefIn / RefOut | false / false (MSB-first) |
Check ("123456789") |
0xD64E |
| Coverage | All frame bytes before the CRC (frame[0 : F−2]), computed on the un-whitened bytes |
| Placement | Last two bytes of the frame, big-endian |
Turbo code#
A parallel-concatenated code of two identical 8-state recursive systematic convolutional (RSC) encoders:
| Parameter | Value |
|---|---|
| Constraint length | 4 (memory 3, 8 states) |
Feedback polynomial g0 |
1 + D² + D³ (octal 13) |
Feed-forward (parity) polynomial g1 |
1 + D + D³ (octal 15) |
| Initial state | all zero, for both encoders |
| Termination | each encoder separately, 3 tail steps that drive the state to zero |
| Internal interleaver | per-record pseudo-random permutation π of length K (see Per-record tables). Encoder 2 input: u2[i] = info[π[i]]. |
These are the LTE constituent polynomials, but the interleaver and the output ordering differ from LTE.
def rsc(u): # returns systematic x[0..K+2], parity p[0..K+2]
r0 = r1 = r2 = 0 # r2 = a[t-1], r1 = a[t-2], r0 = a[t-3]
x, p = [], []
for t in range(len(u) + 3):
ut = u[t] if t < len(u) else (r0 ^ r1) # tail: input = feedback -> a = 0
a = ut ^ r0 ^ r1 # feedback 1 + D^2 + D^3
x.append(ut)
p.append(a ^ r2 ^ r0) # parity 1 + D + D^3
r0, r1, r2 = r1, r2, a
return x, p
Puncturing and codeword assembly#
Code-rate index → puncturing period P: 2→1, 3→2, 4→4, 5→6, 6→8, 7→10.
x1, p1 = rsc(info)
x2, p2 = rsc([info[pi[i]] for i in range(K)])
out = []
for t in range(K):
out.append(x1[t]) # systematic bit always sent
if P == 1 or t % P == 0: out.append(p1[t]) # parity 1
if P == 1 or t % P == P // 2: out.append(p2[t]) # parity 2
for j in range(3): # 12 tail bits, unpunctured
out += [x1[K+j], p1[K+j], x2[K+j], p2[K+j]]
# len(out) = K + ceil(K/P) + n2 + 12, n2 = #{t < K : t % P == P//2} (P = 1: 3K + 12)
The systematic bits of encoder 2 are never sent except in its tail. len(out) ≤ N for every record; the remainder (0–4 bits, the "Pad bits" column) is zero.
Channel interleaver#
tx[i] = coded[chan[i]] for i = 0..N−1, where chan is the record's channel permutation of length N. The receiver de-interleaves with soft[chan[i]] = llr[i].
Per-record tables (interleavers, hop grid, markers)#
For each bandwidth, one generator R = stream(43) is run over all 17 table entries in record order 1..17 (extra entries included), in this order per entry:
chan = perm(R, N)turbo = perm(R, K)- the entry's waveform table ("other"): the FSK grid, or the PSK/OFDM marker map.
Because the generator is shared, getting any entry's N, K or waveform parameters wrong corrupts the tables of every later entry.
def perm(R, n): # "first occurrence" permutation
seen, out = set(), []
while len(out) < n:
v = draw(R, n)
if v not in seen:
seen.add(v); out.append(v)
return out # R has advanced past the draw that completed the set
Record 1 has the same N = 300 and K = 96 in all three bandwidths, so its tables match across bandwidths: chan[0..9] = 122 33 200 280 154 22 48 158 224 172 and turbo[0..9] = 49 32 35 46 43 72 66 8 22 92.
FSK grid (record with S symbols, tone grid first..last, step, bps):
n = S - 1 # symbols per frame
nb = last - first + 1
m = nb // step + 1 if step > 1 else nb
hop = [first + (1 if step > 1 and i % 2 == 0 else 0) + step * draw(R, m) for i in range(n)]
inc = float32(float32(S - 2) / float32(24)); acc = float32(1.0); rows = []
for j in range(24):
acc = float32(acc + inc); rows.append(int(acc))
scale = (1 << bps) // 8 # 1 for 8-FSK, 2 for 16-FSK
pilot = {} # symbol index -> pilot tone index
for row in rows:
pilot[row - 2] = scale * draw(R, 8)
Symbols row − 2 (24 of them) are pilot symbols; all other symbols carry data. Example, 2300 Hz record 1: pilot symbols 4, 9, 14, 19, 24, 29, … with tone indices 0, 4, 4, 4, 0, 5, ….
PSK and OFDM marker map (nc carriers, markers per carrier):
for c in range(nc): # carriers in order
row = []
while len(row) < markers:
if qam: v = 3 + (first + c) % 2 + 8 * draw(R, (S - 3) // 8) # 16/32QAM OFDM
else: v = 5 + draw(R, S - 8) # PSK and DPSK-OFDM
if v not in row: row.append(v) # distinct only
marker_pos[c] = row
first is the OFDM first-bin number; it is 0 for PSK. A marker at value v sits at:
- PSK: frame symbol index
k = v, a range of 5..S−4. - DPSK-OFDM: frame row
r = v − 2, a range of 3..S−6. - QAM-OFDM: frame row
r = v − 2, which is always the row right after a pilot of that bin (see below).
The reference implementation also serialises these tables (chan, turbo as big-endian u16 or u24 when N > 65 536, then "other" as u16, followed by a CRC-16) into a .dat blob. That blob is a storage detail and not part of the air interface.
Bit-to-symbol mapping and constellations#
Bits are taken from tx in order, bps at a time, MSB first: v = Σ tx[p+i]·2^(bps−1−i). Data cells are filled carrier-major for PSK and OFDM (carrier 0 symbols 1…, then carrier 1, …) and in time order for FSK. Marker, pilot and reference positions are skipped. Each frame consumes exactly N bits.
| bps | Name | Point for value v = 0..M−1 |
|---|---|---|
| 1 | BPSK | +1, −1 |
| 2 | QPSK | 1, j, −j, −1 (0°, 90°, 270°, 180°) |
| 3 | 8PSK | 1, e^{jπ/4}, e^{j3π/4}, j, e^{−jπ/4}, −j, −1, e^{−j3π/4} (0°, 45°, 135°, 90°, 315°, 270°, 180°, 225°) |
| 4 | 16QAM | I = A[v>>2], Q = A[v&3], A = (−0.7778175, −0.2592725, +0.7778175, +0.2592725) = (−3, −1, +3, +1)·1.1/(3√2) |
| 5 | 32QAM (cross) | B = (0.2121320, 0.6363961, 1.0606602) = (1, 3, 5)·0.3/√2. First-quadrant points v = 0..7: (B[iI], B[iQ]) with (iI,iQ) = (0,0), (1,0), (1,2), (2,0), (0,1), (1,1), (0,2), (2,1). Then v = 8..15 = conj(point v−8), v = 16..23 = −conj(point v−16), v = 24..31 = −(point v−24). |
All PSK maps are Gray-coded. The 16QAM per-axis map is Gray (00→−3, 01→−1, 11→+1, 10→+3). In 32QAM the two MSBs select the quadrant (00: +I+Q, 01: +I−Q, 10: −I+Q, 11: −I−Q). Constellations are not normalised to unit mean energy: 16QAM has peak |z| = 1.1, and 32QAM has corner points at (1.0607, 0.6364). PSK points have unit magnitude.
FSK Gray map (data value → tone index t):
| v | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| t | 0 | 1 | 3 | 2 | 7 | 6 | 4 | 5 | 15 | 14 | 12 | 13 | 8 | 9 | 11 | 10 |
8-FSK uses the first 8 entries.
Burst structure and timing#
A transmission (burst) carries one or two frames of the same record. A two-frame burst is the "×2" mode the ARQ uses.
| lead-in (L symbols) | frame 1 (S−1 symbols) | [frame 2 (S−1 symbols)] | tail |
- No preamble or sync word. Frames have no fixed preamble. Receivers acquire time and frequency from the known markers/pilots and the known scrambling phasors inside every frame (see Receiver guidance).
- Lead-in.
L = ⌈0.080 s / T_s⌉symbols, or⌈0.120 s / T_s⌉for 16/32QAM and 16-FSK levels (bps ≥ 4). Lead-in symbols are ordinary symbols of the level's waveform with arbitrary content (the reference draws them from a local random source). They let the radio's ALC and the remote receiver's filters settle. A receiver MUST NOT depend on their content. - Frames follow back to back with no gap. Each frame restarts its own symbol/row index at 0: phasor index, marker and pilot positions, DPSK reference, whitening and bit pointer.
- Tail. FSK: the last
16·sps/32samples are faded with the half-cosinefall(n)below. OFDM: the last 32 samples are faded. PSK: one zero symbol is appended and the pulse-shaping and interpolation filter tails run out.
fall(n)[k] = 0.5·(1 + cos((k + 0.5)·π/n)), k = 0..n−1.
Example (2300 Hz, record 4, 16-FSK, T_s = 10.667 ms): 12 lead-in + 395 frame symbols = 4 341.3 ms on air for one frame, 8 554.7 ms for two.
FSK waveform (hopped M-FSK)#
| Item | Definition |
|---|---|
| Samples per symbol | Ns = 16·sps = 2048, 1024 or 512 (sps = 128, 64, 32) → T_s = 42.667, 21.333, 10.667 ms |
| Tone grid | FFT bins of Ns: frequency f = bin · 48000/Ns (23.4375, 46.875 or 93.75 Hz spacing). Allowed bins first..last. |
| Symbol i of a frame | tone index t_i = pilot[i] for a pilot symbol, else GRAY[v] for the next bps data bits |
| Transmitted bin | bin_i = first + (hop[i] + step·t_i − first) mod nb (cyclic within the grid) |
| Samples | x[n] = 2·sin(2π·bin_i·n/Ns), n = 0..Ns−1. Phase restarts each symbol; bins are integers, so the phase is continuous. |
Lead-in symbol j (j = 0..L−1) |
bin first + (hop[j+1] + step·t − first) mod nb, with arbitrary t |
With step = 2 the tones of one symbol are two bins apart, and even-indexed symbols add 1 to the hop base. Each frame has S − 1 symbols: 24 pilots and S − 25 data symbols.
PSK waveform (parallel single-carrier DPSK)#
| Item | Definition |
|---|---|
| Symbol rate | 93.75 Bd (32 samples at 3 kHz, 512 at 48 kHz) |
| Carriers | the record's list fc[c] in Hz (see tables). 2–13 carriers. |
| Per-carrier timing offset ("stagger") | 3 carriers: 0, 11, 21 samples at 3 kHz. Otherwise even-indexed carriers 0 and odd-indexed carriers 16 samples (half a symbol). |
| Pulse | RC (β = 1, 33 taps) or RRC (β = 1, span ±1 or ±2 symbols, 65 or 129 taps) at 3 kHz, defined below |
| Interpolation | ×16 to 48 kHz with a 32-tap Hamming-windowed sinc, f_c = 125 Hz |
| Up-conversion | audio = Re{ y48[m]·e^{jφ[m]} }, summed over carriers |
Symbols of carrier c. d is the differential state and P = Pp[c] the PSK phasor row.
syms = [arbitrary_point() * conj(P[k]) for k in range(L)] # lead-in (content arbitrary)
for frame in frames:
d = arbitrary_point() # symbol 0: phase reference
syms.append(d * conj(P[0]))
for k in range(1, S - 1):
if not (k >= 2 and k in marker_pos[c]): # marker: no phase change
d = d * CST[next_bits(bps)] # differential encoding
syms.append(d * conj(P[k]))
syms.append(0) # one zero symbol
syms = [178.0 * s for s in syms] # SCALE (level only)
Shaping (3 kHz domain): y3[n] = Σ_i syms[i] · h[n − stagger_c − 32·i], h indexed 0..L_h−1 (causal). TX sets the last tap of h to 0. Then y48[m] = Σ_n y3[n] · g[m − 16·n].
- RC taps (
T = 16,n = −16..16,x = n/16):h = 1atn = 0;h = 0.5at|n| = 8; otherwiseh = sin(πx)·cos(πx) / (πx·(1 − 4x²)). - RRC taps (
T = 32,n = −32·span..32·span,x = n/32):h = 4/πatn = 0; at|n| = 8,h = (1/√2)·[(1 + 2/π)·sin(π/4) + (1 − 2/π)·cos(π/4)]; otherwiseh = 4x·cos(2πx) / (πx·(1 − 16x²)). - Interpolator (
i = 0..31,m = i − 16,f2 = 125/48000):g = 2·f2atm = 0, elsesin(2π·f2·m)/(π·m); multiplied by0.54 − 0.46·cos(2π·i/32). - All taps are rounded to float32.
- NCO:
φ[m]is a float32 accumulator. It starts atstep = float32(2π·fc/48000)form = 0, addsstepeach sample, and subtractsfloat32(6.2831855)when it exceeds that value.
Only the carrier frequencies, symbol timing, stagger, pulse family and the symbol values (including conj(P) scrambling and marker positions) are needed for interoperability. Exact filter taps and NCO rounding matter only for bit-exact audio.
OFDM waveform#
| Item | Value |
|---|---|
| FFT size / sample rate | 1024 at 48 kHz, bin spacing 46.875 Hz |
| Cyclic prefix | 128 samples (2.667 ms) |
| Symbol length | 1152 samples = 24 ms |
| Window | 32-sample raised-cosine overlap (0.667 ms) inside the prefix |
| Used bins | 500 Hz: 27–37 (11 carriers, 4 markers per carrier). 2300 Hz: 8–56 (49, 1 marker). 2750 Hz: 3–61 (59, 1 marker). |
| Rows per frame | S − 1 = 149 (S = 150), 154 (S = 155) or 50 (S = 51) |
Cells. Row r = 0..S−2, absolute bin b = first + c. Let s = r + 2.
DPSK (QPSK/8PSK) levels:
cell = 1
for r in range(S - 1):
if r == 0: cell = 1 # reference row
elif r in marker_rows[c]: pass # marker: phase repeated
else: cell = cell * CST[next_bits(bps)]
X[r][b] = cell * conj(Po[b][r])
Coherent 16QAM/32QAM levels:
for r in range(S - 1):
s = r + 2
if (b % 2 == 0 and s % 8 == 2) or (b % 2 == 1 and s % 8 == 3):
cell = 1 # scattered pilot
elif r in marker_rows[c]:
cell = cell / abs(cell) # = 1 (always follows a pilot)
else:
cell = CST[next_bits(bps)] # coherent data
X[r][b] = cell * conj(Po[b][r])
Pilots therefore sit on rows r ≡ 0 (mod 8) in even bins and r ≡ 1 (mod 8) in odd bins. Each bin has (S−3)//8 + 1 pilots: 20 for S = 155 and 7 for S = 51. Markers sit one row after a pilot of the same bin, so each marker is a two-symbol pilot pair.
Lead-in rows carry arbitrary constellation points in the used bins, with no phasor scrambling.
Synthesis. For every row (lead-in rows, then frame rows):
x = [2 * Re(sum(X[b] * exp(2j*pi*b*n/1024) for b in used)) for n in range(1024)]
block = x[896:1024] + x[0:1024] # 128-sample CP + body
for k in range(32): # cross-fade with previous symbol
block[k] = fall32[31-k] * block[k] + fall32[k] * prev_x[k] # prev_x = previous row's x (0 for first)
prev_x[0..31] is the cyclic continuation of the previous symbol. Blocks are concatenated, and the last 32 samples of the burst are multiplied by fall(32).
Data-frame layout#
The F bytes of a frame, before whitening:
| Offset | Size | Field |
|---|---|---|
| 0 | R = F − 3 − L |
Payload field |
F − 4 |
1, present only if L = 1 |
Next level: the record number (1..17) the sender offers for the peer's next transmissions |
F − 3 |
1 | Control byte (below) |
F − 2 |
2 | CRC-16/GENIBUS over bytes 0..F−3, big-endian |
Control byte:
| Bits | Name | Meaning |
|---|---|---|
| 7–6 | reply |
Control-frame format (F0..F2) the receiver should use for its reply (see Control frames) |
| 5 | compressed |
Payload is compressed (text/file compression negotiated in the header) |
| 4–2 | hint |
Sender's queue hint 0..6 for rate adaptation (6 = maximum) |
| 1 | last (L) |
Last frame of this turn; a next-level byte is present at F − 4 |
| 0 | full |
The payload field is entirely data (no terminator) |
Short payloads. If the data is shorter than R (full = 0), the payload field is: data, then the terminator byte 0x14, then the session marker byte (if room remains), then 0x00 up to R. The session marker is CRC16_GENIBUS(caller's callsign as ASCII) >> 8, replaced by 0x01 when it would be 0x00 or 0x14. The "caller" is the station whose callsign travels in the header frame. A parser finds the last 0x14 in the field and accepts it if the next byte is the marker, 0x00, or the end of the field.
Example: F = 12, data "HI", reply = 1, hint = 3, last = 0, marker 0x5A gives 48 49 14 5A 00 00 00 00 00 4C 19 DA.
Header frame. The first data frame of a session (see Control frames for when it is sent) uses the same layout with last = 1, compressed = 0, and an 8-byte payload:
| Byte | Content |
|---|---|
| 0–5 | Packed callsign, 48 bits big-endian: 8 × 6-bit codes. Codes 1–7 are the base call characters, padded with 0 (A–Z → 1–26, 0–9 → 27–36, anything else → 0). Code 8 is the SSID: 0 = none, numeric SSIDs as their value, -T = 0x10, -R = 0x11, -X = 0x12, -L = 0x13 (encoder accepts 1–0x13; decoder reads the low 5 bits). |
| 6 | 0x00 (MUST be 0) |
| 7 | Flags: bit 7 valid (1), bits 2–1 compression (0 off, 1 text, 2 files), bit 0 registered |
The rest of the payload field is filled as for a short payload (0x14, marker, zeros). The next-level byte carries the start level offered to the peer.
Output level (informative)#
The modulator output is divided by a per-record normaliser so that every level comes out at about unit RMS:
| Record | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 500 | 1.41 | 1.41 | 1.41 | 0.61 | 0.61 | 1.22 | 4.9678 | 4.9678 | 4.9678 | 4.9678 | 4.9678 | 4.21 | 4.67 | 0.61 | 1.41 | 4.67 | 4.67 |
| 2300 | 1.41 | 1.41 | 1.41 | 1.41 | 0.75 | 0.86 | 1.73 | 2.0 | 2.23 | 10.44435 | 10.44435 | 10.44435 | 10.44435 | 10.44435 | 8.82035 | 10.01805 | 4.67 |
| 2750 | 1.41 | 1.41 | 1.41 | 1.41 | 0.75 | 0.86 | 1.73 | 2.0 | 2.23 | 2.5422 | 11.4219 | 11.4219 | 11.4219 | 11.4219 | 11.4219 | 9.6459 | 10.9557 |
The reference then applies a drive gain 10^((drive_dB − backoff)/20), with backoff = PAPR + 2 + (10 − PAPR)/5 and PAPR in dB per level (FSK 3.0; PSK 4.4–8.9; OFDM 8.2–9.5; values are in the level tables of level.py). In black-box comparison, data frames measured −11.4 dBFS RMS for both the reference and VARA HF. Receivers are level-independent.
Receiver guidance (informative)#
The reference receiver works as follows. Any receiver that reproduces the transmitter definitions above will interoperate.
- Front end. Mix the 48 kHz input by
e^{−jπn/16}(−1 500 Hz). Decimate by 4 with a 33-tap Kaiser low-pass (6 kHz, β = 5.65), then by 4 again with a 273-tap Kaiser low-pass (1 520 Hz, β = 5.65). Scale by 2 and multiply by(−1)^m. The result is a 3 kHz complex stream in which audio frequencyfappears atfmod 3 000 Hz. All detectors run at this rate: OFDM uses a 64-point FFT and 72-sample symbols, PSK uses 32-sample symbols, and FSK uses ansps-point FFT. - Acquisition. Each expected record has its own detector. Every detector correlates against the in-frame structure, since there is no preamble:
* FSK: a sliding power spectrum (hop 4 samples) is checked at the 24 known pilot (symbol, bin) positions for frequency shifts of ±⌈search/bin⌉ bins. The metric is pilot energy over total energy in the pilot symbols' tone sets, and at least 14 of 24 pilots must be the strongest tone. The search is ±117 Hz before the link is up and ±30 Hz after. Refine timing ±4 samples and frequency in ⅛-bin steps.
* PSK: per-carrier matched filter, then the differential product at lag one symbol. The metric is
|Σ markers · conj(P[k]·P*[k−1])|²/N_m + |Σ data (diff)^M · ref^M|²/N_d, with detection threshold 20 and hold/peak picking. CFO is the phase of the marker correlation divided by 2π·T_s. * OFDM: three frequency hypotheses (0, ±23.4375 Hz, half a bin). The metric is the marker lag-1 correlation plus the M-th-power data correlation (DPSK) or the lag-8 pilot correlation (QAM). Fine CFO comes from the marker phase. Resolve the ±41.67 Hz ambiguity (Fs3/72) by testing −1, 0, +1 cycles. - Demodulation.
* FSK: tone energies, normalised by the median noise of bins below
first, give max-log LLRs over the Gray map. * DPSK (PSK and OFDM ≤ 8PSK): multiply byPto descramble, formz_k·conj(z_{k−1}), derotate by the common phase, estimate noise variance from the markers, and compute max-log LLRs. * QAM: estimate common phase drift from pilots 8 rows apart, then per bin linearly interpolate the pilot channel estimates in time (no frequency interpolation), apply zero-forcing equalisation, and compute |H|²-weighted max-log LLRs. - Decoding. De-interleave with
chan, split the LLRs per the puncturing pattern (punctured positions get LLR 0), run max-log-MAP turbo decoding (10 iterations, extrinsic scale 0.7, early stop on CRC after at least 2 iterations), remove the whitening, and check the CRC. - SNR (as reported to the host): phase-error or pilot-ratio estimate, mapped to VARA's SN scale by subtracting
(9.4 − PAPR_level)dB (constants inrx/snr.py).
Test vectors and uncertainty#
- The level tables, LCG, whitening and phasor sequences, per-record tables and frame examples are checked against the reference implementation's vector set:
levels.json,rnd.json,sequences.json(whitening SHA-2567ac30d1f…bfffover packed bits),dat_tables.json,frames_*.json,tx_levels.json. - The occupied bandwidths, frame lengths and levels were compared black-box against VARA HF 4.9.0, which matched within about 10 Hz and with identical frame lengths. That comparison covered only levels 1–4 (unregistered). Levels above 4 match the reference implementation's tables, but their over-the-air interoperability with VARA HF has not been independently verified here.
- Uncertain: the operational use of extra records 14, 16 and 17 (500 Hz) and 17 (2300 Hz); only 500 Hz record 15 (CQ) is confirmed. The exact interpretation of
hintvalues andreplyformats belongs to the link layer.
Implementation notes#
Source of truth: SPEEDBIRD's pure-Python VARA HF modem, code/libs/speedbird-python/src/speedbird_python/phy/, cross-checked against the reference implementation's Rust physical layer and its test vectors.
| File | Defines |
|---|---|
level.py |
Bandwidths, the 17-entry level tables (S, bps, rate index, K, carriers, bins, markers, pulses), lead-in, airtime, bitrate, amplitude normalisers |
rnd.py |
VB6 Rnd/Randomize LCG and float32-exact draw |
seq.py, tables.py |
Seeds 292/43, whitening, PSK and OFDM phasor tables |
dat.py |
Per-record tables: perm, FSK hop/pilot grid, marker map, .dat serialisation |
crc.py |
CRC-16/GENIBUS |
fec.py |
Frame → bits, whitening, RSC/turbo encoder, puncturing, channel interleave |
turbo.py, decode.py, _jit.py |
LLR split, max-log-MAP turbo decoder, frame decoder |
constellation.py |
BPSK/QPSK/8PSK/16QAM/32QAM maps, bit taking |
fsk.py |
FSK Gray map and modulator |
psk.py |
PSK pulses, stagger, ×16 interpolator, NCO, DPSK modulator |
ofdm.py, ofdm_hf.py |
IDFT, CP and window synthesis, cell layout, QAM pilots |
frame.py, call.py |
Data-frame layout, control byte, header, callsign packing, terminator marker |
tx.py, api.py |
Full transmit chain, drive-level law, convenience API |
demap.py, eq.py, dsp.py |
Soft demappers, DPSK noise estimate, QAM equaliser, Kaiser filters |
rx/frontend.py, rx/fsk.py, rx/psk.py, rx/ofdm.py, rx/receiver.py, rx/snr.py |
Receiver front end, per-family detectors/decoders, streaming assembly, SNR |
Control frames and link establishment#
This section covers everything VARA HF sends that is not a payload-carrying data frame: the multi-tone control codewords (connect request/reply, ACK/NAK, turn control, disconnect), the header data frame the caller uses to identify itself, the connect handshake state machine, keepalive, disconnect, CW identification, CQ announcements and the busy-channel detector.
The data-frame PHY (FSK/PSK/OFDM levels, FEC, whitening) is described in the data-frame PHY section. ARQ data transfer (ACK level steps, double frames, compression) is described in the ARQ section. This section points to those sections where it needs them and does not repeat them.
Keywords MUST, SHOULD and MAY are normative. Every number here comes from the SPEEDBIRD reference implementation's source. Items marked [uncertain] are behaviour the code shows but whose purpose, or whose match with the original modem, has not been confirmed.
Conventions#
| Quantity | Value |
|---|---|
| Audio sample rate | 48 000 Hz, real |
| Control symbol length | 2048 samples = 42.667 ms (23.4375 baud) |
| Tone bin k | frequency k × 48000/2048 = k × 23.4375 Hz. Each tone is sin(2π·k·n/2048), n = 0..2047, restarted every symbol. Because k is an integer the phase is continuous. |
| Timing tick | 64 samples = 1.333 ms (750 ticks/s). One control symbol = 32 ticks. |
| Session clock | integer sample count at 48 kHz |
| Byte order | big-endian unless stated otherwise |
| CRC | CRC-16/GENIBUS: poly 0x1021, init 0xFFFF, not reflected, xorout 0xFFFF |
| PRNG | VbRnd, the Visual Basic 6 Rnd clone: 24-bit LCG s ← (s·0xFD43FD + 0xC39EC3) mod 2²⁴, start state 0x050000. draw(m) = ⌊f32(s/2²⁴ · m)⌋ (single-precision product, round-half-even to a 24-bit mantissa, then truncate); rand_int(n) = draw(n+1). The same generator is used for whitening (see the data-frame PHY section). |
seed_rnd_wide(x) (used for every codebook seed below):
seed_rnd_wide(x):
Rnd(-1.0) # state ← f32 bits of -1.0 folded to 24 bits, then one LCG step
Randomize(x mod 32768) # VB Randomize: hi = upper 32 bits of f64(x mod 32768)
# mid = (hi & 0xFFFF) XOR (hi >> 16); state bits 8..23 ← mid
advance(x div 32768 + 1) # LCG steps
Control-frame waveform#
A control frame is a burst of non-coherent MFSK symbols: a lead-in followed by a codeword. Each symbol is one or two pure tones on the 23.4375 Hz grid. Nothing is transmitted between symbols.
Formats#
There are three control formats. F0 is the most robust and F2 the fastest.
| Format | Codeword symbols | Tones/symbol | Cells (symbols×tones) | Detection min_hits |
Lead-in short / long | Detection threshold snr_db |
k_db |
Normalised ctrl threshold† |
|---|---|---|---|---|---|---|---|---|
| F0 | 31 | 1 | 31 | 19 | 40 ms / 40 ms → 1 / 1 sym | −15.5 dB | 3.0 | −21.9 dB |
| F1 | 15 | 1 | 15 | 13 | 40 ms / 80 ms → 1 / 2 sym | −7.5 dB | 3.0 | −13.9 dB |
| F2 | 7 | 2 | 14 | 12 | 40 ms / 160 ms → 1 / 4 sym | −3.5 dB | 6.0 | −6.9 dB |
† ctrl_thr(f) = snr_db − (9.4 − k_db), compared against the normalised SNR (see Reply format).
Lead-in symbols = ⌈lead_ms / 42.667⌉ + extra. The long lead-in applies to codes GO_AHEAD
(14), NO_TRAFFIC (21), BREAK (49) and IDLE (50). All other codes use the short lead-in. extra is
9 on the first connect request, 7 on a connect reply (0 in chat mode), and 0 otherwise.
Resulting on-air lengths:
| Frame | Symbols | Duration |
|---|---|---|
| F0, any code | 1 + 31 = 32 | 1365.3 ms |
| F0 connect request, first attempt | 1 + 9 + 31 = 41 | 1749.3 ms |
| F1, short lead-in | 1 + 15 = 16 | 682.7 ms |
| F1, long lead-in | 2 + 15 = 17 | 725.3 ms |
| F1 connect reply (non-chat) | 1 + 7 + 15 = 23 | 981.3 ms |
| F2, short lead-in | 1 + 7 = 8 | 341.3 ms |
| F2, long lead-in | 4 + 7 = 11 | 469.3 ms |
Lead-in grid (fixed, shared by all stations)#
The lead-in tones come from a single VbRnd stream started from 0x050000 with no seeding.
Formats are taken in order F0, F1, F2. Each format gets 100 rows, and each row holds ntones
distinct tones rand_int(34) + 50, which gives bins 50..84 (1171.9–1968.8 Hz). A frame with L
lead-in symbols sends the first L rows of its format's grid:
| Format | First rows (bins) |
|---|---|
| F0 | 74, 68, 70, 60, 60, 77, 50, 76, 78, 74, 51, 64, … |
| F1 | 62, 67, 55, 66, 59, 72, 68, 55, 82, 72, … |
| F2 | (67,64), (74,56), (64,69), (78,68), (64,67), (57,71), … |
The receiver does not use the lead-in for detection (see Detection). It is a fixed preamble that lets a receiver settle AGC and VOX/PTT. Because it is the same for every station, it is also a usable signature for "a VARA control frame starts here".
Amplitude#
The symbol waveform is (Σ tones)/ntones × 2·ntones/norm, with norm = √2 for one tone and 2 for
two tones. Each single tone therefore has peak amplitude √2, and each tone of a pair has amplitude
1. The frame is then scaled by gain = dB→amp(drive_dB − backoff(k_db)), where
backoff(u) = u + 2 + (10 − u)/5. That is 6.4 dB for F0/F1 and 8.8 dB for F2.
Tone alphabet and codeword families#
Codeword tones are arranged in blocks of 14 adjacent bins. Which blocks are used depends on the codeword family:
| Family | Used for | n (blocks − 1) |
First bin off |
Bins used | Audio range |
|---|---|---|---|---|---|
| 1 | 500 Hz session codes, all KISS and CQ codes, 500 Hz connect requests and replies | 1 | 50 | 50..76, even bins only (14 tones) | 1171.9–1781.3 Hz |
| 2 | 2300 Hz session codes, 2300 and 2750 connect requests, 2300 replies | 4 | 29 | 29..98 (70 tones) | 679.7–2296.9 Hz |
| 3 | 2750 Hz session codes, 2750 replies | 5 | 22 | 22..105 (84 tones) | 515.6–2460.9 Hz |
Family of a code c in a session of bandwidth bw:
family(c, bw):
if c is a CONNECT_REPLY for band B: return fam(B)
if c is a CONNECT_REQ for band B: return fam(2300) if B == 2750 else fam(B)
if c in {KISS_L1, KISS_L2, KISS_L4, CQ}: return 1
return fam(bw) # fam(500)=1, fam(2300)=2, fam(2750)=3
Codeword generator. It produces nsym−1 symbols and makes two PRNG draws per tone per symbol:
gen_code(r, fmt, v): # r = VbRnd, v = family
n, off = {1:(1,50), 2:(4,29), 3:(5,22)}[v]
for s in 2..nsym: # codeword symbol index i = s-2
blocks = []
while len(blocks) < ntones: # choose distinct blocks
b = r.draw(n+1)*14 + off
if b not in blocks: blocks.append(b)
par = 1 if (s even and v != 1) else 0 # families 2/3: odd bins on even i
for each b in blocks:
tone = b + par + 2*r.draw(7) # one of 7 positions of the block's parity
emit symbol(tones)
Each symbol therefore carries one position out of the 7 positions of one parity within a 14-bin block. Families 2 and 3 alternate parity from symbol to symbol, starting with odd bins at codeword symbol 0. Family 1 always uses even bins.
Codebooks (per-session keying)#
The codeword for a code is not fixed. Codewords are drawn from PRNG streams seeded from
callsign hashes, so control codewords are effectively addressed: a station only decodes codewords
built with keys it knows. A codebook holds codes[side][fmt][code] for code = 1..58, where side 0
is what we receive (built with the peer's role offset) and side 1 is what we transmit (built with
our own role offset).
Keys:
| Symbol | Value |
|---|---|
S (session seed) |
call_hash(answerer's callsign as dialled) |
C (connect key) |
call_hash(caller's callsign) |
book_off(role) |
Caller 50, Answerer 278 |
connect_off(role) |
Caller 850, Answerer 1078 |
req_seed_off(bw) |
500 → 7, 2300 → 0, 2750 → 8 |
fo |
fmt index (0, 1, 2) + book_off(side's role) |
Construction for each side and each format:
r.seed_rnd_wide(S + 10 + fo)
for c in 1..58:
if c is CONNECT_REQ(band B, alias k): # codes 26..40
H = S if (side == tx and k == 0) else mycall_hash[k]
r.seed_rnd_wide(H + fo + req_seed_off(B))
if c == 41 (CONNECT_REPLY_2750 q1): r.seed_rnd_wide(S + 300 + fo)
if c == 47 (KISS_L2): r.seed_rnd_wide(0xCD80A4 + fo)
if c == 48 (CQ): r.seed_rnd_wide(0xA3CE37 + fo)
if c == 51 (START_LEVEL_1): r.seed_rnd_wide(S + 1500 + fo)
if c == 58 (KISS_L4): r.seed_rnd_wide(0x49E730 + fo)
codes[side][fmt][c] = gen_code(r, fmt, family(c, bw))
r.seed_rnd_wide(0x02D277B0 + fo); codes[side][fmt][45] = gen_code(r, fmt, 1) # KISS_L1
Codes between reseed points keep drawing from the same stream in numerical order. Codes 1–25 come
from the S+10 stream, 42–46 continue the S+300 stream, 49–50 continue the CQ stream, and 52–57
continue the S+1500 stream.
Connect codes. Once both callsigns are known (the caller from HeaderSent onwards, the
answerer once it has decoded the header), BREAK (49) and IDLE (50) are regenerated from the
caller's key:
for side, role in ((rx, peer_role), (tx, own_role)):
for fmt in F0, F1, F2:
r.seed_rnd_wide(C + fmt + connect_off(role))
codes[side][fmt][BREAK] = gen_code(r, fmt, family(BREAK, bw))
codes[side][fmt][IDLE] = gen_code(r, fmt, family(IDLE, bw))
The PRNG state after this loop (tx side, F2) seeds the transmitter's random lead-in draws for data frames and the BREAK back-off draw. See the data-frame PHY section.
Keys in force per state:
| State | S |
C |
Role |
|---|---|---|---|
| Listen | 0 (only the request codes matter; they use mycall_hash[k]) |
– | Answerer |
| Calling | call_hash(remote) |
– | Caller |
| HeaderSent / connected, caller | call_hash(remote) |
call_hash(mycall) |
Caller |
| Answering / connected, answerer | call_hash(mycall alias) |
call_hash(remote) once known |
Answerer |
The KISS and CQ announce codes use a fixed unproto codebook: S = 0, all aliases 0, role
Caller, bandwidth 500, transmit side. Every VARA station can therefore decode them.
Control code set#
Code numbers 1..58. A code's number only identifies its slot in the codebook; the waveform comes from the codebook. "Dir": C = caller→answerer, A = answerer→caller, S = the station that currently sends data, R = the station that currently receives data, * = either.
| Code | Name | Dir | Meaning |
|---|---|---|---|
| 1 | ACK_STAY | R | Frame(s) OK, stay at the current level |
| 2 | NACK | R / A | Frame(s) failed. Step down (ARQ section). In the handshake: "header not decoded, resend one level lower". |
| 3 | QRT | * | Disconnect; the sender will send a CW ID |
| 4 | – | Unused | |
| 5 | ACK_UP2 | R | OK, go up 2 levels |
| 6 | ACK_DOWN | R | OK, go down 1 level |
| 7 | ACK_UP1 | R | OK, go up 1 level |
| 8 | ACK_UP3 | R | OK, go up 3 levels |
| 9 | ACK_UP4 | R | OK, go up 4 levels |
| 10 | ACK_SECOND_ONLY | R | Double frame: only the 2nd frame OK |
| 11 | ACK_FIRST_ONLY | R | Double frame: only the 1st frame OK |
| 12 / 13 | ACK_REQ_0 / ACK_REQ_1 | S / C | "No reply heard, repeat your last control." Alternates 0/1 (one-bit sequence) so a repeat can be told apart from a new request. |
| 14 | GO_AHEAD | * | Grant the turn (reply to BREAK) |
| 15–18 | CONNECT_REPLY_2300 q1..q4 | A | Accept a call on 2300 Hz; q is the level the caller should send its header at |
| 19 | NACK_MISSED | R | The receiver timed out waiting for data (answer to ACK_REQ). Step down by up to 2 levels and use a more robust ctrl format. |
| 20 | – | Unused | |
| 21 | NO_TRAFFIC | * | Reply to IDLE: nothing to send |
| 22–25 | CONNECT_REPLY_500 q1..q4 | A | Accept on 500 Hz |
| 26–30 | CONNECT_REQ_2300 alias 0..4 | C | Call request, 2300 Hz, addressed to the callee's alias k |
| 31–35 | CONNECT_REQ_500 alias 0..4 | C | Call request, 500 Hz |
| 36–40 | CONNECT_REQ_2750 alias 0..4 | C | Call request, 2750 Hz (sent with family-2 tones) |
| 41–44 | CONNECT_REPLY_2750 q1..q4 | A | Accept on 2750 Hz |
| 43 | REJECT | A | Header refused (header "valid" bit clear). Same number as CONNECT_REPLY_2750 q3; see Discrepancies and uncertain items. |
| 45 | KISS_L1 | * | Unproto: a KISS frame follows at level 1 (500 Hz) |
| 46 | QRT_NO_CWID | * | Disconnect; the sender will not send a CW ID |
| 47 | KISS_L2 | * | Unproto: a KISS frame follows at level 2 |
| 48 | CQ | * | Unproto: a CQ frame follows (500 Hz record 15) |
| 49 | BREAK | * | Request the turn / "I hold the turn" (connect-keyed) |
| 50 | IDLE | * | Keepalive poll / "I have nothing" (connect-keyed). Also the base number for START_LEVEL. |
| 51–57 | START_LEVEL_1..7 | * | GO_AHEAD + "start sending at level n" |
| 58 | KISS_L4 | * | Unproto: a KISS frame follows at level 4 |
Helper mappings: connect_req(bw,k) = REQ_BASE[bw] + k (k < 5),
connect_reply(bw,q) = REPLY_BASE[bw] + q − 1 (1 ≤ q ≤ 4),
start_level_code(n) = 50 + n (1 ≤ n ≤ 7).
Detection#
A receiver MUST only search for the codes the current state accepts (accept sets below), each in all three formats, built from the current codebook's receive side. Reference detector:
- Front end. Mix the 48 kHz input with e^(−jπn/16) (−1500 Hz) and decimate by 16 in two Kaiser FIR stages (33 taps at 6 kHz cut-off, then 273 taps at 1520 Hz, β = 5.65). Multiply by (−1)^m to get a 3 kHz complex baseband in which FFT bin k (N = 128) is audio k × 23.4375 Hz.
- STFT. Use a 128-sample window (one symbol), hop 16 samples (1/8 symbol = 5.33 ms) and a zero-padded 256-point FFT (11.72 Hz half-bins). For every half-bin, also compute the sum and the maximum of power over the 14 tones of a block (stride 2 half-bins).
- Cell test. For a candidate codeword, time index j and frequency offset o (half-bins), take one STFT row per symbol (8 hops apart). A cell (symbol, tone at bin b) is a hit if P(2b+o) ≥ max over its 14-tone block and P > 10⁻⁹. Its tone must be the loudest of its block.
- Accept when hits ≥
min_hits(19/31, 13/15, 12/14) and score = mean(P / block_sum) ≥ 0.15. Keep the best (offset, code) per time step. - Search range. Offsets ±10 half-bins (±117 Hz) when not linked, ±3 (±35 Hz) when linked. "Linked" means any state other than Listen, Answering, Calling and HeaderSent.
- Peak hold. Report a detection after 2 hops without a better metric, then ignore that format for 4·(nsym−1) hops (half a codeword).
- Outputs. Report
t_end(end of the codeword) and the frequency offset (parabolic interpolation). SNR = 10·log₁₀(mean tone/(block-noise)) + 10·log₁₀(ntones) − 3.01 − 13.8 dB (in 2500 Hz).snr_norm = snr − (9.4 − k_db).
Only codeword symbols are tested. The lead-in is ignored.
Reply format selection#
Every data frame's control byte carries a 2-bit reply field (see the ARQ section) that tells the peer which format (F0/F1/F2) to use for its next control frame. After each decoded control frame the receiver updates:
snr = min(snr_norm_now, snr_norm_prev)
missed = max(cells − hits now, cells − hits prev)
fmt = F0
for f, max_missed in ((F0,31),(F1,1),(F2,0)):
if max_missed < ntones(f)/ntones(rx_fmt)*missed or snr <= ctrl_thr(f): break
fmt = f
The sender of data uses format_for_level(bw, level): F0 for levels 1–3, F1 for level 4 (and for
level 5 on 500 Hz), F2 above that. This is the strongest format whose ctrl_thr ≤ the level's
step threshold.
Over-the-air callsign encoding#
Callsigns reach the air in three ways:
| Where | Encoding | Reveals |
|---|---|---|
| Connect request codeword | codeword seeded with call_hash(callee) |
callee (only to someone who tests that hash) |
| Connect reply codeword | codeword seeded with call_hash(callee) (session seed S) |
callee |
| Header data frame | 6-byte packed caller callsign, in clear (after the data PHY's whitening) | caller |
| BREAK/IDLE after connect | codeword seeded with call_hash(caller) |
caller |
| CQ frame | 6-byte packed call + bandwidth + CRC | sender |
| CW ID | Morse | sender base call |
call_hash (24 bits)#
call_hash(call): # call = ASCII text exactly as configured/decoded, incl. "-SSID"
if call == "": return 0
c1 = CRC16_GENIBUS(call)
c2 = CRC16_GENIBUS(last 3 bytes of call) # whole call if shorter
return ((c2 >> 8) << 16) | c1
Examples: call_hash("N0CALL") = 0xD80986, call_hash("N0CALL-1") = 0x0DFFEE.
Because the hash is taken over the text, both ends MUST spell the callsign identically. The
answerer rebuilds the caller's text from the header (see unpack_call), so a caller SHOULD use the
canonical form BASE or BASE-n with no leading zeros. SSIDs are part of the hash: N0CALL and
N0CALL-1 are different addresses.
Packed callsign (header frames)#
Six bytes = 8 fields of 6 bits, MSB first:
| Field | Content |
|---|---|
| 0..6 | base call characters, left-aligned, padded with 0. A–Z → 1–26, 0–9 → 27–36, anything else (including lowercase) → 0 |
| 7 | SSID code |
SSID code: none → 0, numeric -1…-19 → 1–19, -T → 0x10, -R → 0x11, -X → 0x12,
-L → 0x13. Other suffixes encode as 0. A base longer than 7 characters is truncated to 8 fields,
and the SSID is then lost.
Unpacking reads fields 0..6 (1–26 → A–Z, 27–36 → 0–9, else space) and strips trailing
spaces. The SSID is read from the low 5 bits of field 7: 0 → none, 0x10–0x13 → -T/-R/-X/-L,
otherwise -n. Numeric SSIDs 16–19 are therefore indistinguishable from -T/-R/-X/-L on receive.
Examples: N0CALL → 39 B0 C1 30 C0 00, N0CALL-1 → 39 B0 C1 30 C0 01.
Terminator marker#
term_marker(call) = CRC16_GENIBUS(call) >> 8, replaced by 0x01 if it equals 0x00 or 0x14. The
marker of the caller's callsign follows the 0x14 terminator in every non-full data frame of
the session, in both directions. It is a weak sender check. Examples: N0CALL → 0x09,
N0CALL-1 → 0xFF.
Mandatory CW ID rule ("US call")#
is_us_call(base) is true when all of the following hold:
- the base is 4–6 alphanumeric characters starting with N, K, W or A;
- it contains exactly one digit, at index 1 or 2;
- it is not A followed by M–Z;
- a 2×3 call starts with K or W;
- a 2×2 call starting with A has AA–AL as its prefix.
For such a call the station always sends a CW ID at disconnect, whatever the CWID setting. N0CALL
is a US-format call.
Connect request (the call)#
- Code:
CONNECT_REQ_<bw>with alias 0 (26, 31 or 36), in format F0, from the caller's transmit codebook. For alias 0 the transmit side usesH = S = call_hash(destination), so the codeword stream is seeded withcall_hash(dest) + 50 + req_seed_off(bw)(+0 for F0). - The first attempt has
extra = 9lead-in symbols (1749 ms total). Retries have none (1365 ms). - The request carries only the destination. It contains no caller identity, no licence flag and no level. Bandwidth is implied by which code (26/31/36) matches.
- A station listening with up to 5 callsigns (MYCALL aliases) builds receive codewords for alias
k from
call_hash(mycall[k])and answers asmycall[k]. A 500 Hz station accepts onlyCONNECT_REQ_500. A 2300 or 2750 station accepts bothCONNECT_REQ_2300andCONNECT_REQ_2750. - A station with
LISTEN OFFdoes not arm any control entries in Listen, so it never answers.
Connect reply#
- Code:
CONNECT_REPLY_<bw>with q ∈ 1..4, in format F1, withextra = 7(0 in chat mode). It is sent from the answerer's transmit book, so the answerer seeds it withS + 10 + 278 + 1 = call_hash(answerer) + 289. q = level_from_snr(snr_norm of the request, max 4, margin 6 dB): the highest level ≤ 4 whose step threshold is more than 6 dB below the measured SNR, minimum 1. The caller MUST send its header at level q.- The reply's band tells the caller the agreed bandwidth (see Bandwidth agreement).
Header frame (caller identification)#
After a reply, the caller sends one data frame at level q (PHY per the data-frame PHY section) whose payload is:
| Byte | Content |
|---|---|
| 0..5 | packed caller callsign (pack_call(mycall)) |
| 6 | 0x00 (MUST be 0; the receiver checks it) |
| 7 | flags: bit 7 valid (always 1 from a caller), bits 2..1 comp (compression offer: 0 off, 1 text, …; ARQ section), bit 0 registered |
| … | standard data-frame tail: if the frame is not full, 0x14 terminator, term_marker(caller), zero pad |
| L−4 | offer: the start level the caller asks the answerer to use for its first data (next_level field of a "last" frame) |
| L−3 | control byte: reply<<6 \| compressed<<5 \| hint<<2 \| last<<1 \| full. In a header, last = 1, compressed = 0 and reply is the ctrl format the answerer should use. |
| L−2..L−1 | CRC-16/GENIBUS over bytes 0..L−3 |
L = frame length of level q (2300/2750: 12, 25, 50, 92 bytes for levels 1–4; 500: 12, 25, 37, 46). At level 1 the 8-byte payload fills the frame (full = 1), so there is no terminator or marker.
Example: N0CALL-1, unregistered, offer 4, at 2300 level 4 (92 bytes):
39 B0 C1 30 C0 01 | 00 | 80 | 14 FF | 00 ×80 | 04 | 02 | DD 27
Receiver validation (Header.parse): the frame MUST pass CRC, be ≥ 11 bytes, have last = 1 and
compressed = 0, and have byte 6 = 0. Otherwise it is treated as not decoded.
Licence signalling. registered (flag bit 0) is the only licence indication on air. The
caller's flag decides the link status: the answerer adopts it for the whole link and reports
LINK REGISTERED or LINK UNREGISTERED. An unregistered caller MUST set comp = 0 (compression
off) and MUST offer at most level 4. On an unregistered link each side caps its own ACK-driven
level ceiling at 4 (UNREGISTERED_MAX_LEVEL).
Bandwidth agreement#
| Caller bw | Callee bw | Request heard? | Callee replies with | Link bw |
|---|---|---|---|---|
| 500 | 500 | yes | REPLY_500 | 500 |
| 500 | 2300/2750 | no (not in accept set) | – | no link |
| 2300/2750 | 500 | no | – | no link |
| 2300 | 2300 or 2750 | yes | REPLY_2300 | 2300 |
| 2750 | 2300 | yes | REPLY_2300 | 2300 |
| 2750 | 2750 | yes | REPLY_2750 | 2750 |
A callee answering a 2750 request uses its own bandwidth. A callee hearing a 2300 request switches to 2300. A 2750 caller accepts both REPLY_2300 and REPLY_2750 and adopts the band of the reply. Both sides then rebuild codebooks, adaptation and timing for that band.
Initial speed levels#
| What | Who decides | Rule |
|---|---|---|
| Header level q (caller → answerer) | answerer, from the request SNR | level_from_snr(snr, ≤4, 6 dB); on NACK the caller drops one level (rdown) |
| Offer n (answerer's first data level) | caller | level_from_snr(ctrl SNR, cap, 3 dB). cap = 4 if unregistered; the highest non-QAM level if the file-transfer (B2F "FS") phase is active before the header; otherwise 7 (500 Hz) or 6 (2300/2750), lowered one level for text compression. A host offer_level override MAY replace this. |
| Caller's first data level | answerer | START_LEVEL_n and the next_level byte at the end of each turn (ARQ section) |
The caller repeats n on air as START_LEVEL_n (code 50+n) when it answers the answerer's first
BREAK.
Handshake state machine#
States: Listen, Calling, Answering, HeaderSent, Break, Receiving, Sending, IdleSent, Idle,
FqWait, Qrt, Closing. The tables below cover the link-establishment part. Data-phase transitions
are in the ARQ section.
Accept sets (codes a state listens for)#
| State | Accepted codes |
|---|---|
| Listen | CONNECT_REQ for own band(s), aliases 0..min(#MYCALL,5)−1 |
| Calling | CONNECT_REPLY for own bw (2750 also accepts 2300) |
| Answering | QRT, ACK_REQ_0/1, QRT_NO_CWID, CONNECT_REQ (repeats) |
| HeaderSent | NACK, QRT, QRT_NO_CWID, BREAK, IDLE |
| Break | QRT, ACK_REQ_0/1, GO_AHEAD, QRT_NO_CWID, IDLE, START_LEVEL_1..7 (chat mode: BREAK instead of START_LEVEL) |
| Receiving | QRT, ACK_REQ_0/1, QRT_NO_CWID, BREAK, IDLE |
| Sending | all ACK/NACK codes, QRT, QRT_NO_CWID, BREAK, IDLE |
| IdleSent | QRT, ACK_REQ_0/1, NO_TRAFFIC, QRT_NO_CWID, BREAK |
| Idle | QRT, QRT_NO_CWID, BREAK, IDLE |
| FqWait | QRT, ACK_REQ_0/1, QRT_NO_CWID |
| Qrt, Closing | none |
A control frame that arrives while the station is transmitting, or that is not in the accept set, MUST be ignored.
Caller#
connect(mycall, remote): # only from Listen
marker ← term_marker(mycall); attempts ← 0; state ← Calling
request()
request():
feed watchdog (30 s); attempts += 1
send CONNECT_REQ(bw, alias 0), F0, extra = 9 if attempts == 1 else 0
on tx done (Calling): deadline ← now + reply_window(F1)
on deadline (Calling): if attempts < RETRIES: request()
else: host UnableToConnect; close
on CONNECT_REPLY(band, q):
measure ctrl delay; adopt band; lvl ← q
comp ← configured compression if registered else Off
n ← offer level (see Initial speed levels)
state ← HeaderSent; feed watchdog (60 s); send HEADER at level q
on tx done (HeaderSent): deadline ← now + ack_window(q) + lead(f,BREAK) + codeword(f),
f = min(own fmt, reply fmt)
on deadline (HeaderSent): send ACK_REQ_alt in f (first time), then progressively more robust
formats; after an ACK_REQ the window is reply_window(F0)
on NACK: q ← rdown(q); resend HEADER
on BREAK: CONNECTED; send START_LEVEL_n in format_for_level(q); state ← Receiving
on IDLE: CONNECTED; reply NO_TRAFFIC (→ Idle), or BREAK if data queued (→ Break),
or QRT if a disconnect is pending
Note: after the last request the session reports UnableToConnect and runs the normal close path
(see Disconnect and abort). That path still sends a CW ID if CW ID is enabled. [uncertain]
whether the original modem IDs after a failed call.
Answerer#
in Listen, on CONNECT_REQ(band B, alias k):
adopt bw (see Bandwidth agreement); mycall ← MYCALL[k]; role ← Answerer
q ← level_from_snr(request snr_norm, 4, 6 dB); expect data at level q
host "PENDING"; state ← Answering; feed watchdog (30 s)
send CONNECT_REPLY(bw, q), F1, extra 7 (0 in chat)
in Answering:
on CONNECT_REQ again: recompute q, resend the reply (caller missed it)
on ACK_REQ == expected parity: toggle; send NACK, expect step_down(q)
(and the 3 levels below q as fallbacks)
on ACK_REQ, other parity: resend last control
on HEADER frame decoded:
bad CRC or parse failure → NACK (expect one level lower)
remote ← header.call; marker ← term_marker(remote)
reply fmt ← header.reply; next_tx_level ← min(header.offer, top)
if not header.valid: send REJECT; state ← Qrt
registered ← header.registered; comp ← header.comp
CONNECTED (host: "CONNECTED caller answerer bw"), feed watchdog (60 s)
if a disconnect is pending: QRT
elif chat mode: send IDLE → IdleSent
else: hold_from ← now; send BREAK → Break (BREAK is connect-keyed)
on watchdog: host "CANCELPENDING"; back to Listen (no CW ID, no "DISCONNECTED")
In the Break state the answerer receives GO_AHEAD or START_LEVEL_n from the caller (n becomes its first data level). It then applies the answerer hold rule. If not in chat mode and the host has queued nothing, it sends BREAK again ("I hold the turn") for up to 3300 ms after the header, and IDLE after that. If only a partial host message is queued, it holds up to 4500 ms; otherwise it starts Sending. This gives a BBS or gateway time to produce its banner without handing the turn back. Details are in the ARQ section.
Message sequence (2300 Hz, non-chat, N0CALL-1 calls N0CALL)#
N0CALL-1 (caller) N0CALL (answerer)
state: Calling state: Listen
|--- CONNECT_REQ_2300 a0 F0 lead 1+9, 1749 ms ---------------->| codeword key: hash("N0CALL")+50
| (no reply within 950 ticks = 1.267 s → repeat, lead 1) |
|--- CONNECT_REQ_2300 a0 F0 1365 ms --------------------------->| PENDING, → Answering
|<-- CONNECT_REPLY_2300 q F1 lead 1+7, 981 ms -------------------| q = f(SNR) ≤ 4, key hash("N0CALL")+289
→ HeaderSent |
|=== HEADER data frame @ level q: "N0CALL-1", flags, offer n ====>| decode OK
| | CONNECTED, → Break
|<-- BREAK (key hash("N0CALL-1")+1078+fmt, long lead) -----------|
CONNECTED, → Receiving |
|--- START_LEVEL_n fmt = format_for_level(q) -------------------->|
| | hold rule: BREAK / IDLE / DATA
|<== DATA @ level n (or BREAK = still holding) ====================|
|--- ACK_* / NACK ------------------------------------------------>| … ARQ section …
Header lost:
|=== HEADER @ q ===X |
| (ack window expires) |
|--- ACK_REQ_0 ---------------------------------------------------->| matches expected parity
|<-- NACK ----------------------------------------------------------| expect level q−1
|=== HEADER @ rdown(q) ============================================>|
Turn control after connect (summary)#
The link is half-duplex. Exactly one side holds the turn:
| Situation | Sent by | Code | Response |
|---|---|---|---|
| End of the peer's data turn, or I want to send | receiver of data | BREAK | data sender answers GO_AHEAD (or START_LEVEL_n) and becomes the receiver |
| Grant | turn holder | GO_AHEAD / START_LEVEL_n | requester starts Sending (or holds with BREAK, or IDLE) |
| Nothing to send | either | IDLE | peer: NO_TRAFFIC (nothing queued), BREAK (has data), QRT (disconnect pending) |
| Nothing either side | – | – | the IDLE sender enters Idle and polls with IDLE every 10 s |
| Missing reply | waiting side | ACK_REQ_0/1 (alternating) | peer repeats its last control code (ACK_REQ is never stored as "last") |
The BREAK sender waits 1.5·base + (r+1)·1024 ticks (r ∈ {0,1,2} from the session PRNG). That is
2.24–4.97 s with base 438, and then repeats BREAK in F0. When an IdleSent reply window expires the
station repeats IDLE (F0).
Keepalive#
When the link is idle, the side that sent IDLE and received NO_TRAFFIC arms a 10 s
(IDLE_POLL = 480 000 samples) timer. Each expiry sends IDLE again and increments a counter. When
not in chat mode, the expiry that makes the counter reach 7 (IDLE_POLL_LIMIT) sends QRT
instead, so an idle non-chat link closes itself after about 60–70 s. Chat links poll forever. Any
outgoing control cancels the timer. The counter is reset when a new Idle period starts after a data
turn.
Disconnect and abort#
| Trigger | Behaviour |
|---|---|
| Host DISCONNECT with data still queued (connected, or Calling/Answering/HeaderSent) | disc_after_tx: QRT as soon as the queue is empty and the station has the opportunity |
| Host DISCONNECT, nothing queued / host ABORT | Calling: set attempts to the limit, so no further requests are sent and UnableToConnect follows at the next deadline. Other states: disc_now. |
disc_now while Sending, HeaderSent, Break or IdleSent |
the next accepted control triggers QRT (when Sending, frames the peer ACKed are accounted first). Each expired reply window counts; after 3 (DISC_TIMEOUT_LIMIT) the station sends QRT unilaterally. |
disc_now while Receiving |
wait for the disc window (one frame airtime (+1 if double) + 1.25·base ticks after the peer's expected end), then QRT |
disc_now in Idle |
the deadline fires immediately → take the turn → QRT |
| Watchdog: 30 s unlinked / 60 s linked without an accepted control or data | host TimedOut (not for Answering), then close |
| Idle poll limit | QRT (above) |
QRT on air. The code is QRT (3) if this station will send a CW ID, else QRT_NO_CWID (46). The
format is the current reply format in Receiving/Answering, otherwise F0. QRT is sent once: it is
neither acknowledged nor repeated. The sender enters Qrt, accepts nothing, and closes when the
transmission ends.
On receiving QRT/QRT_NO_CWID (in any state that accepts it) a station closes at once, without replying.
Close. An answerer that never connected sends CANCELPENDING and returns to Listen. Otherwise,
if this station's CW ID is enabled (CWID ON or a US-format call), it sends a CW ID and then
reports DISCONNECTED. Without CW ID it reports DISCONNECTED immediately. Either way it then
returns to Listen with its configured bandwidth and fresh timing.
CW identification#
| Parameter | Value |
|---|---|
| When | only at link close, by a station that connected and whose CW ID is enabled (CWID ON, or always for a US-format call). Not sent periodically. |
| Text | base callsign (SSID stripped), uppercase |
| Unit (dit) | 2048 samples = 42.667 ms → ≈ 28 WPM (PARIS) |
| Timing | dit 1, dah 3, intra-character gap 1, inter-character gap 3, word space 7 units |
| Tone | 1500 Hz (bin 64), amplitude 1.6, keyed |
| Second tone | 750 Hz (bin 32), amplitude 0.8, continuous from the first keyed unit to the end (omitted in "RA-board" mode) [uncertain]: probably keeps VOX/sound-card keyers keyed between elements |
| Level | drive_dB − 9.6 dB |
| Leading silence | QRT sender: 1 unit. QRT receiver: blanks spaces × 7 units, with blanks = 9 / 12 / 10 when the received QRT was F0 / F1 / F2 (2.69 / 3.58 / 2.99 s), and 0 if it was QRT_NO_CWID. |
The receiver of a QRT delays its own ID by about 3 s so that it does not key over the peer's ID.
The control module also defines an ATU tune burst: 70 symbols of bin 64 (1500 Hz) followed by
24 silent symbols. No session path uses it. The host TUNE command sends a continuous 1500 Hz
tone at drive − 6.4 dB.
CQ frames and unproto announcements#
CQ is unconnected. It is sent from Listen only when the station is idle:
- Announce: control code
CQ(48) in F0 from the unproto codebook. This is a fixed codeword (seed 0xA3CE37 + 50, family 1), with the short lead-in. Total 1365 ms. - Gap: 1920 samples (40 ms) of silence.
- Frame: one data frame at 500 Hz record 15 (an extra FSK level reserved for CQ; see the data-frame PHY section), carrying 8 bytes:
| Bytes | Content |
|---|---|
| 0..5 | 48 bits = 7 × 6-bit characters (alphabet " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", index 0..36, space-padded) then a 6-bit field bw_code<<4 \| ssid |
| 6..7 | CRC-16/GENIBUS of bytes 0..5 |
bw_code: 1 = 500, 2 = 2300, 3 = 2750, 0 = unknown. The SSID is numeric 0..15. The base is 1–7
characters A–Z/0–9. Example: CQFRAME N0CALL-1 2300 → 39 B0 C1 30 C0 21 9A 1D. The host command
is CQFRAME <call> <bw>; an unparsable bw string means 2750, and a missing bw is refused.
On receive, CQ is decoded only in chat mode (LISTEN CQ / CHAT ON) and only in Listen. After
the announce code the station expects the record-15 frame within 4·lead_in + airtime and reports
CQFRAME <call>[-ssid] [bw].
KISS unproto frames use the same pattern with KISS_L1/KISS_L2/KISS_L4 announce codes; see the ARQ
section. On 500 Hz they use p-persistence (p = 0.3, 200 ms slots, 200 ms DCD hold after busy) unless
IGNOREKISSDCD. CQ itself is not p-persistent.
Busy-channel detector#
The detector runs on the same 3 kHz complex baseband as the control detector (bin k of an N-point FFT ↔ audio k·3000/N Hz). It is forced ON and not evaluated while transmitting or when the session is not in Listen.
Tone detector. It works on 128-sample blocks (42.67 ms, 23.4375 Hz bins):
| Parameter | 500 | 2300 | 2750 |
|---|---|---|---|
| Band bins (Hz) | 54..74 (1266–1734) | 21..107 (492–2508) | 16..112 (375–2625) |
| Rank r | 4 | 14 | 17 |
- VU gate: block peak in dBFS with 1 dB/block decay. The block is ignored unless > −46 dBFS.
- Whitening: after 64 warm-up blocks, divide each band bin by exp(median of a learned log-power shape over ±3 bins). The shape is an EMA with α = max(1/64, 1/(n+1)), updated only on non-hit blocks while busy is off.
- Hit: the largest band bin > 270 × the r-th smallest band bin (≈ 24.3 dB).
PSK signature detector. Every 32 samples (10.67 ms) it computes a 64-point FFT (46.875 Hz bins) of the last 64 samples and sums the last 20 rows. A row is gated if the mean power in the signature band (500: bins 27..37; 2300: 15..49; 2750: 10..54) is < 10⁶ (int16² scale). For every PSK level of the band with ≥ 2 carriers it checks up to 4 carrier bins and 3 gap bins (between carriers or at 1500 Hz) at shift −1/0/+1. A hit requires min(carrier) / max(gap) > 3.1 (500) or 2.0 (2300/2750).
Hang. Any hit sets busy ON and reloads a 34-block (1.45 s) hang counter. Busy goes OFF when the counter expires.
The busy state is reported to the host (BUSY ON/OFF) and gates 500 Hz KISS transmission. It does
not block an ARQ connect request in this implementation: the host application decides whether
to call into a busy channel.
Timing constants#
| Constant | Value | Use |
|---|---|---|
| RETRIES | 15 by default (host RETRIES 0..255) |
number of connect requests sent (at least 1) |
| Reply window | codeword_ticks(fmt) + 32 + allowance |
wait for a ctrl reply after own TX end |
| Allowance | 438 ticks (584 ms), or 850 (1133 ms) in chat/P2P, until measured; then ctrl_delay + 150 |
|
ctrl_delay |
measured (t_end − tx_end)/64 − ctrl_ticks(code). The caller takes the reply value (548 if negative); later measurements are averaged. |
|
| Calling window | 480 + 32 + 438 = 950 ticks = 1.267 s (chat/P2P 1362 = 1.816 s) after the request ends | |
| Header ACK window | ack_window(q) + lead_ticks(f,BREAK) + codeword_ticks(f). ack_window = ack_delay + 400 + round(0.45·(ack_delay − ctrl_delay)) with ack_delay = DECODE_ALLOW[bw][q] + ctrl_delay − 100 (tables in the ARQ section) |
|
| Watchdog | 30 s unlinked (Calling, Answering), 60 s linked (HeaderSent onward) | |
| Break back-off | 1.5·base + (r+1)·1024 ticks, r ∈ |
|
| Idle poll | 10 s × 7 | keepalive and auto-QRT |
| FqWait | 9 × reply_window(F0) | after the B2F FQ |
| Disc timeouts | 3 | forced QRT |
| TX turnaround | ≥ 4000 samples (83 ms) after the end of a received burst | station scheduler |
| Answer level cap | 4 | connect reply q |
Corrections to earlier analyses, and uncertain items#
Items 1–5 correct conclusions from earlier SPEEDBIRD reverse-engineering notes (on-air captures of VARA HF). Where they disagreed, the code and the later capture analysis win.
- Per-installation scrambler. An early note concluded that
the connect request uses a per-instance scrambler derived from the registration key. The code
(and the later capture analysis) show that the request is a deterministic function of the
destination's callsign hash only (
m = 29 + 14·draw(5) + 2·draw(7) + parity, seedhash(dest)+50), verified on 142 captures. The older note is superseded. - "byte 88 = 05/04 = registration" (early capture notes). In the code this byte is the header's offer (start level). It correlates with registration only because unregistered callers are capped at offer 4. Registration is flag bit 0 of byte 7 (0x83 = valid + text compression + registered, 0x80 = valid only).
- "Response block 14–17 is a per-installation offset" (early capture notes). These are CONNECT_REPLY q1..q4 (codes 15–18): the answerer's SNR-derived header level. The later capture analysis reached the same conclusion.
- The "FINALIZE Y" two-tone frame in the early notes is the answerer's connect-keyed BREAK in F2 (4 + 7 symbols, 469 ms).
- SSID auto-append (
-1). An old note says VARA appends-1. Nothing in the code does this: the callsign is sent as configured. - REJECT (43) = CONNECT_REPLY_2750 q3 (43). The numbers collide. A caller in HeaderSent does not
accept 43, so in this implementation REJECT is effectively unheard: the caller retries ACK_REQ
until its 60 s watchdog fires. Callers in this implementation always set
valid= 1. [uncertain] whether the original modem sends REJECT from a different codebook slot. - SSID 16–19 pack as 16–19 but unpack as
-T/-R/-X/-L(5-bit read). This round-trips only for SSIDs 0–15. [uncertain] whether the original modem behaves the same way. - Hash spelling sensitivity.
call_hashis over the ASCII text. An answerer derives the caller's text fromunpack_call. A caller configured with a non-canonical spelling (lowercase,-01) would key BREAK/IDLE differently from the answerer. [uncertain] whether the original modem normalises. - CW ID 750 Hz companion tone. Its purpose is inferred. [uncertain]
- Busy detection gating connects. In this implementation the busy detector does not prevent an ARQ call. [uncertain] for the original modem.
- Caller's measured ctrl delay includes the answerer's 7 extra lead-in symbols, because
ctrl_tickscounts only the standard lead-in. This is intentional in the reference implementation and only affects the learned allowance.
Implementation notes#
Primary sources (SPEEDBIRD pure-Python modem,
code/libs/speedbird-python/src/speedbird_python/):
phy/ctrl_code.py: code numbers, request/reply/start-level helpersphy/ctrl.py: formats, families,gen_code,Codebook, connect codes, lead-in grids, synthesis, ATU tonephy/rnd.py: VbRnd;phy/crc.py: CRC-16/GENIBUSphy/call.py:call_hash,pack_call/unpack_call, SSID codes,is_us_callphy/frame.py: data-frame tail,term_marker,Headerphy/rx/ctrl.py: control detector;phy/rx/frontend.py: 48 kHz → 3 kHz front end;phy/rx/blind.py: blind (monitor) codeword searchphy/cwid.py: CW ID;phy/busy.py: busy detector;phy/tx.py: gains, tune tonearq/session.py: handshake/turn/disconnect state machine;arq/frames.py: reply format, start caps, header levelarq/timing.py,arq/timeconst.py,arq/turn.py: windows, watchdogs, hold rulearq/cq.py,arq/broadcast.py,arq/kiss.py: CQ and unproto;station/hf.py: codebook wiring, CW ID rendering, gapsarq/host.py,arq/hostcmd.py: RETRIES, CWID, LISTEN, CHAT, CQFRAME
Cross-checked against the reference implementation's Rust crates (…-phy/src/hf/ctrl/code.rs,
…-arq/src/hf/session.rs): code numbers and the constants CALL_EXTRA_LEAD = 9,
ANSWER_EXTRA_LEAD = 7, QRT_CWID_BLANKS = [9, 12, 10] and ANSWER_LEVEL_MAX = 4 are identical.
Over-the-air cross-checks against captures of VARA HF (request
formula and seed hash(dest)+50, reply seed hash(callee)+289, lead-in bins, header layout,
connect-keyed BREAK seeds hash(caller)+1078) all agree with the code except as noted above.
ARQ data link#
This section specifies how a connected VARA HF link carries host data reliably and how it adapts its speed level. It starts after link setup (see Control frames), when both stations hold a connected session. It ends when the link is torn down.
The waveforms, FEC, scrambling and the CRC-protected frame container are covered in Physical layer. The control codewords (ACK, NACK, BREAK, …) and their formats F0/F1/F2 are covered in Control frames. This section names codewords only by their mnemonic and number.
The key words MUST, SHOULD and MAY are normative. Items marked [uncertain] describe the reference implementation's behaviour where interoperability with VARA HF 4.9.0 has not been confirmed independently.
Overview#
The VARA HF ARQ is a half-duplex, stop-and-wait burst protocol with these properties:
- One station at a time is the sender. It transmits a burst of 1 or 2 data frames at its current speed level (record 1–17), then listens.
- The receiver answers every burst with a single control codeword. That codeword is an
acknowledgement and a speed command at the same time:
ACK_UP1,ACK_STAY,NACK,ACK_FIRST_ONLY, and so on. The receiver decides the sender's speed level. - Data frames carry no sequence numbers. Reliability comes from the strict
one-burst/one-reply lock step, a 1-bit alternation carried in the ACK request codeword
(
ACK_REQ_0/ACK_REQ_1), and a byte-stream model. The sender removes bytes from its queue only when they are acknowledged. Unacknowledged bytes are re-segmented and sent again, possibly at a different level. - The turn ("over") passes when the sender marks a frame LAST. The receiver then answers
BREAK(orIDLE), and the old sender hands over withGO_AHEADor aSTART_LEVEL_ncode. - Optional compression applies to the byte stream: TEXT (a static phrase/Huffman coder applied per frame) or FILES (raw-deflate chunks applied to the host stream).
All times below are in ticks of 64 samples at 48 kHz (1 tick = 4/3 ms) unless stated
otherwise. SECOND = 48 000 samples.
Code numbers used in this section:
| Code | Mnemonic | Use in ARQ |
|---|---|---|
| 1 | ACK_STAY |
burst OK, keep level |
| 2 | NACK |
burst lost, step down |
| 3 | QRT |
disconnect (with CW ID) |
| 5 | ACK_UP2 |
burst OK, +2 levels |
| 6 | ACK_DOWN |
burst OK, −1 level |
| 7 | ACK_UP1 |
burst OK, +1 level |
| 8 | ACK_UP3 |
burst OK, +3 levels |
| 9 | ACK_UP4 |
burst OK, +4 levels |
| 10 | ACK_SECOND_ONLY |
2-frame burst: only frame 2 good |
| 11 | ACK_FIRST_ONLY |
2-frame burst: only frame 1 good |
| 12 / 13 | ACK_REQ_0 / ACK_REQ_1 |
sender polls for a lost reply (alternating bit) |
| 14 | GO_AHEAD |
hand the turn to the peer |
| 19 | NACK_MISSED |
receiver heard nothing; step down further, more robust codeword |
| 21 | NO_TRAFFIC |
answer to IDLE: nothing to send |
| 46 | QRT_NO_CWID |
disconnect (no CW ID) |
| 49 | BREAK |
request / accept the turn |
| 50 | IDLE |
idle poll / "I have nothing" |
| 51–57 | START_LEVEL_1..7 |
GO_AHEAD that also names a start level (50 + n) |
Data frame format (link-layer view)#
Each data frame is exactly frame_bytes = k/8 bytes, where k is the information length of
the level's FEC block (see Physical layer). The PHY delivers frames whose CRC has been checked.
Frames that fail the CRC are reported as lost.
Byte layout#
| Field | Size (bytes) | Present | Description |
|---|---|---|---|
PAYLOAD_FIELD |
room − L |
always | User bytes, or compressed bytes, plus termination (below) |
NEXT_LEVEL |
1 | only if LAST=1 |
Speed level (1…17) the peer should use when it next transmits |
CONTROL |
1 | always | Bit field, see below |
CRC |
2 | always | CRC-16/GENIBUS over every preceding byte, big-endian |
with room = payload(level) = frame_bytes − 3 and L = 1 if LAST is set, else 0.
CONTROL byte#
| Bit(s) | Name | Meaning |
|---|---|---|
| 7–6 | REPLY_FMT |
Control-codeword format (0 = F0, 1 = F1, 2 = F2) the sender asks the receiver to reply in |
| 5 | COMPRESSED |
Payload is TEXT-compressed |
| 4–2 | HINT |
Queue hint 0…6: how much the sender still has queued after this frame (see Queue hint) |
| 1 | LAST |
This is the last frame of the sender's turn. NEXT_LEVEL is present |
| 0 | FULL |
PAYLOAD_FIELD is filled entirely with data (no terminator) |
CONTROL = REPLY_FMT<<6 | COMPRESSED<<5 | (HINT&7)<<2 | LAST<<1 | FULL
Payload termination#
If the data is shorter than the available PAYLOAD_FIELD (FULL=0), the field is:
data ‖ 0x14 (TERMINATOR) ‖ MARKER (if a byte of room remains) ‖ 0x00 … 0x00
MARKER is the high byte of CRC-16/GENIBUS over the caller's callsign as ASCII (as
configured, including any SSID). If that byte is 0x00 or 0x14, 0x01 is used instead.
Both ends use the caller's callsign. For N0CALL, MARKER = 0x09.
A receiver MUST recover the data as follows:
if FULL: data = PAYLOAD_FIELD
else:
i = last index of 0x14 in PAYLOAD_FIELD
if i exists and (i is the final byte or byte[i+1] in {MARKER, 0x00}):
data = PAYLOAD_FIELD[:i]
else: frame is treated as lost
Example: level 4 at 2300 Hz (92-byte frame), payload "Hello\r", LAST=1, NEXT_LEVEL=6,
REPLY_FMT=2, HINT=0:
48 65 6c 6c 6f 0d | 14 09 | 00 × 80 | 06 | 82 | 30 70
"Hello\r" T M pad NL CTL CRC
Header frame#
The caller's first data frame is the header (see Control frames). It uses the same layout,
with LAST=1 and NEXT_LEVEL = the level the caller offers the answerer. Its payload is
packed_callsign(6) ‖ 0x00 ‖ FLAGS, where FLAGS bit 7 = valid, bits 2–1 = compression mode
(0 Off, 1 TEXT, 2 FILES), and bit 0 = registered. The compression mode and the registered flag
it carries apply to the whole link.
Speed levels (link-layer parameters)#
step_thr is the adaptation threshold in dB on the normalised SNR scale:
step_thr = snr_thr − (9.4 − papr), with both terms rounded to 0.1 dB. "Skip" levels are
jumped over on a step down. Net bit/s = 8·frame_bytes / (data_symbols·symbol_period),
which is the figure BITRATE reports.
2300 Hz (16 levels; highest non-QAM level qam_limit = 14)
| Lvl | Modulation | Frame B | Payload B | Net bit/s | step_thr dB | Skip |
|---|---|---|---|---|---|---|
| 1 | FSK | 12 | 9 | 18 | −20.0 | |
| 2 | FSK | 25 | 22 | 41 | −17.6 | |
| 3 | FSK | 50 | 47 | 82 | −15.8 | |
| 4 | FSK | 92 | 89 | 175 | −13.0 | |
| 5 | 3 carriers · QPSK | 135 | 132 | 270 | −6.9 | |
| 6 | 4 carriers · QPSK | 176 | 173 | 363 | −4.7 | |
| 7 | 6 carriers · QPSK | 259 | 256 | 549 | −1.5 | ✓ |
| 8 | 8 carriers · QPSK | 344 | 341 | 735 | −0.4 | ✓ |
| 9 | 10 carriers · QPSK | 428 | 425 | 922 | 0.8 | |
| 10 | OFDM 49 · QPSK | 899 | 896 | 2011 | 5.4 | |
| 11 | OFDM 49 · QPSK | 1199 | 1196 | 2682 | 7.2 | ✓ |
| 12 | OFDM 49 · QPSK | 1439 | 1436 | 3219 | 8.5 | |
| 13 | OFDM 49 · 8PSK | 1799 | 1796 | 4025 | 11.2 | |
| 14 | OFDM 49 · 8PSK | 2159 | 2156 | 4830 | 13.2 | ✓ |
| 15 | OFDM 49 · 16QAM | 2713 | 2710 | 5872 | 14.1 | |
| 16 | OFDM 49 · 32QAM | 3257 | 3254 | 7050 | 17.1 |
2750 Hz (17 levels; qam_limit = 15)
| Lvl | Modulation | Frame B | Payload B | Net bit/s | step_thr dB | Skip |
|---|---|---|---|---|---|---|
| 1–6 | as 2300 Hz levels 1–6 (FSK ×4, 3 & 4 carriers QPSK) | 12/25/50/92/135/176 | 9/22/47/89/132/173 | 18/41/82/175/270/363 | −20.0/−17.6/−15.8/−13.0/−6.9/−4.7 | |
| 7 | 6 carriers · QPSK | 259 | 256 | 549 | −1.6 | ✓ |
| 8 | 8 carriers · QPSK | 344 | 341 | 735 | −0.3 | ✓ |
| 9 | 10 carriers · QPSK | 428 | 425 | 922 | 0.7 | ✓ |
| 10 | 13 carriers · QPSK | 558 | 555 | 1203 | 1.7 | |
| 11 | OFDM 59 · QPSK | 1083 | 1080 | 2423 | 5.9 | |
| 12 | OFDM 59 · QPSK | 1444 | 1441 | 3230 | 7.9 | ✓ |
| 13 | OFDM 59 · QPSK | 1733 | 1730 | 3877 | 9.3 | |
| 14 | OFDM 59 · 8PSK | 2167 | 2164 | 4848 | 11.9 | |
| 15 | OFDM 59 · 8PSK | 2600 | 2597 | 5817 | 14.1 | ✓ |
| 16 | OFDM 59 · 16QAM | 3268 | 3265 | 7074 | 14.9 | |
| 17 | OFDM 59 · 32QAM | 3922 | 3919 | 8489 | 17.9 |
500 Hz (13 levels)
| Lvl | Modulation | Frame B | Payload B | Net bit/s | step_thr dB | Skip |
|---|---|---|---|---|---|---|
| 1 | FSK | 12 | 9 | 18 | −20.0 | |
| 2 | FSK | 25 | 22 | 41 | −17.6 | ✓ |
| 3 | FSK | 37 | 34 | 61 | −16.8 | |
| 4 | 2 carriers · BPSK | 46 | 43 | 88 | −13.4 | |
| 5 | 2 carriers · QPSK | 93 | 90 | 177 | −10.4 | |
| 6 | 3 carriers · QPSK | 135 | 132 | 270 | −6.0 | |
| 7 | OFDM 11 · QPSK | 197 | 194 | 441 | −2.3 | |
| 8 | OFDM 11 · QPSK | 263 | 260 | 588 | −0.5 | |
| 9 | OFDM 11 · QPSK | 315 | 312 | 705 | 1.5 | |
| 10 | OFDM 11 · 8PSK | 395 | 392 | 884 | 3.8 | ✓ |
| 11 | OFDM 11 · 8PSK | 474 | 471 | 1060 | 5.2 | |
| 12 | OFDM 11 · 16QAM | 594 | 591 | 1286 | 6.8 | |
| 13 | OFDM 11 · 32QAM | 713 | 710 | 1543 | 9.4 |
At 500 Hz the reference implementation computes qam_limit over all 17 table records. Record 15
is a hidden FSK record, so the result is 15. That is above the top level, so the "QAM limit"
restrictions below never apply at 500 Hz. [uncertain] whether VARA does the same.
Bursts, sequencing and acknowledgement#
Burst size: single and double frames#
A burst holds 1 frame, or 2 frames once the link has settled. Both ends keep a counter
stays that is reset to 0 whenever the station changes state (for example at each new turn):
- each
ACK_STAYincrements it, except in a turn whose data is TEXT-compressed; - any other reply (an up/down step,
NACK,ACK_FIRST_ONLY,ACK_SECOND_ONLY,NACK_MISSED) resets it to 0; - an
ACK_STAYgiven becauseHINT= 2 ("the rest fits in one frame") sets it to a disabled value. The nextACK_STAYrestarts the count at 0.
A burst MUST have 2 frames when stays > 5, that is, after 6 consecutive ACK_STAY at
one level. Both sides compute the same value, so the receiver knows to expect a double frame.
A 2-frame burst is never TEXT-compressed. A retransmission after ACK_SECOND_ONLY is always a
single frame.
Segmentation (sender)#
The sender's queue is a byte stream. For each frame of a burst:
room = payload(level)
nf = 2 if stays > 5 and no pending resend else 1
for i in 0..nf-1:
rest = queued bytes not yet placed in this burst
lastable = (nf == 1) or (i == 1)
if TEXT turn and nf == 1 and not (lastable and rest < room):
encode with the text coder into room bytes, COMPRESSED=1
LAST = lastable and all of rest consumed and encoded size < room
elif nf == 2:
take = min(rest, room); LAST = (i == 1 and nothing left)
else:
LAST = lastable and rest < room # needs 1 byte for NEXT_LEVEL
take = min(rest, room-1 if LAST else room, resend_limit)
HINT = queue_hint(bytes remaining after this frame)
NEXT_LEVEL (if LAST) = offer level (see Adaptation)
The sender keeps the byte count of each in-flight frame and drops bytes from the front of its queue only when a reply acknowledges them.
Receiver reply decision#
After a burst arrives (or its expected time passes), the receiver sends exactly one codeword:
| Burst outcome | Reply | Receiver's level for the next burst |
|---|---|---|
| No frame decoded | NACK |
step down n (see below) |
1-frame burst, OK, not LAST |
adaptation result (ACK_UP1..4 / ACK_STAY / ACK_DOWN) |
as commanded |
2-frame burst, both OK, not LAST |
adaptation result | as commanded |
| 2-frame burst, frame 1 OK, frame 2 lost | ACK_FIRST_ONLY |
step down 1 (skip-aware) |
| 2-frame burst, frame 1 lost, frame 2 OK | ACK_SECOND_ONLY |
step down 1 (skip-aware) |
| Double frame expected, single frame received | ACK_FIRST_ONLY |
step down 1 |
Every frame OK and the last one has LAST |
BREAK (IDLE in chat mode with nothing queued) |
unchanged; turn ends |
Last frame is exactly "FQ\r", single frame, LAST |
BREAK, then wait for QRT (see B2F awareness) |
— |
The receiver replies in the codeword format the sender asked for in REPLY_FMT of the newest
good frame.
The receiver hands good data to the host at once. It does not wait for the turn to end.
Sender reaction#
| Reply | Queue effect | New level |
|---|---|---|
ACK_STAY/ACK_UPn/ACK_DOWN |
all in-flight bytes acknowledged | clamp(level + step, 1, top), step ∈ |
ACK_FIRST_ONLY |
frame 1 bytes acknowledged, frame 2 re-queued | step down 1, skip-aware |
ACK_SECOND_ONLY |
frame 2 bytes removed from the queue; frame 1 bytes stay; next burst is 1 frame limited to frame 1's length | step down 1, skip-aware |
NACK / NACK_MISSED |
nothing acknowledged; all in-flight bytes re-sent | step down n; NACK_MISSED also makes its next codeword format one step more robust |
BREAK / IDLE |
all acknowledged; turn over | — |
ACK_REQ_x (peer's poll) |
— | resend the last codeword sent |
After any ACK_* or NACK*, the sender transmits the next burst at once. It sends QRT
instead if a disconnect is pending.
Selective repeat inside a double frame (reorder buffer)#
ACK_SECOND_ONLY gives a limited selective repeat. When frame 1 is lost and frame 2 is good,
the receiver puts frame 2's bytes in a reorder buffer after a hole of exactly payload(level)
bytes. That is the size of the lost frame 1: in a double burst, frame 1 is always full when
frame 2 carries data. The sender removes frame 2's bytes from its queue, so its queue continues
with the hole's bytes followed by the bytes after frame 2. Later data fills the hole first, then
appends after the buffered bytes. The receiver releases bytes to the host only as a contiguous
prefix, so the host sees a correctly ordered stream. The hole MAY be refilled at a lower level
and across several bursts.
Lost replies: the alternating ACK request#
Each side keeps one bit alt, set to 0 on every state change. The receiver flips alt each time
it sends a reply other than BREAK/IDLE. The sender flips alt each time it accepts a reply.
In normal running the two bits stay equal before each burst.
If the sender's reply window expires (see Timing), it MUST send ACK_REQ_alt
(ACK_REQ_0 if alt=0, else ACK_REQ_1) and listen again. It does not resend the data. The
receiver handles the request as follows:
- The request's bit equals the receiver's own
alt. The receiver never answered this burst: it heard nothing. It counts every expected frame as lost, steps down n (computed as forNACK_MISSED), flipsalt, and repliesNACK_MISSEDin a format one step more robust than the current one. It also widens the set of levels it will try to decode (current, previous, and up to 3 below the previous level). - The bits differ. The receiver did answer, and its reply was lost. It MUST resend its last codeword, using format F0.
This 1-bit scheme is the only sequence numbering on the link. Lock-step operation with at most
one outstanding burst makes it sufficient. A sender also resends its last codeword when it
receives an ACK_REQ while it is itself sending.
The receiver keeps decoding at {current level, previous level} plus fallback levels after a
NACK. A sender that missed a level-change command can therefore still be decoded.
Retries and limits#
| Item | Value |
|---|---|
| ACK requests per burst | no counter. Each retry uses a format one step more robust (first format_for_level(level−1), then F2→F1→F0) |
| Data retransmissions | no counter. Each NACK steps down until level 1 |
| Link watchdog | 60 s with no accepted codeword or frame while linked (30 s while unlinked) → host TIMEOUT/DISCONNECTED, no QRT sent |
| Disconnect retries | when an abort is pending, 3 reply-window expiries (DISC_TIMEOUT_LIMIT) → send QRT |
| Connect retries | the host's RETRIES setting (default 15); see Control frames |
[uncertain] VARA may have an explicit per-burst retry limit. The reference implementation relies only on the 60 s watchdog.
Queue hint#
The 3-bit HINT tells the receiver how much data the sender still holds after the current
frame. The receiver may command an upward step only when the extra speed would be used. Let q
be the remaining byte count, P(l) the payload of level l, and "fits(l, k)" mean
q < k·P(l) for 1 ≤ l ≤ top:
for k in (1, 2):
if level > 1 and fits(level-1, k): return 0
if fits(level, k): return 2 if k == 1 else 1
for d in 1..4:
if fits(level+d, k): return 2 + d # 3..6
return 6
| HINT | Meaning |
|---|---|
| 0 | the rest fits in 1 frame (or 2) at one level lower |
| 1 | the rest fits in 2 frames at this level |
| 2 | the rest fits in 1 frame at this level |
| 3–6 | the rest needs level +1 … +4 (1 or 2 frames) |
| 6 | also "a lot" (beyond +4) |
In a TEXT-compressed turn, "fits" is evaluated on the compressed size. Two overrides apply to the first frame of a turn:
- Max:
HINTis forced to 6 when the level the peer offered is above the start cap. This lets the receiver climb at once. - TableMinimum:
HINTis raised to at least a per-level minimum when an answerer releases a held turn with a non-prompt block of data:
| Bandwidth | Text | Minimum HINT for levels 1, 2, 3, … (0 above) |
|---|---|---|
| 500 | off | 6, 6, 6, 5, 3 |
| 500 | on | 6, 6, 5, 3 |
| 2300/2750 | off | 6, 6, 4, 2 |
| 2300/2750 | on | 6, 5, 3 |
Speed-level adaptation#
The receiver runs the adaptation. It acts on each burst it decodes and states the result in its reply.
Inputs#
snr: the PHY's SNR estimate for each good frame (normalised dB scale; see Physical layer), smoothed asymmetrically. A rise is averaged with the previous value; a fall is taken at once:s = (prev + snr)/2 if snr > prev else snr; prev = snr.- Per-frame success or loss.
HINTof the newest good frame.registered: on the answerer, the caller's flag from the header; on the caller, its own registration. The caller's registration therefore governs the link. [uncertain] whether VARA requires both ends to be registered.
Margin state#
| Variable | Initial | Update |
|---|---|---|
margin (dB) |
2.0 | good frame: margin = max(margin − decay, 1.5) |
decay |
0.5/15 | set on each counted loss: (margin − margin_before)/15, so the penalty wears off over 15 good frames |
ok_run |
1 | good frame +1; loss → 0 |
failed_climbs |
0 | loss right after a climb +1; good frame above the last level → 0 |
qam |
None | good QAM frame → Received; first QAM frame lost before any QAM success → LostFirst |
A loss at level l is counted when l > 1, ok_run > 0 and the last good level ≤ l. It
raises the margin as follows:
margin += 1.0
if level > last_level: margin += 4.0 * failed_climbs # climbing failed again
if ok_run < 15: margin += 3.0 * (15 - ok_run) / 15 # recent loss after a short run
Per-step margins#
For d = 0…4 (target level l+d):
m[d] = s − step_thr(l+d) − margin − max(d−1, 0)
m[d] is disabled (−100) if:
l+d > top, ord ≥ 2and (failed_climbs ≠ 0orl+d > qam_limit), ord = 1andl+1 > qam_limitandqam = LostFirst.
The receiver therefore never jumps two or more levels into QAM. After a first failed QAM frame it may also not step one level into QAM.
ACK decision#
mx = top if registered else 4
for (s, code, need) in ((4,ACK_UP4,6), (3,ACK_UP3,5), (2,ACK_UP2,4), (1,ACK_UP1,3)):
if burst complete and l+s <= mx and m[s] > 0 and HINT >= need:
reply code, new level l+s
if not complete: reply ACK_SECOND_ONLY, step_down(l)
if l > 1 and (m[0] < 0 or HINT == 0): reply ACK_DOWN, l−1
reply ACK_STAY, l (HINT == 2 disables double frames, see above)
The HINT ≥ s+2 condition means "only climb as far as the queued data needs".
Step-down sizes#
step_down(l)(afterACK_FIRST_ONLY/ACK_SECOND_ONLY, or a header NACK):l' = l−1. Ifl' > 1and levell'is a skip level, usel'−1.ACK_DOWNis a plain −1 with no skip.- After
NACK/NACK_MISSED, the level drops byn, then the skip rule applies:
| Condition (checked in order) | n |
|---|---|
upsteps ≥ 6 (levels climbed since the last drop) |
3 |
upsteps = 4 or 5 |
2 |
NACK_MISSED and level > 1 |
2 |
| otherwise | 1 |
upsteps counts levels gained since the last time the level fell to or below its previous
low. A fall resets it to 0.
Offered / start level for the reverse direction#
When a sender ends its turn (LAST), it writes into NEXT_LEVEL the level at which the peer
should start its own turn. A START_LEVEL_n codeword offers a level in the same way during link
setup.
offer = 1
for l in 2..cap:
if s_ref − step_thr(l) <= max(margin, 3.0) + min(max(l − last_good − 1, 0), 3): break
offer = l
Here s_ref is the most recent SNR reference. It comes from data frames (smoothed) or from
received codewords (the lower of the last two codeword SNRs).
cap (the start-level cap) is:
| Condition | cap |
|---|---|
| link not registered | 4 |
a Winlink FS proposal was seen this turn |
qam_limit (14 at 2300, 15 at 2750) |
| otherwise | 7 (500 Hz) or 6 (2300/2750 Hz); one less if TEXT compression is on |
The cap is also clamped to the bandwidth's top level.
The peer starts its turn at min(NEXT_LEVEL, top).
Limits summary#
| 500 Hz | 2300 Hz | 2750 Hz | |
|---|---|---|---|
| Levels | 1–13 | 1–16 | 1–17 |
| Unregistered max level (ACK commands and start level) | 4 (88 bit/s) | 4 (175 bit/s) | 4 (175 bit/s) |
| Registered start cap | 7 (6 with TEXT) | 6 (5 with TEXT) | 6 (5 with TEXT) |
Turn-taking and timing#
Passing the turn#
Sender Receiver
… data burst, last frame LAST=1 →
← BREAK (receiver enters Break)
GO_AHEAD / START_LEVEL_n → (old sender enters Receiving)
new turn: Data | Hold | Idle
The receiver cannot interrupt a sending turn [uncertain for VARA]. A station with data waits
for the peer's LAST frame, or for the next idle poll.
On receiving GO_AHEAD/START_LEVEL_n, the new sender picks one of three actions:
| Action | When | What is sent |
|---|---|---|
| Data | data queued and no hold applies | burst at min(offered level, top) |
| Hold | answerer right after the header: nothing queued and < 3300 ms since header, or partial data queued and < 4500 ms; or (any station, at most once per queue size) queue fits one frame at the offered level and the offer is above the start cap | BREAK again: keep the turn, wait for the host |
| Idle | nothing queued (answerer: after 3300 ms) | IDLE |
An answerer's host block that ends in ">\r" (6 bytes or longer) counts as a prompt and is
sent at once. Any other block that is too long for one frame starts the turn with the
TableMinimum hint.
Idle link#
| Event | Action |
|---|---|
Got IDLE, nothing queued |
reply NO_TRAFFIC, enter Idle |
Got IDLE, data queued |
reply BREAK (take the turn) |
Sent IDLE, got NO_TRAFFIC |
enter Idle; start idle poll timer 10 s |
| Idle poll timer fires | send IDLE again; on the 7th firing (not chat mode) send QRT instead |
| Host queues data while Idle | after ≥ 201 ticks (268 ms) past the last transmission, send BREAK |
Got BREAK while Idle / IdleSent |
reply GO_AHEAD |
In chat mode (CHAT ON), a receiver with nothing queued answers a LAST frame with IDLE
instead of BREAK. The link never times out from idling.
Reply windows#
The ARQ layer measures every window from the moment its own transmission ended as heard, including the driver's known output latency. Each window allows for the length of the expected reply codeword.
| Symbol | Value |
|---|---|
codeword(F) |
(nsym−1)·32 ticks: F0 = 992 (1.32 s), F1 = 480 (0.64 s), F2 = 224 (0.30 s) |
lead(F, code) |
lead-in of 40 ms; for GO_AHEAD, NO_TRAFFIC, BREAK, IDLE: 40/80/160 ms (F0/F1/F2), rounded up to 2048-sample symbols ×32 ticks |
base |
438 ticks (584 ms); 850 ticks (1.13 s) in chat or P2P mode |
ctrl_delay |
measured peer turnaround for codewords. Set from the connect reply on the caller; on the other side, averaged over replies to BREAK→GO_AHEAD/START_LEVEL and IDLE→NO_TRAFFIC. Defaults to 548 if the measurement is negative |
ctrl_allowance |
ctrl_delay + 150 (base until the first measurement) |
ack_delay[l] |
mean measured gap between end of our burst at level l and start of the ACK. Initially decode_allow[l] + ctrl_delay − 100. Unmeasured higher levels are extrapolated with the decode_allow differences |
ack_window[l] |
ack_delay[l] + 400 + round(0.45·(ack_delay[l] − ctrl_delay)) (last term only if positive) |
decode_allow (ticks) per level:
| BW | L1…L17 |
|---|---|
| 500 | 168 135 154 142 150 150 199 204 204 212 230 236 259 |
| 2300 | 162 140 148 148 150 164 172 176 190 263 303 319 365 415 480 556 |
| 2750 | 150 118 140 136 136 144 152 164 172 180 276 315 340 415 450 535 636 |
| Wait after… | Timeout (ticks) | On expiry |
|---|---|---|
| a data burst | ack_window[level] + lead(f, c) + codeword(f), where f = min(fmt_for_level, reply_fmt) and c = BREAK if the burst had LAST, else ACK_STAY |
send ACK_REQ_alt |
an ACK_REQ |
codeword(F0) + 32 + ctrl_allowance |
another ACK_REQ, one format more robust |
BREAK (requesting the turn) |
⌊1.5·base⌋ + (r+1)·1024, with r random in |
resend BREAK (F0) |
IDLE |
codeword(F0) + 32 + ctrl_allowance |
resend IDLE |
| FQ wait | 9 × the IDLE window |
close silently |
Example (2300 Hz, ctrl_delay = 300): ack_window is 770 ticks (1.03 s) at L4, 936 (1.25 s)
at L10, and 1361 (1.81 s) at L16.
In the reference driver, the earliest transmit after a reception is 4000 samples (83 ms) after the end of the received signal. Black-box measurements put the turnaround from frame end to reply start at 160–180 ms for both the reference implementation and VARA HF 4.9.0.
Compression#
The caller selects the mode, and it is fixed for the link by the header FLAGS bits 2–1. The
caller sends its configured COMPRESSION setting (default TEXT) only if it is registered.
Otherwise the mode is Off.
TEXT (mode 1): per-frame phrase/Huffman coder#
- At the start of each sending turn, the sender trial-encodes the first 150 queued bytes. If the encoded size is smaller than the input consumed, the whole turn is a text turn.
- In a text turn, every single-frame burst is encoded with
COMPRESSED=1, except a final frame whose remainder fits raw. Double-frame bursts are never used during a text turn, becauseACK_STAYdoes not count towardstays. - The coder is an 8-state, prefix-code phrase coder with a static table: 508 entries plus
per-state escapes, phrases up to 39 bytes, codes up to 10 bits. The bitstream is MSB-first.
Each frame begins with 3 bits giving
state−1, so every frame decodes on its own. The coder state carries from frame to frame inside a turn (initial state 1). - The encoder fills the frame (
input ≤ 3·room + 39bytes considered). It then pads to a byte boundary with 1–8 copies of the complement of the last code bit. The decoder strips trailing bits equal to the final bit. - The receiver inflates only the first frame of a burst with
COMPRESSED=1, and only on a TEXT link. A frame that fails to decode is treated as lost. - Table origin:
textcomp.dict, recovered by black-box observation of VARA's output. Line format:S <state> <start-bits> <escape-bits|-> <escape-next>followed by entriesE <phrase-hex|-> <code-bits> <next-state (0 = stay)>. The phrases are tuned for Winlink traffic. Examples:"[RMS Express-",";FW: ",";PQ: ","-B2FWIHJM$]\r",";WL2K-Radio/Internet_Network\r".
FILES (mode 2): deflate chunks on the host stream#
While connected, host data is staged and cut into chunks of up to 32 500 input bytes. A chunk is flushed when it fills, or after a 150 ms pause in host writes. Data queued before link-up is re-chunked at link-up. Each chunk is:
| Byte 0 bit 7 | Byte 0 bits 6–0, byte 1 | Body |
|---|---|---|
D = 1 if the body is raw deflate |
15-bit body length | raw deflate (level 6, zlib/miniz-compatible) if smaller than the input, else the raw input |
The receiver rebuilds chunks from the ordered byte stream and inflates each one, with a limit
of 50 000 output bytes per chunk. A chunk that fails to inflate is dropped. The chunk stream
travels inside ordinary data frames with COMPRESSED=0.
B2F (Winlink) awareness#
The sender snoops each block the host writes:
- A block that starts with
"FS ", ends with"\r"and is at least 5 bytes long marks a B2F proposal answer. For that turn the offered start level may go up toqam_limitinstead of the normal cap. The mark is cleared at the end of each turn. - A block equal to
"FQ\r"(B2F quit) is noted. At the end of the turn that carried it, the sender discards anything still queued and sendsQRTinstead of handing over the turn. - A receiver whose last single frame of a turn contains exactly
"FQ\r"answersBREAKand enters FqWait. It expects the peer'sQRT, resends its last codeword to anything else, and after 9 reply windows closes without sendingQRT.
Throughput and signal reporting#
| Host line | When | Value |
|---|---|---|
BITRATE (<lvl>) <bps> bps TX |
when each data burst is keyed (one line per frame of the burst) | round_half_away(8·frame_bytes / (data_symbols · symbol_period)), the on-air net rate of the level (tables above), not a measured goodput |
BITRATE (<lvl>) <bps> bps RX |
after a received burst whose last frame decoded (unless the link is closing); also after a 2-frame burst whose first frame decoded | same formula, for the received level |
SN <x.x> |
after each received burst whose last frame decoded, and after the header | the PHY's SNR estimate for that frame (averaged estimate when available), dB, 1 decimal |
BUFFER <n> |
each time a reply acknowledges frames | bytes still queued, including any FILES-staged bytes |
Effective throughput is much lower than BITRATE because of lead-ins, ACK round trips and
turn changes. In a clean-channel test of 2000 B at 2300 Hz with an unregistered link (level 4,
175 bit/s on air), both implementations delivered about 138 bit/s end to end.
Link teardown and error cases (ARQ view)#
| Trigger | Behaviour |
|---|---|
Host DISCONNECT with data queued |
graceful: keep sending. At the next turn boundary with an empty queue (peer's BREAK/IDLE, or answering IDLE), send QRT |
Host DISCONNECT with empty queue, or ABORT |
immediate. While Sending: on the next reply, credit any acknowledged bytes and send QRT. While Receiving: wait until the expected burst plus 1.25·base ticks has passed, then send QRT. While Idle: send QRT at once. In Break/IdleSent/Sending, after 3 unanswered windows, send QRT |
QRT sent |
QRT (code 3, with CW ID) or QRT_NO_CWID (46). Sent once and not acknowledged. After transmission the station closes (CW ID if enabled) and reports DISCONNECTED |
QRT / QRT_NO_CWID received |
close at once. Before sending a CW ID after QRT, leave a gap of 9/12/10 units for F0/F1/F2 |
| 7 idle polls (non-chat) | QRT |
| No valid reception for 60 s | link loss: host gets a timeout plus DISCONNECTED; no QRT |
B2F FQ |
QRT after the turn that carried it (see above) |
Data stuck (repeated NACK) |
level falls to 1; the link survives as long as something is decoded within 60 s |
See Control frames for the QRT codewords and CW ID.
Timeline example#
The following run uses the reference implementation's two-station simulator: 2300 Hz, both stations registered, compression off, codeword SNR 14 dB, 15 % frame loss, 10 % codeword loss. N0CALL sends 40 000 bytes to N0CALL-1. Times are seconds from the start of the call. The connect, header and hold phase appears in compressed form; see Control frames.
| t (s) | From | On air | Meaning |
|---|---|---|---|
| 0.00 | N0CALL | CONNECT_REQ_2300 |
call (see Control frames) |
| 1.85 | N0CALL-1 | CONNECT_REPLY q=4 |
answer; N0CALL will start at L4 |
| 2.93 | N0CALL | header, L4 ×1 | LAST, offers N0CALL-1 level 6 |
| 7.37 | N0CALL-1 | BREAK |
link up; answerer takes the first turn |
| 7.94 | N0CALL | START_LEVEL_6 (56) |
go ahead at L6 |
| 8.72 | N0CALL-1 | BREAK |
hold: its host has nothing yet |
| 9.29 | N0CALL | START_LEVEL_6 (F0) |
repeat of its last codeword |
| 10.76 | N0CALL-1 | IDLE |
nothing to send after 3.3 s |
| 11.33 | N0CALL | BREAK |
has data, wants the turn |
| 12.79 | N0CALL-1 | GO_AHEAD |
|
| 13.36 | N0CALL | L4 ×1 | 89 B, HINT=6 |
| 17.80 | N0CALL-1 | ACK_UP4 (9) |
delivered 89 B; margin allows +4 |
| 18.25 | N0CALL | L8 ×1 | |
| 22.22 | N0CALL-1 | ACK_UP1 (7) |
|
| … | L9, L10 | climbs to L10 (896 B/frame) | |
| 33.42–41.85 | N0CALL-1 | ACK_STAY ×3 |
|
| 46.06 | N0CALL-1 | ACK_STAY |
lost on air |
| 46.94 | N0CALL | ACK_REQ_0 (12) |
reply window expired |
| 47.38 | N0CALL-1 | ACK_STAY (F0) |
bit mismatch, so repeat the last reply |
| 48.84–56.83 | L10 ×1, ACK_STAY ×2 |
6th consecutive STAY | |
| 57.27 | N0CALL | L10 ×2 | double frame; frame 1 corrupted |
| 64.62 | N0CALL-1 | ACK_SECOND_ONLY (10) |
frame 2 kept behind an 896 B hole |
| 65.06 | N0CALL | L9 ×1 | refill the hole; corrupted |
| 68.98 | N0CALL-1 | NACK (2) |
9−1 = 8 is a skip level, so go to 7 |
| 69.42 | N0CALL | L7 ×1 | |
| 73.42 | N0CALL-1 | ACK_UP2 (5) |
256 B released |
| … | L9 ×1 | hole complete: 1321 B (hole + frame 2 + new) released at once | |
| 102.06 | N0CALL-1 | ACK_STAY |
lost |
| 102.94 | N0CALL | ACK_REQ_1 (13) F2 |
lost |
| 104.94 | N0CALL | ACK_REQ_1 F1 |
retry, more robust format |
| 105.73 | N0CALL-1 | ACK_STAY (F0) |
repeat |
| … | … | ||
| end | N0CALL | last frame LAST=1 |
|
| N0CALL-1 | BREAK |
||
| N0CALL | QRT |
disconnect was requested with data queued, so QRT now that the queue is empty |
Implementation notes#
The normative content above is taken from SPEEDBIRD's pure-Python VARA HF modem, which ports the reference implementation bit-exactly:
speedbird_python/arq/session.py: the session state machine (Listen, Answering, Calling, HeaderSent, Receiving, Break, Sending, Qrt, Closing, IdleSent, Idle, FqWait). Covers segmentation (_transmit), reply decisions (on_data,_ack_data,_end_turn), sender reactions (_ctrl_sending), the ACK-request alternation, timeouts (on_tx_done,poll) and teardown.arq/adapt.py: SNR trend, margin state,margins,ack_decision,step_count,step_down,offer_level.arq/frames.py:parse, queue hint, reply-format choice, start-level caps, TableMinimum hint.arq/turn.py: turn start policy (Hold, Idle, Data; 3300/4500 ms).arq/timing.py,arq/timeconst.py: tick base, reply and ACK windows,decode_allowtables, watchdog, idle poll, BREAK back-off.arq/link.py: reorder buffer, timers, compression glue.arq/core.py: output queue.arq/compression.py,arq/deflate.py: FILES chunking; byte-exact miniz-compatible deflate at level 6.arq/textcomp.py+arq/textcomp.dict: TEXT coder and its table.arq/bits.py: MSB-first bit packing.arq/b2f.py:FS/FQ\rsnooping.arq/num.py,arq/_rec.py,arq/rng.py: exact float rounding, level helpers, xorshift64 for the BREAK back-off draw.phy/frame.py: CONTROL byte, terminator and marker,build_frame, header.phy/level.py: per-bandwidth level tables,qam_limit,start_level_max,net_bps.phy/ctrl_code.py: codeword numbers.phy/api.py:UNREGISTERED_MAX_LEVEL= 4 and the level specs.station/hf.py: whenBITRATE/SNlines are emitted, and the 4000-sample transmit hold.arq/hostcmd.py: host line formats.arq/sim.py: the two-station simulator used for the timeline.- The reference implementation's Rust ARQ crate (HF session, adapt, frames, timing, turn modules) and its black-box comparison notes against VARA HF 4.9.0 were used to cross-check. That comparison covered unregistered operation only (levels 1–4). Behaviour above level 4 (QAM rules, skip levels, start caps above 4) therefore follows the reference implementation and is not independently confirmed against VARA.
Host interface#
A VARA HF modem is controlled by a host program (Winlink Express, Pat, VarAC and similar) over TCP. The interface has three sockets:
| Socket | Default port | Content | Clients |
|---|---|---|---|
| Command port | 8300 | ASCII command lines and replies, each terminated by CR | one at a time |
| Data port | command port + 1 (8301) | raw payload byte stream of the ARQ link | one at a time |
| KISS port | 8100 (may be disabled) | KISS-framed unproto (broadcast) frames | up to 10 at once |
This section specifies the host interface as the SPEEDBIRD modem implements it. Behaviour that is stubbed, accepted-but-ignored, or that differs from what host programs may expect is flagged explicitly.
Conventions#
→marks bytes sent by the host to the modem;←marks bytes sent by the modem to the host.<CR>is byte 0x0D. In tables, the terminating<CR>is implied and not shown.- Callsigns in examples:
N0CALL(local station) andN0CALL-1(remote station). - "Idle" means the ARQ session is in its listening state and the transmit scheduler has nothing queued or on the air. Several commands are only accepted when the modem is idle.
Ports and connection handling#
Binding#
- The command and data ports MUST be bound on the same address (default
127.0.0.1). The data port is always the command port number plus one, so the command port MUST be below 65535. - The KISS port is bound on the same address. It is configured separately and can be turned off.
One client per port#
- The command port and the data port each accept one client at a time. While a client is attached, the modem stops listening on that port, so a second connection attempt is refused (on Linux the listener is shut down for reading; the port stays bound). Once the client leaves, the port listens again.
- The command client and the data client are treated as one host session. When either connection closes, the modem MUST close the other one too, and then:
1. stop any tune tone the host started;
2. set listening OFF (the modem stops answering incoming connect requests);
3. drop any ARQ link that is up (see
DISCONNECTandABORTfor how a drop differs); 4. turn chat mode OFF. - Each time a client attaches to the command port or the data port, the modem toggles its reported busy state and sends the result (
BUSY ONif it last reported OFF, and the other way round). On the next audio block the modem compares that state with the real channel-busy detector and, if they differ, sends a correctiveBUSYline. A host attaching to an idle, quiet channel therefore seesBUSY ONimmediately followed byBUSY OFF, once per port. This copies a behaviour of the reference implementation. Hosts SHOULD readBUSYonly as a state change and SHOULD NOT treat the firstBUSY ONas a real carrier. - Listening is ON when the modem starts, before any host attaches. After the first host disconnects it is OFF until a host sends
LISTEN ON(orCHAT ON).
Output back-pressure#
The modem queues output for each client (command, data, KISS) on its own writer. A client that falls more than 4 MiB behind is disconnected. On the command and data ports that also ends the host session, as described above.
Command port#
Framing and encoding#
- Commands are lines terminated by CR (0x0D). LF (0x0A) is discarded wherever it occurs, so CR LF works as a terminator too. LF alone does not end a line.
- Line bytes are decoded as UTF-8, with invalid sequences replaced.
- A line longer than 1024 bytes is discarded whole, without a reply.
- Command keywords are case-sensitive and MUST be sent in upper case, with single spaces between tokens as shown. Callsign arguments may use any case and are converted to upper case. The
OFFinTUNE OFFis the only keyword matched in any case. - Every reply and asynchronous message the modem sends is one ASCII line terminated by a single CR (no LF). Characters outside printable ASCII in echoed text are replaced with
?. - A line that is not a recognised command gets the reply
WRONG.
Callsign syntax#
Wherever a command takes a callsign, the modem validates it:
- base: 1 to 7 characters,
A–Zand0–9; - optional suffix after
-: one of1–9,T,R,X,L, or two digits from01to19; - an 8-character token with no
-whose last character isR,T,XorLis read as a 7-character base plus that suffix (ABCDEFGRis read asABCDEFG-R). In the other direction, a 7-character base with anR/T/X/Lsuffix is shown without the dash inCONNECTED.
A callsign that fails validation makes the whole command invalid.
Command reference#
"Reply" lists every line sent in direct response. Unless noted, a command produces exactly one reply, OK or WRONG.
| Command | Arguments | Reply | Effect / conditions |
|---|---|---|---|
MYCALL c1 [c2 … c5] |
1–5 callsigns | OK / WRONG (see notes) |
Sets the station callsigns. c1 is the primary call; incoming connect requests may be addressed to any of them. Applying it rebuilds the ARQ session. About 5 s later the modem sends REGISTERED … and then ENCRYPTION DISABLED. Invalid list (bad callsign, empty, or more than 5): replies WRONG then OK. Not idle: replies WRONG and the new list is deferred. When the link ends, a valid deferred list is applied right after DISCONNECTED; an invalid deferred list causes an extra WRONG right before DISCONNECTED. |
LISTEN ON / LISTEN OFF |
— | OK |
Enables or disables answering incoming ARQ connect requests. If a link is in progress, the modem drops it, whichever of the two is sent. The reply is sent before the link is dropped. |
LISTEN CQ |
— | as CHAT ON |
Alias of CHAT ON. |
CHAT ON / CHAT OFF |
— | OK, or WRONG if not idle |
Chat (keyboard-to-keyboard) mode. CHAT ON toggles the reported busy state (see One client per port) and sets listening ON. Chat mode is only turned on if both a command and a data client are attached. In chat mode the link is not closed for inactivity, idle polls continue instead, and received CQ frames are reported (see CQFRAME). |
CONNECT mycall remote |
2 callsigns | OK / WRONG |
Starts an outgoing ARQ connection from mycall to remote. mycall does not need to be in the MYCALL list. WRONG if PTT is keyed, if a link is already up or being set up, or if a KISS/CQ broadcast is in progress. A request heard but not yet answered (answering state with nothing on the air) is abandoned in favour of the outgoing call. The modem sends up to retries connect requests (see RETRIES). On success it sends CONNECTED. On failure it sends DISCONNECTED. |
CONNECT mycall remote VIA d1 [d2] |
4–5 callsigns | WRONG |
Parsed and validated, but digipeated connects are not supported on HF and are always rejected. |
DISCONNECT |
— | OK |
Graceful disconnect. If the link is up (or being set up) and data is still queued, the modem disconnects once the queue has drained. Otherwise it acts as ABORT. While calling, it stops further connect attempts. Ignored when idle. |
ABORT |
— | OK |
Ends the link as soon as possible, without waiting for queued data. While calling, it stops further connect attempts; the current attempt finishes and then DISCONNECTED is sent. Ignored when idle or already closing. |
BW500 / BW2300 / BW2750 |
— | OK, or WRONG if not idle |
Sets the session bandwidth and rebuilds the ARQ session. |
COMPRESSION OFF / ON / TEXT / FILES |
— | OK |
Sets the compression the modem asks for on outgoing links (ON = TEXT). The caller only applies it when the station runs in registered mode. Otherwise compression is OFF on outgoing links. On incoming links, the caller's header decides. |
WINLINK SESSION |
— | OK |
Uses Winlink (client/server) turn timing. Default. |
P2P SESSION |
— | OK |
Uses peer-to-peer turn timing. |
RETRIES n |
number 0–255 | OK |
Sets how many connect requests are sent per CONNECT (default 15). n is parsed leniently in the Visual Basic style (&H hex and &O octal prefixes, decimals rounded). RETRIES 0 restores the value in force before the last non-zero RETRIES, if there is one; otherwise it does nothing. Out-of-range or non-numeric values are ignored. The reply is always OK. |
CQFRAME call bw |
callsign, bandwidth | OK / WRONG |
Transmits one CQ beacon frame (500 Hz unproto) announcing call and bw. bw is 500, 2300 or 2750; any other value is sent as 2750. WRONG if bw is missing, the callsign is invalid, or the modem is not idle (or is transmitting, tuning or broadcasting). |
IGNOREKISSDCD ON / OFF |
— | OK |
When ON, KISS transmissions on 500 Hz skip the carrier-sense and p-persistence check. |
CLEANTXBUFFER |
— | CLEANTXBUFFER BUFFEREMPTY or CLEANTXBUFFER FAILED |
Query only, nothing is discarded. Returns BUFFEREMPTY if no host data is queued, else FAILED followed by a trailing space. |
VERSION |
— | VERSION VARA HF v4.9.0 |
Reports the VARA version string the modem presents. |
TUNE level |
dB, −30…0 | OK |
Sets TX drive to level dB (rounded to an integer) and starts a continuous tune tone if idle. The tone stops automatically after 60 s. A value out of range is ignored (still OK). A non-numeric value starts the tone without changing the drive. OK is sent before the tone starts. |
TUNE OFF |
— | OK |
Stops the tune tone. OFF may be any case and surrounded by whitespace. |
TUNE ? |
— | TUNE d |
Reports the current drive in dB, rounded half away from zero (e.g. TUNE -5). |
DRIVELEVEL level |
dB, −30…0 | OK |
Sets TX drive without starting a tone. Invalid values are ignored. |
PUBLIC ON / PUBLIC OFF |
— | OK |
Accepted and ignored. |
CWID ON / CWID OFF |
— | OK |
Accepted and ignored. CW identification is decided by the modem's own configuration: it is sent at the end of a link when configured, or always for US callsigns. |
GATEWAY … |
any text after a space | OK |
Accepted and ignored. |
| anything else | — | WRONG |
Includes requests some hosts send to other VARA builds, e.g. ENCRYPTION …, SN, BUFFER, MONITOR …, lower-case keywords, TUNE with no argument. |
Notes:
- Command replies are generated in order and interleave with asynchronous messages. A host MUST NOT assume the next line after a command is its reply. It SHOULD match
OK/WRONGto commands in the order they were sent. PTT,CONNECTand similar "not now" conditions returnWRONGimmediately. The modem does not queue the command.
Asynchronous messages#
The modem sends these lines on the command port without being asked. Each line ends with CR. If no command client is attached, they are discarded.
| Message | Format | When |
|---|---|---|
PTT ON / PTT OFF |
literal | The transmitter keys or unkeys: ARQ bursts, CQ/KISS broadcasts, tune tone. Hosts that do CAT PTT key the radio on these lines. Suppressed while the operator has forced PTT off. |
BUSY ON / BUSY OFF |
literal | The channel-busy detector changes state. It is forced busy while the modem transmits or a link is active. Also sent spuriously when a client attaches and on CHAT ON (see above). |
PENDING |
literal | (a) An incoming connect request addressed to one of the MYCALL calls was heard while listening; the modem is answering. (b) The modem starts a KISS or CQ broadcast transmission. |
CANCELPENDING |
literal | (a) An incoming connection that sent PENDING failed before CONNECTED (e.g. watchdog timeout). (b) A KISS or CQ broadcast transmission has finished. |
UNENCRYPTED LINK |
literal | Link setup: the calling side sends it when it sends its session header. The answering side sends it right before CONNECTED. |
CONNECTED caller answerer bw |
e.g. CONNECTED N0CALL N0CALL-1 2300 |
The ARQ link is up. The first callsign is always the calling station and the second the answering station, whichever side this modem is. bw is the negotiated bandwidth in Hz (500, 2300 or 2750), which can be narrower than requested. The answerer's alias is the MYCALL entry the request was addressed to. A VIA … form exists in the formatter but is never produced on HF. |
LINK REGISTERED / LINK UNREGISTERED |
literal | Answering side only, right after CONNECTED. Tells the host whether the caller announced a registered (licensed) station. The calling side does not send this line. |
DISCONNECTED |
literal | The link has ended, or an outgoing CONNECT failed (no answer after the retries, or aborted). When the station sends a CW ID at close, DISCONNECTED follows it. |
BUFFER n |
n decimal bytes |
During a link, after the peer acknowledges data, n is the number of host bytes still queued for transmission (once for each acknowledged frame that carried data). BUFFER 0 means everything the host wrote has been delivered. See Data port. |
SN x |
one decimal place, e.g. SN 7.4, SN -3.0 |
Signal-to-noise in dB of the last good data frame received: from the session header, each received data burst, and received KISS/CQ broadcast frames. |
BITRATE (L) bps bps DIR |
e.g. BITRATE (12) 3219 bps TX |
The modulation level L used for a data burst and its net rate in bit/s. DIR is TX (about to transmit at this level) or RX (receiving at this level). There are two spaces after (L). Also sent for KISS/CQ broadcast frames. |
REGISTERED [c1 … c5] |
e.g. REGISTERED or REGISTERED N0CALL |
About 5 s after an accepted MYCALL. In registered mode it lists the MYCALL calls. Otherwise it is the bare word REGISTERED. |
ENCRYPTION DISABLED |
literal | Right after each REGISTERED. |
IAMALIVE |
literal | Every 60 s of modem (audio-sample) time, whether or not a host is attached. A keep-alive; hosts SHOULD ignore it. |
CQFRAME call [bw] |
e.g. CQFRAME N0CALL 2300 |
A CQ beacon frame was received while idle with chat mode ON. bw is left out if the frame's bandwidth code is unknown. |
TUNE d |
e.g. TUNE -5 |
Reply to TUNE ? only. |
VERSION VARA HF v4.9.0 |
literal | Reply to VERSION only. |
Not implemented: MISSING SOUNDCARD (and any other soundcard-failure notice) is never sent. Audio failures are handled by the modem process itself. ENCRYPTION READY and other encryption states are never sent; links are always unencrypted.
Typical ordering:
- Caller:
OK(toCONNECT) →PTT ON/PTT OFFper connect request →UNENCRYPTED LINK→BITRATE (L) … TX→PTT ON/OFF→CONNECTED …. - Answerer:
PENDING→PTT ON/OFF→BITRATE (L) … RX→SN x→UNENCRYPTED LINK→CONNECTED …→LINK REGISTEREDorLINK UNREGISTERED. - Teardown:
PTT ON/OFF(QRT, optional CW ID) →DISCONNECTED.
Data port#
- The data port carries a raw, unframed byte stream in both directions. There is no line structure, escaping or encoding: bytes are passed through unchanged.
- Host → modem. The modem reads the socket in chunks of up to 64 KiB and appends the bytes to the transmit queue.
- While a link is up, the bytes go straight into the ARQ session's transmit buffer and are sent in order. With
COMPRESSION FILESnegotiated they may be held briefly so they can be compressed as a block. - While no link is up (listening), the bytes are kept in a pre-link buffer of at most 600 000 bytes. Anything beyond that is discarded. The pre-link buffer is handed to the session as soon as a link is set up, so a host MAY write its first data before
CONNECTED. Data written when no link ever comes up stays queued;CLEANTXBUFFERreports it but does not clear it. - Modem → host. Payload received over the link is written to the data port in order, as soon as it has been reassembled and, if needed, decompressed. If no data client is attached, received data is lost.
- Flow control. The modem uses TCP back-pressure: while a link is active and 600 000 or more bytes are queued for transmission, it stops reading the data socket until the queue drops below that limit. Hosts SHOULD also pace themselves using
BUFFER n. BUFFERaccounting.ncounts host bytes queued and not yet acknowledged by the peer, including bytes held for file compression. It is reported only when an acknowledgement makes the count go down (or a partial acknowledgement changes it). This modem does not sendBUFFER nwhen the host writes data, unlike some VARA builds. A host that waits forBUFFER 0MUST have written data that has since been acknowledged on a live link, or it will wait for ever. Bytes in the pre-link buffer are not reported throughBUFFER.- The modem watches outgoing host data for the Winlink B2F quit. When the host writes a block that is exactly
FQ\rin one data-port read, the modem closes the link after the peer acknowledges that turn and the transmit queue is empty. The host does not need to sendDISCONNECTafterFQ, though doing so is harmless. IfFQ\rarrives split across reads, or merged with other bytes, the modem does not detect it.
KISS port#
The KISS port carries unproto (connectionless, unacknowledged) traffic, sent over the air as 500 Hz broadcast bursts independent of the session bandwidth. It is used for APRS-style packets and short broadcasts. It never touches the ARQ link.
Framing#
- Standard KISS framing:
FEND= 0xC0 starts and ends a frame; inside a frame, 0xC0 is sent asFESC TFEND(0xDB 0xDC) and 0xDB asFESC TFESC(0xDB 0xDD). ConsecutiveFENDs (empty frames) are ignored. - The first byte after
FENDis the command/port byte. The modem accepts only:
| Byte | Meaning | Payload |
|---|---|---|
0x00 |
AX.25 frame | AX.25 UI frame (addresses, control, PID, info) without FCS |
0x01 |
AX.25 frame, long form | as 0x00 |
0x02 |
generic data | arbitrary bytes; 7-bit text is packed to 7 bits per character on air |
- Frames with any other command byte (including KISS parameter commands such as TXDELAY, persistence and SetHardware) are ignored.
- Frames of type 0x00/0x01 shorter than 19 bytes on the wire (counting both
FENDs) are discarded. Type 0x02 has no minimum length. - A frame longer than 5000 bytes (before unescaping) is discarded.
Transmit#
- Frames queue in the modem up to 5000 bytes in total. Frames that would exceed that are dropped.
- A frame is sent only when the modem is idle (no ARQ link, no transmission, no tune tone). On 500 Hz sessions, unless
IGNOREKISSDCD ONis set, the modem first waits for a clear channel and then transmits with p-persistence (default 0.3, set by the modem's configuration). - Each frame is encoded, given a modulation level suited to its size (and whether it carries an APRS position), split into at most 18 fragments, and sent as one burst. A frame that needs more than 18 fragments, or an AX.25 frame that cannot be encoded, is dropped silently.
- The command port sees
PENDING,PTT ON,BITRATE (L) … TX,PTT OFFandCANCELPENDINGfor each broadcast.
Receive#
- Broadcast reception is enabled only while at least one KISS client is attached and the ARQ session is idle.
- Each successfully received frame (CRC-checked, reassembled) is sent to every attached KISS client, KISS-framed with the command byte it was sent with (0x00/0x01 for AX.25, 0x02 for generic).
- On the command port, received broadcasts produce
BITRATE (L) … RXandSN x.
Clients#
Up to 10 KISS clients may be attached at once; further connections are closed immediately. Disconnecting a KISS client does not affect the command or data ports.
Worked example#
This transcript uses two SPEEDBIRD modems: N0CALL (the caller, driven by a Winlink-style host) and N0CALL-1 (the answerer). Both run at 2300 Hz, unregistered. Timing gaps, the number of PTT cycles and the BITRATE/SN values depend on the channel and are illustrative. Line endings (<CR>) are left out.
Caller (N0CALL), command port 8300
(host opens TCP 8300)
← BUSY ON
← BUSY OFF
(host opens TCP 8301)
← BUSY ON
← BUSY OFF
→ VERSION
← VERSION VARA HF v4.9.0
→ MYCALL N0CALL
← OK
→ LISTEN OFF
← OK
→ BW2300
← OK
→ COMPRESSION TEXT
← OK
→ WINLINK SESSION
← OK
← REGISTERED (about 5 s after MYCALL)
← ENCRYPTION DISABLED
→ CONNECT N0CALL N0CALL-1
← OK
← PTT ON (connect request)
← PTT OFF
← UNENCRYPTED LINK (answer heard; header goes out)
← BITRATE (5) 270 bps TX
← PTT ON
← PTT OFF
← CONNECTED N0CALL N0CALL-1 2300
The host now exchanges data on port 8301 (a B2F handshake in this example):
data ← [SID] … N0CALL-1 de N0CALL … >\r (bytes from the peer)
data → ;FW: N0CALL\r[…]\rFF\r (host's reply)
Command-port traffic during the exchange:
← SN 9.6
← BITRATE (8) 735 bps RX
← PTT ON
← BITRATE (8) 735 bps TX
← PTT OFF
← BUFFER 0 (all host bytes acknowledged)
Teardown, started by the host:
→ DISCONNECT
← OK
← PTT ON (QRT, then CW ID if configured)
← PTT OFF
← DISCONNECTED
Answerer (N0CALL-1), command port 8300 on its own machine, after MYCALL N0CALL-1, LISTEN ON (and OKs):
← PENDING (connect request for N0CALL-1 heard)
← PTT ON
← PTT OFF
← BITRATE (5) 270 bps RX
← SN 11.2
← UNENCRYPTED LINK
← CONNECTED N0CALL N0CALL-1 2300
← LINK UNREGISTERED
… data exchange, BUFFER / SN / BITRATE / PTT …
← DISCONNECTED
A failed call (no answer after RETRIES attempts) shows OK, then one PTT ON/PTT OFF pair per attempt, then DISCONNECTED, with no CONNECTED.
Implementation notes#
Source files, relative to speedbird_python/:
hostserver.py: TCP listeners for the command port, data port (= port + 1) and KISS port; one client per port; CR line splitting, LF dropped, 1024-byte line limit; 64 KiB data reads; data hold (back-pressure); 4 MiB writer limit; up to 10 KISS clients.arq/hostcmd.py: command parser (exact keyword table, callsign validation and suffix fix-up, VB-style number parsing forRETRIES/TUNE/DRIVELEVEL) and exact spelling of every reply line.tnc.py: command → reply mapping and state conditions (idle checks, deferredMYCALL,LISTENdrops the link, busy toggle,REGISTERED+ENCRYPTION DISABLED5 s afterMYCALL,IAMALIVEevery 60 s, 60 s tune limit, host-disconnect cleanup).arq/host.py: host event types (Connected,Disconnected,Pending,CancelPending,Registered,Buffer,Sn,Data) and host settings (default retries 15, compression TEXT).arq/session.py: where ARQ events originate:PENDINGon an incoming request,CANCELPENDING/DISCONNECTEDin close handling,CONNECTEDon link-up,LINK (UN)REGISTEREDfrom the received header (answerer only),BUFFERafter acknowledgements,SNper received burst.station/__init__.py,station/hf.py: 600 000-byte pre-link/transmit limit,UNENCRYPTED LINKandBITRATEreporting,VERSIONstring,CONNECT/CQFRAME/BWpreconditions, VIA rejection on HF.arq/broadcast.py,arq/kiss.py,arq/kiss_host.py,arq/cq.py: KISS framing and accepted command bytes, 5000-byte queue, p-persistence/DCD, fragmenting (at most 18),PENDING/CANCELPENDINGaround broadcasts, receivedCQFRAMEline format.cli.py: defaults: address 127.0.0.1, command port 8300, KISS port 8100 (offdisables), p-persistence 0.3.
Known gaps and deviations, stated as found in the code: CLEANTXBUFFER only reports and does not clear; PUBLIC, CWID and GATEWAY are no-ops that return OK; CONNECT … VIA is always WRONG on HF; no BUFFER echo when the host writes; no MISSING SOUNDCARD; no encryption; an invalid MYCALL yields both WRONG and OK; data written before a link beyond 600 000 bytes is dropped.
Revision history#
| Version | Date | Changes |
|---|---|---|
| 1.0 (draft) | 2026-11-24 | First publication: physical layer, control frames and link establishment, ARQ data link, host interface. |