Can we use a Raspberry Pi model B as FreeDV modem?

I have collected a bunch of old Raspberry Pi model B’s equipped with the Wolfson audio board. You may find these board lying around and collecting dust, as they have been obsoleted by an increasing number of multi-core boards. I will use these boards as simple Softrock SDR receivers, but first I want to do a little experiment. I am going try using them as a headless FreeDV modem similar to the SM1000.

Old Raspberry Pi with Wolfson audio card as FreeDV modem?

The Wolfson audio card (now called Cirrus Logic Audio card) is a mixed bag. It is an excellent piece of hardware with less excellent software support. For some reason, the drivers are still not included in the Raspbian kernel and users are left to using Cirrus’ image or building the kernel themselves.

The Cirrus linux image appears to be a custom version of an older Raspbian desktop image. A 1.7 GB ZIP file that on a good day downloads at 100 kb/s from Farnell… Building the kernel yourself following instructions that do not work is not so much fun either.

What the hell are these companies thinking about anyway?

Fortunately, there is always an individual who delivers a usable solution even when big corporations fail. Matthias “Hias” Reichl has provided both kernel patches and a quite painless binary installation of a working 4.4.6 kernel containing the Cirrus audio drivers. Once installed and tested, remember to disable kernel and bootloader upgrades, otherwise the kernel will be rolled back to the official kernel at the next update.

Enough ranting about the Wolfson / Cirrus audio card. Let’s get back to running FreeDV on this old Raspberry Pi model B.

First step is to assess whether this old model is capable of running FreeDV without modifications. I want to use it as headless unit, so running the FreeDV GUI application is not an option and probably not feasible either on this small CPU.

The FreeDV source code comes with two command line utilities, freedv_tx and freedv_rx.

Freedv_tx takes raw audio input, encodes it using codec2 and modulates using the selected mode. It outputs digital baseband that can be transmitted over the air using an SSB or FM transmitter.

Freedv_rx works the other way around. It takes the digital baseband as input, which is the audio output of an SSB or FM receiver, demodulates it according to the selected mode and finally decodes it to speech.

I used these two tools together with the /usr/bin/time command to measure how much CPU the modem uses.

I took the ve9qrp.wav file included with the source code. It is approximately 112 seconds long and dividing the time it takes for the freedv_tx or freedv_rx to run with 112 s gives us the CPU load. I was positively surprised to learn that all modes consume less than 50% CPU. The results are shown in the table below.

Mode Time CPU load
TX 1600 15 s 13%
RX 1600 27 s 24%
TX 700 16 s 15%
RX 700 41 s 36%
TX 700B 17 s 16%
RX 700B 43 s 38%
TX 2400A 10 s 9%
RX 2400A 20 s 18%
TX 2400B 9 s 8%
RX 2400B 15 s 13%
TX 800XA 12 s 11%
RX 800XA 14 s 13%

The different modes require different sample rates and there will be some additional CPU load from resmapling. But so far it looks like this could become a working setup for doing FreeDV using existing radios without a PC.

The tests were run on the Raspbian Jessie light from 2016-05-10 with custom kernel as described above, but otherwise upgraded to latest packages. GCC version 4.9. The FreeDV code was rev 2812 from SVN built as release build.