Log entry ·
VardeFM 0.3.2: digipeating
VardeFM 0.3.2 is out. The big news is digipeating: a session can now go through up to two VardeFM digipeaters, so two stations that can't hear each other can still exchange data. It's experimental, and I need help testing it on the air.
A week ago I wrote about VardeFM, my open-source FM data modem that works as a drop-in replacement for VARA FM. Today I released version 0.3.2, and the main new feature is digipeating.
What digipeating is
A digipeater is a station that repeats what it hears. If you can’t reach a station directly, maybe because there’s a hill in the way, you can route the session through a third station that both of you can hear. With VardeFM you now connect like this:
CONNECT <mycall> <target> VIA <d1> [<d2>]
That’s the same command VARA FM uses, so the host program doesn’t need to know anything new. You can name one or two digipeaters. Turning a station into a digipeater is one option:
vardefm modem --digi <call>
It repeats the sessions routed through that call, whether or not a host program is connected. A digipeater can also run sessions of its own at the same time.
How it works
A VardeFM digipeater is a simple parrot. It waits for a burst to end, then sends the whole thing again 0.2 seconds later at the same speed level. It doesn’t store anything, and it doesn’t acknowledge anything. Acknowledgements, retries and the choice of speed level stay between the two end stations.
If a digipeater can’t decode part of a burst, it passes that part on marked as void. The receiving station treats it as failed and the sender sends that data again. That way a bad first hop doesn’t turn into corrupted data at the far end.
To save airtime, call signs are only sent in the connect request and its answer. After that every burst carries a short header with a session id and a small counter that each digipeater raises when it repeats the burst. The counter tells each digipeater whether it’s its turn, and tells the end station when a burst has come all the way through.
Why only two digipeaters
My first design allowed three. It ended up at two, and the reason is a bug that turned up in code review.
The session id is only 8 bits, drawn at random for each connect. In the first design, a burst from the caller on a routed session looked exactly like a burst from an ordinary direct session, as long as the two happened to have the same id. The odds are 1 in 255 per connect, which sounds small. But a digipeater on a hilltop that hears a lot of stations during a long file transfer will see enough connects for it to happen. With 50 foreign connects the chance is about 18 %. And when it happens, the digipeater starts repeating a session it has nothing to do with, right on top of the station answering it. The link isn’t slow then, it’s broken.
I first patched it with rules in the digipeater, and the next review found that one of those rules created a new failure somewhere else. The real fix was to make sure a routed burst can never look like a direct one. All the flag bits in the header were already used, so the mark had to come from the hop counter: 0 now means “direct session”, and counting starts at 1. With 2 bits that leaves room for two repeats, not three.
VARA FM also allows two digipeaters. I don’t know why they chose that, but after working through this I have a guess: with a short header, every extra hop fights for the same few bits as everything else the header has to say.
There are other good reasons not to go further. Every hop costs a full copy of each burst on the same frequency, so throughput drops to about half with one digipeater and a third with two. The sender also has to wait for the whole round trip before it knows a burst went missing: about 11 seconds with one digipeater and 20.5 seconds with two, in narrow mode. A loss on any hop costs the whole wait. If you want longer paths you need store-and-forward nodes, and that belongs in a layer above the modem.
Other changes in 0.3.2
There’s more in this release than digipeating, and some of it came from a new contributor, mustig, who has done a lot of careful work on the modem:
- Busy detection only looks at the band the modem uses. A CTCSS tone, mains hum or hiss above the band no longer counts as a busy channel. This means the modem can now work through a repeater’s tail, which it couldn’t before.
- A transfer could stall for good after lost bursts and a change of speed level, with the session still connected. That’s fixed.
- Session ids are seeded from the operating system’s randomness. Before, two stations started from the same system image could draw the same ids.
- Performance gates. New tests that fail if decoding performance gets worse, so a change can’t quietly hurt weak-signal performance.
- Bad samples from the sound card (NaN or far beyond full scale) no longer lose a burst.
The full list is in the changelog.
Direct sessions look exactly as before on the air, so 0.3.2 works with 0.3.0 and 0.3.1 as long as you’re not using a digipeater.
Help me test it
Digipeating is marked as experimental. Everything here has been tested in the simulator, which can now put digipeaters between the two stations with vardefm sim-pair --digi <call>. It has not been tried with real radios yet.
How a routed session looks on the air may change in the next release, so all stations on a routed session should run 0.3.2. It also doesn’t work with VARA FM digipeaters, only VardeFM ones.
If you have three stations, or a spot where you could put a digipeater, I’d really like to hear how it goes. Builds for Windows, Linux, macOS and the Raspberry Pi are on the releases page. Reports, bugs and ideas are welcome on GitHub or by email to contact@lb1dk.no.
73 de LB1DK