Getting Startted With GNU Radio and USRP
Getting Startted With GNU Radio and USRP
Getting Startted With GNU Radio and USRP
Preliminaries
Steps
Installing Dependencies
Open Ubuntu terminal
Once the system has been updated, then install the required dependencies for UHD and GNU
Radio.
sudo apt-get -y install autoconf automake build-essential ccache cmake cpufrequtils doxygen
ethtool fort77 g++ gir1.2-gtk-3.0 git gobject-introspection gpsd gpsd-clients inetutils-tools
libasound2-dev libboost-all-dev libcomedi-dev libcppunit-dev libfftw3-bin libfftw3-dev libfftw3-
doc libfontconfig1-dev libgmp-dev libgps-dev libgsl-dev liblog4cpp5-dev libncurses5 libncurses5-
dev libpulse-dev libqt5opengl5-dev libqwt-qt5-dev libsdl1.2-dev libtool libudev-dev libusb-1.0-0
libusb-1.0-0-dev libusb-dev libxi-dev libxrender-dev libzmq3-dev libzmq5 ncurses-bin python3-
cheetah python3-click python3-click-plugins python3-click-threading python3-dev python3-
docutils python3-gi python3-gi-cairo python3-gps python3-lxml python3-mako python3-numpy
python3-numpy-dbg python3-opengl python3-pyqt5 python3-requests python3-scipy python3-
setuptools python3-six python3-sphinx python3-yaml python3-zmq swig wget
Note: if the shell PATH is set such that /bin comes before /usr/bin, then this step is likely to fail
because cmake will set the FIND_ROOT_PATH to / and this setting will fail as a prefix for Boost
headers or libraries. The cmake output will include messages such as
and
1. /usr/bin/cmake ..
2. PATH=/usr/bin:$PATH cmake ..
3. cmake -DCMAKE_FIND_ROOT_PATH=/usr ..
Next, you can optionally run some basic tests to verify that the build process completed
properly.
Make test (should pass all tests)
Next, install UHD, using the default install prefix, which will install UHD under the
/usr/local/lib folder. You need to run this as root due to the permissions on that folder.
Sudo ldconfig
finally, make sure that the LD_LIBRARY_PATH environment variable is defined and includes the
folder under which UHD was installed. Most commonly, you can add the line below to the end
of your $HOME/.bashrc file:
export LD_LIBRARY_PATH=/usr/local/lib
For this change to take effect, you will need to close the current terminal window, and open a
new terminal.
At this point, UHD should be installed and ready to use. You can quickly test this, with no
USRP device attached, by running uhd_find_devices. You should see something similar to the
following.
sudo uhd_images_downloader
Note: Since this installation is being installed to a system level directory (e.g. /usr/local), the
uhd_images_downloader command requires sudo privileges.
Building and installing GNU Radio from source code
First, make a folder to hold the repository.
Cd $home
Cd workarea
Next, clone the repository.
git clone --recursive https://github.com/gnuradio/gnuradio
Next, go into the repository and check out the desired GNU Radio version.
in my case, I installed gnu maint-3.8
git checkout maint-3.8
sudo ldconfig
At this point, GNU Radio should be installed and ready to use. You can quickly test this, with
no USRP device attached, by running the following quick tests.
gnuradio-config-info --version
gnuradio-config-info --prefix
gnuradio-config-info --enabled-components
You can try launching the GNU Radio Companion (GRC) tool, a visual tool for building and
running GNU Radio flowgraphs.
gnuradio-companion
If "gnuradio-companion" does not start and complains about the PYTHONPATH environment
variable, then you may have to set this in your $HOME/.bashrc file, as shown below.
export PYTHONPATH=/usr/local/lib/python3/dist-packages:/usr/local/lib/python3.9/dist-
packages/site-pacakages:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
Configuring USB
On Linux, udev handles USB plug and unplug events. The following commands install a udev
rule so that non-root users may access the device. This step is only necessary for devices that
use USB to connect to the host computer, such as the B200, B210, and B200mini. This setting
should take effect immediately and does not require a reboot or logout/login. Be sure that no
USRP device is connected via USB when running these commands.
cd $HOME/workarea/uhd/host/utils
sudo cp uhd-usrp.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
The installation of UHD and GNU Radio should now be complete. At this point, connect the
USRP to the host computer.
If the interface is Ethernet, then open a terminal window, and try to ping the USRP with "ping
192.168.10.2". The USRP should respond to the ping requests.
If the interface is USB, then open a terminal window, and run "lsusb". You should see the USRP
listed on the USB bus with a VID of 2500 and PID of 0020, 0021, 0022, for B200, B210,
B200mini, respectively.