Getting Startted With GNU Radio and USRP

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Getting started with USRP B205-mini with GNU-Radio

Preliminaries

1. Install virtual box 6.1.26


2. Oracle VM virtual box extension pack 6.1.26 to enable USB2.0 and USB3.0 ports in VM.
3. Install Ubuntu 21.10 64 bit

Steps

Installing Dependencies
Open Ubuntu terminal

Run sudo apt-get update

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

sudo apt install pybind11-dev python3-matplotlib libsndfile1-dev

sudo apt install libiio-dev libad9361-dev libsoapysdr-dev soapysdr-tools

After installing the dependencies, you should reboot the system.

Building and installing UHD from source code


First, make a folder to hold the repository.
cd $HOME
mkdir workarea
cd workarea
Next, clone the repository and change into the cloned directory.
git clone https://github.com/EttusResearch/uhd
cd uhd

now to check the version of UHD, in my case I used UHD v4.1.0.4


git checkout v4.1.0.4

Next, create a build folder within the repository.


Cd host
Mkdir build
Cd build

Now, invoke cmake


Cmake ..

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

-- Boost include directories: /include


-- Boost library directories: /lib/x86_64-linux-gnu

and

CMake Error in lib/CMakeLists.txt:


Imported target "Boost::chrono" includes non-existent path
"/include"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
* The path was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and references files it does not provide.

One of the following 3 options should fix this situation:

1. /usr/bin/cmake ..
2. PATH=/usr/bin:$PATH cmake ..
3. cmake -DCMAKE_FIND_ROOT_PATH=/usr ..

Once the cmake command succeeds without errors, build UHD


Make (should be 100% without errors)

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 make install

Next, update the system's shared library cache.

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

enter this above line in the end of /.bshrc file

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.

linux; GNU C++ version 4.8.4; Boost_105400; UHD_003.010.000.HEAD-0-g6e1ac3fc

No UHD Devices Found

Downloading the UHD FPGA images


You can now download the UHD FPGA Images for this installation. This can be done by
running the command uhd_images_downloader.

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

Next, update the submodules:


git submodule update --init –recursive
Next, create a build folder within the repository, invoke CMake, and build GNU Radio:
mkdir build
cd build
cmake ../ (output should show enabled components of GNU-radio)
make (should be 100% without errors)
Next, you can optionally run some basic tests to verify that the build process completed
properly.

make test (should pass all tests)


Next, install GNU Radio, using the default install prefix, which will install GNU Radio under
the /usr/local/lib folder. You need to run this as root due to the permissions on that folder.

sudo make install


Finally, update the system's shared library cache.

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

Connect the USRP

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.

Also try running "uhd_find_devices" and "uhd_usrp_probe".

You might also like