A long time ago I invested in a HackRF One device to play with Software Defined Radio (SDR). Over the years the available software has evolved and is evolving faster on a Linux platform compared to Windows. So when Microsoft introduced Windows Subsystem for Linux (WSL) I was exited to test it on my development system. Unfortunately the joy was short lived as there was no support for USB devices. Today I discovered that there was a way to make it all work. This post is a description of the steps needed to install WSL, a Linux distribution, the Gnu Radio software and how to make USB devices available to the Linux environment.
In order to use the WSL system there are a couple of Windows features that must be turned on. Change these will require the computer to be rebooted. As shown in the two screenshots below the Hyper-V feature and Windows Subsystem for Windows must be enabled.
When everything is installed and the system rebooted it's time to install the Linux distribution. There are several available to choose from. The list of distributions can be viewed by opening a Windows Terminal and executing the command 'wsl --list --online'. If you already have an older version of WSL installed it will be a good idea to run 'wsl --update' to insure the latest version is installed.
Use the command 'wsl --install -d Ubuntu-24.04' to install the latest version of Ubuntu. It is possible to install multiple distributions, and even to run them side by side. Using the wsl command will start a Linux terminal using the default distribution. I like to use a program called MobaXterm to interact with the Linux distributions on my system or with remote servers. The program comes with an X server that allows executing graphical applications and it know about all the WSL distributions that exists on the system.
Microsoft has contributed the the open source project 'usbipd' and created a special version called usbipd-win. Installing or updating this toll will allow the installed USB devices to be shared across to a linux distribution. Execute the following comman in a Windows terminal to install the tool:
When the tool is installed use the usbipd command to list the available USB devises. Note the BUSID for the device you would like to make available to the Linux distribution.
On my system the Hack RF One device has BUSID 2-2 and the following command will make the device available in the Ubunto environment.
The two images below shows MobaXterm with the list of available distributions and the terminal opened.
In order to view the available USB devices in the Linux Terminal it is necessary to install some tools called 'usbutils'. This package is installed by the following command:
After installation the lsusb command can be used to list the available devices. The image below shows the list of devices before and after attaching the the HACK RF One device as one of the available devices in the Linux environment.
Installing the GNU Radio packages and the required GTK packages can be done with the command shown below.
sudo apt-get install libgtk-4-1 libgtk-4-dev
sudo apt install python3-gi gobject-introspection gir1.2-gtk-3.0
With everything installed the system is ready to use. I now have some work to do to update the projects I created when I first started to use GNU Radio. There has been many changes to the available objects. In the coming posts I'll share some of the projects I have created for signal generators, spectrum analyzers and other radio related items.
The November meeting in the PNW Microwave group was used to discuss Gnu Radio and HackRF One. We installed the Windows version of Gnu Radio (binaries can be found here). To verify the installations we used a flowgraph for a narrow band FM receiver.
After the meeting John (W7FU) was inspired to install the latest version of GNU radio and he created 3 flowgraphs. I modified these to be used with HackRF One by adding the OsmoSDR versions of sink and source. I disabled the UHD:USRP versions but left them in the flowgraph for reference.
This flow graph does not require any external hardware. This simulator visualize the USB, LSB or CW signal in the frequency domain. The first image below shows the flowgraph and the second is a screen shot of the output.
This flowgraph generates a very simple receiver and show the frequency spectrum. The HackRF One is limited to a 10 MHz bandwidth but with the use of the variables and GUI controls it can be used to show the spectrum anywhere from 10 MHz to 6GHz. A handy little spectrum analyzer although the sensitivity of the HackRF device is not that great and my version is installed in a plastic box allowing RF to get injected anywhere on the circuit board.
The signal generator is also very simple. It consists of a signal source and a sink (the component that communicate to the hardware. I tested this by tuning my handheld FM receiver to the same frequency and adjusting the drive until I was able to hear the signal. This can also be used on any frequency form 10 MHz to 6GHz with the HackRF One device.