Start a conversation

innerpulseNotes

Testing radio decoders without a radio

Why every decoder at innerpulse is built to replay recorded signals, and what that changes for firmware, desktop and server radio software.

The hardest part of writing a radio decoder is not the math. It is that the signal you need is almost never on the air when you are ready to test. A pager network transmits when it feels like it, a trunked system moves calls between channels, and an FT8 band is busy at one hour and silent the next. If the only way to check a change is to wait for the right transmission, every bug takes days and no fix can be proven.

So every decoder in the innerpulse portfolio is built around one rule: given the same samples, it must produce the same result, every time, with no radio attached.

Capture once, replay forever

uSDR, the studio’s software-defined radio server and desktop console, can save raw I/Q samples to disk. Feeding that capture back in reproduces identical decode events: the same RDS station names, the same POCSAG pages, the same FT8 messages, in the same order. A bug report stops being “it missed a page last night” and becomes a file that misses the page on demand.

That only works if the decoders are deterministic. Nothing in the signal path can depend on the wall clock, on which thread happens to run first or on unseeded randomness. Time has to be measured in samples, not read from the computer’s clock.

Byte-identical builds

digisdr, a headless HF receiver rebuilt from the terminal tool hfscan, takes the idea one step further. A set of recorded captures runs on every build, and the decode output has to match the recorded output byte for byte. If a refactor changes a single decoded character, the build fails.

This turns signal processing changes, which are notoriously hard to review, into ordinary diffs. Improving a filter either changes the output, which shows exactly what got better or worse, or it does not, which proves the change was safe.

Firmware: test on the host, then on the radio

Microcontroller firmware is harder still, because the code runs inside a handheld radio with a tiny debugger window. The UV-K5 Receiver firmware, which adds POCSAG and MDC-1200 decoding to a radio with 61,440 bytes of flash, has a host-side test suite that runs its decoders on a desktop without a radio, so frame sync, BCH(31,21) error checking and CRC-16 can be checked on every change.

The DM-1701 P25 Workspace goes further with a self-test that runs under the Unicorn CPU emulator, so code can be exercised on a laptop before it is flashed.

Some problems only show up on real hardware. The DM-1701 Tier III Monitor, a DMR trunking monitor that runs inside the radio, was built as a capture-driven reverse-engineering log over more than 300 commits. Recorded captures drove each step, so a theory could be checked against the same evidence again and again before it was tried on air.

What this means for a client project

  • Bugs come with a capture attached, so they can be reproduced and fixed without access to the original signal or site.
  • Every decoder change is checked against a growing library of real recordings before it ships.
  • Performance work is safe: speed can be improved while the output stays provably the same.
  • Field problems can be investigated remotely from a capture instead of a site visit.

The same principle applies well beyond radio. Any system that consumes a stream it does not control, from market data to sensor feeds, gets easier to build and to trust once its inputs can be recorded and replayed.