PACTOR-I in SPEEDBIRD (speedbird.pactor1)#
Status: simulation-verified only. Implemented from the public PACTOR-I descriptions (DL6MAA / DF4KV,
1991; the SCS PACTOR-I protocol description). No SCS firmware, no decompiled code, no GPL code. Interop with
real SCS PTCs / Winlink PACTOR RMS gateways is UNVERIFIED until an on-air test (plan below).
Several constants are marked # VERIFY in src/speedbird/pactor1/constants.py.
Package#
| File | What |
|---|---|
constants.py |
All protocol constants and thresholds (one place to correct after an on-air capture) |
crc.py |
CRC-16 (X.25/HDLC form of CCITT) + GF(2)-linear vectorised checker for timing search |
phy.py |
CPFSK modulator (100/200 Bd, 200 Hz shift, default 1400/1600 Hz), streaming non-coherent demodulator, stateful resampler |
frame.py |
Packets, status byte, SYNCH / connect info, CS1-CS4, packet search over timing offsets, memory-ARQ soft decode, CS detector |
arq.py |
Pactor1Session (a modem.protocol.LinkSession): ISS/IRS, connect, ack/repeat, memory-ARQ, speed up/down, changeover, QRT, timeouts |
fec.py |
Unproto (FEC broadcast) TX and receiver |
protocol.py |
Pactor1Protocol (LinkProtocol factory) – not registered |
sim.py |
Pactor1Sim: two stations, fake clock, AWGN, delay, burst loss, 8 k / 48 k, PairSim-compatible stepping |
Protocol summary (as implemented)#
- PHY: 2-FSK, 200 Hz shift around
center_hz(1500 Hz default), bit 1 = upper tone (# VERIFY polarity), 100 or 200 Bd, continuous phase, 2 ms raised-cosine edges. 8 kHz internally; any input rate is resampled. - Packet (LSB first):
HEADER 0x55 | DATA (8 B @100 Bd, 20 B @200 Bd) | STATUS | CRC-16 (low byte first)= 96 / 192 bits = 0.96 s. CRC over DATA+STATUS, CRC-16/X-25 (poly 0x1021 reflected, init/xorout FFFF). - Status byte: b0-1 packet counter, b2-3 data mode (0 full 8-bit, 1 Huffman = TODO, 2 short: last data byte = count, 3 control = callsign), b5 PROBE (SPEEDBIRD extension), b6 BK (unused), b7 QRT.
- Control signals (12 bit, 100 Bd, MSB first): CS1
0x4D5, CS20xAB2, CS30x34B, CS40xD2C(pairwise Hamming distance 8, which matches the public description). Note CS4 = CS3 shifted by two bits (and CS2 shares 7 bits with the tail of CS1), so the detector uses the unnormalised correlation peak, requires energy in every bit and a quiet tail, so a truncated CS is not read as another code. - Cycle: 1.25 s. ISS packet at T (0.96 s); IRS answers 40 ms after the packet end (CS 0.12 s); the ISS listens to T + 1.22 s (100 ms round-trip + latency slack) and decides early once a complete CS is in.
- Acks: CS1 = ack of even counter, CS2 = odd; the IRS repeats the previous ack to ask for a repeat. CS3 (break-in) and CS4 (speed change) also ack the packet just received. Duplicates (ack lost) are detected by the counter and re-acked with the same CS.
- Connect: caller sends SYNCH (control packet, counter 0, data = called call, 100 Bd) every cycle;
the called station answers CS1; the caller sends its own call in packet 1 (control); both report
connected. A repeated SYNCH is a duplicate of packet 0 and is re-acked. - Memory-ARQ: the IRS keeps the normalised soft bits of a packet that failed CRC (best timing in the window) and adds each repeat; the sum is CRC-checked (up to 6 copies; reset on success or speed change).
- Speed: IRS sends CS4 after 3 consecutive clean full 100 Bd packets (quality >= 0.82, ~5 dB) to go up, and after 2 poor 200 Bd packets (memory-ARQ needed or quality < 0.62) to go down. The IRS always tries both speeds. If the ISS gets no ack 3 times at 200 Bd it falls back by itself and sends a 100 Bd PROBE with the unacked counter: the IRS answers "have it" (ack of that counter) or "don't" (previous ack), so the 20-byte packet is neither lost nor duplicated when re-cut into 8-byte packets.
- Changeover: the IRS with data sends CS3 when the ISS's packet was not full (idle) or after 8 full
packets (fairness), or immediately when it wants to disconnect. The ISS answers with CS1 in its next
packet slot (the "ack of packet 0" of the new direction) and becomes IRS; the old IRS takes that CS1
(lone CS, quiet tail) as the go-ahead and sends its first packet so that its CS slot lands on the old
grid. If the CS1 is missed, the new IRS keeps repeating it (normal NAK, a round trip later; the
echo window reaches
cs_slackpast the slot), so the hand-over completes. - Late packets: the IRS answers on time (it searches only to
cs_delay - 5 mspast the expected start before its CS is due); a later packet is picked up afterwards for its data and timing only and is answered when the ISS repeats it (duplicate -> the stored answer). This keeps the CS on the grid. - QRT: the ISS sends a packet with the QRT bit once its buffer is empty; the IRS acks, reports
disconnected (qrt by peer)and keeps re-acking repeats for 4 cycles. No ack after 4 tries also ends. - Timeouts: 25 SYNCH cycles ->
failed; 20 cycles (25 s) without a valid packet / CS ->timeout. - Unproto: packets repeated N times (default 2) back to back with 40 ms gaps; the receiver scans both speeds continuously and reports each new (counter, data) once.
Timing requirement#
PACTOR-I is a tight half-duplex protocol: 290 ms between packet end and the next packet must hold the
IRS's turnaround, the CS and the round trip. feed_rx chunks / tick intervals of <= 50 ms are needed
with now() = wall time (tested: 20 ms and 50 ms). In modem.sim.PairSim use step_s <= 0.02: PairSim
feeds station A before B in each step, so a burst handed over less than one step ahead (an IRS CS is
due 40 ms after the packet) loses its head at the other station; with 0.1 s steps CSs arrive truncated
and links fail.
Bursts are handed to transmit up to tx_lead_s (150 ms) early with leading silence so they start on
the exact slot whether transmit blocks or not. A real radio path must keep audio latency + PTT
turnaround well under ~60 ms each way, or cs_slack_s must be raised (the IRS window tracks).
What is verified (sim only)#
tests/pactor1/ (26 tests, ~30 s):
- CRC-16/X-25 check value, linear CRC checker, LSB-first bit order, packet layout, CS code distances.
- PHY loopback 100 Bd at 10 / 0 / -3 dB and 200 Bd at 10 / 3 dB (SNR in 2500 Hz), streaming 48 k input. Observed: 100 Bd copies to about -3..-5 dB, 200 Bd to about 0 dB, CS detection ~98 % at -4 dB, ~90 % at -6 dB; ~0 false CS per 1500 noise windows; no false packets in 20 s of noise.
- Memory-ARQ: a packet that fails singly at -9 dB decodes from the sum of copies (PHY test), and saves repeats in a live link at -7 dB.
- ARQ: connect, data both ways with changeovers, QRT from ISS and from IRS (break-in), 3 dB + 20 ms delay
- 10 % burst loss, speed up at 15 dB / down at -3 dB / up again, ISS fallback probe with lost packets and with lost CSs (no loss, no duplicates), link timeout, connect failure, SYNCH for another call ignored, 48 kHz with PairSim stepping (20 ms), unproto at both speeds.
- Extra seed sweep (not in the suite): 18/18 links completed 512 B + 100 B both ways and QRT at 3 dB / 20 ms / 10 % loss, 6 dB / 30 ms / 5 % loss at 48 k (PairSim stepping), and 5 dB / 40 ms / 5 % loss with 50 ms feeds; memory-ARQ link at -7 dB 3/3.
Known gaps vs real SCS PACTOR-I#
- Exact bit-level format not confirmed: header value, bit order, CRC variant/byte order, status-byte bit assignment, how short / idle packets are marked, SYNCH contents (real P-I sends the called call in a specific layout and may send the caller's call differently), CS timing offset, tone polarity.
- Huffman compression (status mode 1) not implemented: the P-I Huffman table is not reproduced here; SPEEDBIRD always sends 8-bit data. A real P-I station sending Huffman text would be rejected (mode 1).
- The PROBE bit and the changeover hand-shake (CS1 echo) are SPEEDBIRD designs; real P-I's changeover sequence and its behaviour on speed fallback may differ, so they may not interoperate.
- No PACTOR "long path" timing, no listen/monitor mode for third-party QSOs, no MAXERR / ACK-timing
options, no CW ID, no
BK(ISS-initiated changeover). - Unproto timing and memory-ARQ across unproto repeats are not done.
Host interface design (not built yet)#
Goal: Pat's pactor:// transport (and Winlink Express) drive SPEEDBIRD as if it were an SCS PTC.
- pty:
core/pactorhost.pyopens a pty pair, symlinks the slave to/var/lib/speedbird/pactor/ptcand sets Pat'spactor.pathto it (baud rate ignored). - Command mode: answer the init Pat sends (seen in the Pat 1.0.1 binary:
MYcall,MAXE 35,TONES,PTCH,REM 0,CHOB 0,CWID 0,VER,JHOST4): accept all withcmd:prompts,VER-> a PTC-II style version string,MYcallsets the session call,JHOST4switches to host mode. - WA8DED CRC host mode (JHOST4): frames
AA AA | channel | code | len-1 | data | CRC16withAAstuffing; channel 0 = commands, channel 31 = PACTOR, channel 255 = status polls ("G" poll). MapC CALL->Pactor1Session.connect,D->disconnect, channel 31 data ->send, received data -> channel 31 info frames, link state -> "CONNECTED to ..." / "DISCONNECTED" link status messages,%T/ buffer polls ->status()["buffer"]. The exact host-mode codes must be checked against Pat'spactorsource (MIT) before writing, not guessed. - Audio / PTT: same pattern as
core/ardopiq.py: the radio's receive audio from the IQ ring / RadioPort, demodulated at the configured IF (12 kHz IF on R8600/9700 pericom-if-output), fed in <= 20 ms chunks;transmitgoes through the TX arbiter (Part 97 checks, power cap, watchdog). PTT turnaround must be measured per radio: P-I needs < ~60 ms. - SBP mode: register
Pactor1Protocolas protocolpactor1with family levelspactor1:100,pactor1:200inmodem/registry.py(owned elsewhere; see the docstring inpactor1/protocol.py).
On-air test plan#
- Monitor first (RX only): tune a known PACTOR-I-capable RMS / a P1 beacon; record IQ/audio; run
frame.searchoffline over the recording with both tone polarities and bit orders; confirm header, CRC, status layout and CS timing. Fixconstants.pyfrom the capture. - Loopback on air between two SPEEDBIRD radios (own station, dummy load / low power, licensed operator present): connect, transfer, changeover, speed change, QRT.
- Against a real PTC (borrowed SCS PTC-II/III in PACTOR-I mode, or
PTP1 level forced on the PTC): connect both directions, unproto, Huffman off then on. - Winlink RMS that still accepts PACTOR-I: Pat
pactor://via the host emulation.