The Funcube Dongle Pro and Pro+ on the Raspberry Pi

Although I have had a Raspberry Pi rev B for several weeks now, it wasn’t until last night that I got a chance to try it out. Since several people have reported failed attempts at getting the Funcube Dongle Pro and Pro+ play nicely with the Raspberry Pi, I decided to take it as far as I could in those few hours. The result is this very brief tech note about how to make the Funcube Dongle Pro and Pro+ work on the Raspberry Pi.

Funcube Dongle Pro+ and Raspberry Pi

Well, make it work might not be the most accurate term. The Funcube Dongle uses USB audio and HID interfaces; therefore, in theory it works without requiring any device drivers. But we still need an application that can talk to the Funcube Dongle and set the frequency, gain, and whatever other parameters are supported by the firmware. A few people have tried using qthid on the Raspberry Pi but it didn’t work out at all. Using the hidraw driver, which is the default on linux, qthid fails to detect the Funcube Dongle. Using the libusb interface qthid detects the Funcube Dongle but then quickly crashes or freezes.

A different approach is to try with a simple command line tool and this is the approach I am going to describe here. About a year ago David Pello EA1IDZ created a small utility called fcdcontrol, which he used to set the frequency and gain of the Funcube Dongle from various scripts. Today, we can use his simple tool on the Raspberry Pi to set the frequency and gain of the Funcube Dongle Pro and – with some modifications – the Pro+. The base code is the same as in qthid but fcdcontrol is much simpler than qthid and has better chances of working well on a small embedded device such as the Raspberry Pi.

I have forked the original code and made some modifications. Some of these modification were necessary to make it work with the Pro+, some others were simpler updates such as using the latest HID API code. The forked repository is also available on Gitorious now available on Github. The same source code supports both the Funcube Dongle Pro and the Pro+ – the device is selected at compile time.

I was using the official Raspbian “wheezy” image that I purchased from RS together with my board. I have updated all packages to the latest officially available versions. In the following I am assuming that you have a terminal or shell connection to your Raspberry Pi – this could be an ssh connection from a remote computer or a terminal in the graphical desktop.

First, make sure you have git and libusb-dev packages installed:

  pi@raspberrypi ~ $  sudo apt-get install git-core libusb-1.0-0-dev

Second, be sure to have the udev rule in place. For the Funcube Dongle Pro:

  pi@raspberrypi ~ $  wget https://raw.github.com/csete/qthid/master/funcube-dongle.rules 
pi@raspberrypi ~ $
sudo cp funcube-dongle.rules /etc/udev/rules.d/

And for the Funcube Dongle Pro+:

  pi@raspberrypi ~ $  wget https://raw.github.com/csete/qthid/fcdpp/funcube-dongle-proplus.rules 
pi@raspberrypi ~ $
sudo cp funcube-dongle-proplus.rules /etc/udev/rules.d/

Finally, checkout and build the source code for fcdcontrol:

  pi@raspberrypi ~ $  git clone https://github.com/csete/fcdctl.git fcdctl
  pi@raspberrypi ~ $ cd fcdctl
  pi@raspberrypi ~/fcdctl $ make

If you want to build for the Pro+ use “make fcdpp” instead of the plain “make” above. In either case you should have an executable file fcdctl in the directory. Here are a few things to try (example shown for the Funcube Dongle Pro+):

  pi@raspberrypi ~/fcdctl $ ./fcdctl
FCDcontrol V 0.4.1-fcdpp
USAGE: ./fcdctl options [arguments]
-l   --list            List all FCDs in the system
-s   --status            Gets FCD current status
-f   --frequency <frequency>    Sets FCD frequency in MHz
-g   --gain <gain>            Enable/disable LNA gain (0 or 1)
-i   --index <index>        Which dongle to show/set (default: 0, i.e. first)
-h   --help                   Shows this help
  pi@raspberrypi ~/fcdctl $ ./fcdctl -l
nr   USB path       firmware   frequency         LNA gain   audio device
0    0001:000a:02   20.01        97.300000 MHz   disabled    (not found)
  pi@raspberrypi ~/fcdctl $ ./fcdctl -s
FCD present in application mode.
FCD firmware version: 20.01.
FCD frequency: 97.300000 MHz.
FCD LNA gain: disabled.
  pi@raspberrypi ~/fcdctl $ ./fcdctl -f 144.567
Freq set to 144.567000 MHz.
  pi@raspberrypi ~/fcdctl $ ./fcdctl -g 1
LNA gain enabled.

Some times the application will hang when asking for status using the -l or -s switch. This is consistent with the “freezing” behavior experienced when trying to run qthid/libusb on the Raspberry Pi. I also tried to switch to the hidraw driver (the default in qthid) and fcdcontrol also fails to detect any FCDs plugged in. After some googling I found out that the hidraw driver is not included in the Raspbian kernel and one must compile a custom kernel to have it included. I have not done that.

This is all I have for now. It is just a small first step and the big question is of course what to do with the Funcube Dongle attached to the Raspberry Pi. I don’t think this arm v6 device has enough mojo to do any interesting SDR. Some people have suggested to stream the I/Q data to more powerful host computer and that may indeed be an interesting option. Looking forward to see what people come up with.