Difference between revisions of "Software Development on the E3xx USRP - Building RFNoC UHD / GNU Radio / gr-ettus from Source"

From Ettus Knowledge Base
Jump to: navigation, search
(Building rfnoc-devel UHD)
 
Line 11: Line 11:
 
|style="text-align:center;"| Nate Temple
 
|style="text-align:center;"| Nate Temple
 
|style="text-align:center;"| Initial creation
 
|style="text-align:center;"| Initial creation
 +
 +
|-
 +
|style="text-align:center;"| 2019-08-01
 +
|style="text-align:center;"| Nate Temple
 +
|style="text-align:center; display: flex; align-items: center; justify-content: center; border: 0px"| Update instructions for Ubuntu 18.x and mainline UHD
 +
 +
 
|}
 
|}
  
 
==Abstract==
 
==Abstract==
This application note is one of a multi-part series which will cover the software development process on the USRP E310, E312 and E313. It will cover building the rfnoc-devel branch of UHD, GNU Radio and gr-ettus from source for the host machine, and cross-compiling the rfnoc-devel branch of UHD, GNU Radio and gr-ettus for the E3xx USRP.
+
This application note is one of a multi-part series which will cover the software development process on the USRP E310, E312 and E313. It will cover building UHD, GNU Radio and gr-ettus from source for the host machine, and cross-compiling UHD, GNU Radio and gr-ettus for the E3xx USRP with RFNoC enabled. It will then cover building a custom RFNoC FPGA image and running an example application RFNoC Fosphor.
  
 
==Overview==
 
==Overview==
  
Note: Linux only. The application note has been tested using Ubuntu 16.04.3.  
+
Note: Linux only. This application note has been tested using Ubuntu 18.04.
  
This application note has three sections:
+
Note: This application note is used with the <code>release-4</code> E31x file system.
  
1. Building rfnoc-devel UHD / GNU Radio / gr-ettus for the Host machine
+
This application note has four sections:
  
2. Cross-compiling rfnoc-devel UHD / GNU Radio / gr-ettus for the E3xx USRP
+
1. Building UHD / GNU Radio / gr-ettus for the Host machine
  
3. Running an example application, RFNoC Fosphor
+
2. Cross-compiling UHD / GNU Radio / gr-ettus for the E3xx USRP
  
 +
3. Building a custom RFNoC FPGA image
  
 +
4. Running an example application, RFNoC Fosphor
  
  
= Installing rfnoc-devel UHD / GNU Radio / gr-ettus on the Host =
+
 
 +
= Installing UHD / GNU Radio / gr-ettus on the Host =
 
This step is required in order to run the RFNoC Fosphor example. It is possible to operate the E3xx USRP with a RFNoC flowgraph without connecting it to a host machine. All of the processing is performed on the E3xx FPGA, the host is only used to display the FFT/Waterfall.
 
This step is required in order to run the RFNoC Fosphor example. It is possible to operate the E3xx USRP with a RFNoC flowgraph without connecting it to a host machine. All of the processing is performed on the E3xx FPGA, the host is only used to display the FFT/Waterfall.
  
 
A more detailed guide to installing UHD / GNU Radio on Linux can be found at the following application note, which can be helpful for reference. https://kb.ettus.com/Building_and_Installing_the_USRP_Open-Source_Toolchain_(UHD_and_GNU_Radio)_on_Linux
 
A more detailed guide to installing UHD / GNU Radio on Linux can be found at the following application note, which can be helpful for reference. https://kb.ettus.com/Building_and_Installing_the_USRP_Open-Source_Toolchain_(UHD_and_GNU_Radio)_on_Linux
  
This application note is using a vanilla Ubuntu 16.04.3 installation for the host operating system. If you are using another operating system, please refer to the above application note for specifics on dependency requirements. If you already have UHD and GNU Radio installed, you should first remove them before proceeding with this application note.  
+
This application note is using a vanilla Ubuntu 18.04 installation for the host operating system. If you are using another operating system, please refer to the above application note for specifics on dependency requirements. If you already have UHD and GNU Radio installed, you should first remove them before proceeding with this application note.  
  
 
==System Update==
 
==System Update==
  
     $ sudo apt-get update
+
     $ sudo apt update
     $ sudo apt-get upgrade
+
     $ sudo apt upgrade
  
 
== Reconfigure Default Shell ==
 
== Reconfigure Default Shell ==
Line 58: Line 68:
 
==Install Dependencies==  
 
==Install Dependencies==  
  
     $ sudo apt-get -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.13-0v5 libcppunit-dev libcppunit-doc ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-qt4-doc libqwt6abi1 libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-dev libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk3.0 git-core libqt4-dev python-numpy ccache python-opengl libgsl-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-1.0-0-dev libqwt5-qt4-dev libqwtplot3d-qt4-dev pyqt4-dev-tools python-qwt5-qt4 cmake git-core wget libxi-dev gtk2-engines-pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq-dev libzmq1 python-requests python-sphinx libcomedi-dev python-zmq  
+
     $ sudo apt -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.14-0 libcppunit-dev libcppunit-doc ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-qt4-doc libqwt6abi1 libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-dev libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk3.0 git libqt4-dev python-numpy ccache python-opengl libgsl-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-1.0-0-dev libqwtplot3d-qt5-dev pyqt4-dev-tools python-qwt5-qt4 cmake git wget libxi-dev gtk2-engines-pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq3-dev libzmq5 python-requests python-sphinx libcomedi-dev python-zmq libqwt-dev libqwt6abi1 python-six libgps-dev libgps23 gpsd gpsd-clients python-gps python-setuptools python3-pyqt5 dnsmasq sshfs
  
 
== Create Working Directory ==
 
== Create Working Directory ==
This location will be used for building UHD / GNU Radio / gr-ettus for the Host installation.
+
These folders will be used as a work area for cloning the sources and building.  
  
 
     $ mkdir -p ~/rfnoc
 
     $ mkdir -p ~/rfnoc
     $ cd ~/rfnoc
+
     $ mkdir -p ~/rfnoc/src
 +
    $ mkdir -p ~/rfnoc/oe
 +
    $ mkdir -p ~/rfnoc/e300
 +
 
 +
== Building UHD ==
  
== Building rfnoc-devel UHD ==
+
    $ cd ~/rfnoc/src   
   
+
     $ git clone --recursive <nowiki>https://github.com/EttusResearch/uhd</nowiki>
     $ git clone <nowiki>https://github.com/EttusResearch/uhd</nowiki>
+
 
     $ cd uhd
 
     $ cd uhd
     $ git checkout rfnoc-devel
+
     $ git checkout v3.14.1.0
 +
    $ git submodule update
 
     $ cd host
 
     $ cd host
     $ mkdir build
+
     $ mkdir build-host
     $ cd build
+
     $ cd build-host
     $ cmake -DENABLE_E300=ON ..
+
     $ cmake -DENABLE_E300=ON -DENABLE_GPSD=ON -DENABLE_RFNOC=ON ..
 
     $ make -j4
 
     $ make -j4
 
     $ sudo make install
 
     $ sudo make install
Line 85: Line 99:
 
== Building GNU Radio ==
 
== Building GNU Radio ==
  
     $ cd ~/rfnoc
+
     $ cd ~/rfnoc/src
 
     $ git clone --recursive <nowiki>https://github.com/gnuradio/gnuradio</nowiki>
 
     $ git clone --recursive <nowiki>https://github.com/gnuradio/gnuradio</nowiki>
 
     $ cd gnuradio/
 
     $ cd gnuradio/
     $ git checkout v3.7.10.2
+
     $ git checkout maint-3.7
     $ mkdir build
+
    $ git submodule update
     $ cd build
+
     $ mkdir build-host
 +
     $ cd build-host
 
     $ cmake ..
 
     $ cmake ..
 
     $ make -j4
 
     $ make -j4
Line 98: Line 113:
 
== Building gr-ettus ==
 
== Building gr-ettus ==
  
     $ cd ~/rfnoc
+
     $ cd ~/rfnoc/src
 
     $ git clone <nowiki>https://github.com/EttusResearch/gr-ettus.git</nowiki>
 
     $ git clone <nowiki>https://github.com/EttusResearch/gr-ettus.git</nowiki>
 
     $ cd gr-ettus
 
     $ cd gr-ettus
     $ mkdir build
+
     $ mkdir build-host
     $ cd build
+
     $ cd build-host
 
     $ cmake ..
 
     $ cmake ..
 
     $ make -j4
 
     $ make -j4
Line 109: Line 124:
  
 
== Verify Installation ==
 
== Verify Installation ==
Run the following command to verify the <code>rfnoc-devel</code> branch of UHD was installed properly.
+
Run the following command to verify UHD was installed properly.
  
 
     $ uhd_usrp_probe --version
 
     $ uhd_usrp_probe --version
Line 115: Line 130:
 
Expected Output:
 
Expected Output:
  
     4.0.0.rfnoc-devel-xxx-xxxxxxxxx
+
     3.14.1.HEAD-0-gbfb9c1c7
  
= Cross-Compiling rfnoc-devel UHD / GNU Radio / gr-ettus for the E3xx USRP =
+
Run the following command to verify GNU Radio was installed properly.
  
== Working Directory ==
+
    $ gnuradio-config-info --version
Make a working directory on host computer for the cross-compiling sources. This is where we will clone, download, cross-compile and install all files.
+
  
    $ mkdir -p ~/e300
+
Expected Output:
  
Make a <code>src/</code> directory within the working directory.  
+
    3.7.13.5
  
    $ mkdir -p ~/e300/src
+
= Cross-Compiling UHD / GNU Radio / gr-ettus for the E3xx USRP =
  
 
== SDK Setup ==
 
== SDK Setup ==
Download the OE SDK for the E31x release into the <code>src/</code> directory:  
+
Download the OE SDK for the E31x release into the <code>~/rfnoc/src/</code> directory:  
  
     $ cd ~/e300/src
+
     $ cd ~/rfnoc/src
 
     $ wget http://files.ettus.com/e3xx_images/e3xx-release-4/oecore-x86_64-armv7ahf-vfp-neon-toolchain-nodistro.0.sh
 
     $ wget http://files.ettus.com/e3xx_images/e3xx-release-4/oecore-x86_64-armv7ahf-vfp-neon-toolchain-nodistro.0.sh
  
Next, install the SDK to the <code>~/e300</code> directory. Enter <code>~/e300</code> for the installation directory when prompted.
+
Next, install the SDK to the <code>~/rfnoc/oe</code> directory. Enter <code>~/rfnoc/oe</code> for the installation directory when prompted.
  
 
     $ bash oecore-x86_64-armv7ahf-vfp-neon-toolchain-nodistro.0.sh  
 
     $ bash oecore-x86_64-armv7ahf-vfp-neon-toolchain-nodistro.0.sh  
Line 141: Line 155:
  
 
<pre>
 
<pre>
Enter target directory for SDK (default: /usr/local/oecore-x86_64): ~/e300
+
Enter target directory for SDK (default: /usr/local/oecore-x86_64): ~/rfnoc/oe
You are about to install the SDK to "/home/user/e300". Proceed[Y/n]?y
+
You are about to install the SDK to "/home/user/rfnoc/oe". Proceed[Y/n]?y
 
Extracting SDK...done
 
Extracting SDK...done
 
Setting it up...done
 
Setting it up...done
Line 148: Line 162:
 
</pre>
 
</pre>
  
Your <code>~/e300</code> directory should have a structure such as below:
+
Your <code>~/rfnoc/oe</code> directory should have a structure such as below:
  
     $ ls ~/e300
+
     $ ls ~/rfnoc/oe
     environment-setup-armv7ahf-vfp-neon-oe-linux-gnueabi src       version-armv7ahf-vfp-neon-oe-linux-gnueabi
+
     environment-setup-armv7ahf-vfp-neon-oe-linux-gnueabi       
     site-config-armv7ahf-vfp-neon-oe-linux-gnueabi        sysroots
+
    version-armv7ahf-vfp-neon-oe-linux-gnueabi
 +
     site-config-armv7ahf-vfp-neon-oe-linux-gnueabi         
 +
    sysroots
  
Source the environment setup file:
+
Source the OE SDK environment setup file:
  
     $ cd ~/e300
+
     $ cd ~/rfnoc/oe
 
     $ source ./environment-setup-armv7ahf-vfp-neon-oe-linux-gnueabi  
 
     $ source ./environment-setup-armv7ahf-vfp-neon-oe-linux-gnueabi  
  
Line 165: Line 181:
 
Expected Output:
 
Expected Output:
  
     arm-oe-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon --sysroot=/home/user/e300/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi
+
     arm-oe-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon --sysroot=/home/user/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi
  
* Note: If you open a new terminal at any point, you will need to re-run the source command above to initialize the environment. The compiling environment setup is only needed for terminals that are cross-compiling the sources. The terminals used later in this application note which are using SSH to connect to other devices do not need to have the compiling environment initialized.  
+
* Note: If you open a new terminal at any point, you will need to re-run the source command above to initialize the environment. The compiling environment setup is only needed for terminals that are cross-compiling the sources for the E31x. The terminals used later in this application note which are using SSH to connect to other devices do not need to have the compiling environment initialized.  
  
== Cross-Compiling rfnoc-devel UHD ==
+
== Cross-Compiling UHD ==
Next, download the <code>rfnoc-devel</code> branch of UHD, v3.7.10.2 GNU Radio, and master branch of gr-ettus:
+
  
     $ cd ~/e300/src
+
     $ cd ~/rfnoc/src/uhd/host
    $ git clone -b rfnoc-devel <nowiki>https://github.com/EttusResearch/uhd.git</nowiki>
+
     $ mkdir build-arm
   
+
     $ cd build-arm
Next, we will cross-compile the <code>rfnoc-devel</code> branch of UHD.
+
     $ cmake -DCMAKE_TOOLCHAIN_FILE=../host/cmake/Toolchains/oe-sdk_cross.cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_E300=ON -DENABLE_GPSD=ON -DENABLE_RFNOC=ON ..
 
+
    $ cd uhd/host
+
     $ mkdir build  
+
     $ cd build
+
     $ cmake -DCMAKE_TOOLCHAIN_FILE=../host/cmake/Toolchains/oe-sdk_cross.cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_E300=ON ..
+
 
     $ make -j4
 
     $ make -j4
     $ make install DESTDIR=~/e300
+
     $ make install DESTDIR=~/rfnoc/e300
     $ make install DESTDIR=~/e300/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/
+
     $ make install DESTDIR=~/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/
 
+
  
 +
== Create Environment Setup File ==
 
Next, we will create an environment setup file that will set the correct system variables to point to our new installation when ran on the E31x.
 
Next, we will create an environment setup file that will set the correct system variables to point to our new installation when ran on the E31x.
  
     $ cd ~/e300
+
     $ cd ~/rfnoc/e300
     $ touch setup_env.sh
+
     $ touch setup.env
     $ nano setup_env.sh
+
     $ nano setup.env
  
Add the following lines to <code>setup_env.sh</code>:
+
Add the following lines to <code>setup.env</code>:
  
 
<pre>
 
<pre>
Line 206: Line 216:
 
</pre>
 
</pre>
  
 +
== Copy default FPGA images ==
  
Next, we will need to SSH into the E31x and will mount the <code>~/e300</code> folder using SSHFS in order to test our new installation.
+
    $ mkdir -p ~/rfnoc/e300/usr/share/uhd/images
 +
    $ cd ~/rfnoc/e300/usr/share/uhd/images
 +
    $ cp -Rv /usr/local/share/uhd/images/usrp_e310_fpga* .
 +
    $ cp -Rv /usr/local/share/uhd/images/usrp_e3xx_fpga_idle* .
  
* Note: This tutorial assumes you're using the default IP address of <code>192.168.10.2</code> for your E31x device, and that your host has the IP address of <code>192.168.10.1</code>. If you're using different IP addresses, the commands below will need to be updated to reflect the correct IPs.
+
 
 +
== Mount and test the UHD build ==
 +
 
 +
Next, we will mount the <code>~/rfnoc/e300</code> folder using SSHFS in order to test our new installation.
 +
 
 +
* Note: This application note assumes you're using a static IP address of <code>192.168.10.2</code> for your E31x device, and that your host has the IP address of <code>192.168.10.1</code>. If you're using different IP addresses, the commands below will need to be updated to reflect the correct IPs.
  
 
Open a new terminal and verify that you can ping the E31x:
 
Open a new terminal and verify that you can ping the E31x:
Line 225: Line 244:
 
     $ sudo apt-get install openssh-server
 
     $ sudo apt-get install openssh-server
  
Returning to the terminal which you're connected to the E31x via SSH, mount the <code>~/e300</code> folder onto the E31x.
+
Returning to the terminal which you're connected to the E31x via SSH, mount the <code>~/rfnoc/e300</code> folder onto the E31x.
  
 
First create a directory to mount the remote folder to with (running these commands on the E31x):
 
First create a directory to mount the remote folder to with (running these commands on the E31x):
  
     $ mkdir -p ~/newinstall
+
     # mkdir -p ~/newinstall
     $ sshfs username@192.168.10.1:e300 newinstall/
+
     # sshfs username@192.168.10.1:/home/user/rfnoc/e300 newinstall/
  
 
* Note: The "username" in the above command needs to be updated to reflect your user on the host machine.
 
* Note: The "username" in the above command needs to be updated to reflect your user on the host machine.
Line 236: Line 255:
 
When prompted, enter the password of your user to complete the mounting of the remote file system.
 
When prompted, enter the password of your user to complete the mounting of the remote file system.
  
Verify the mount was successful, your directory structure should match <code>~/e300</code> on the host machine.
+
Verify the mount was successful, your directory structure should match <code>~/rfnoc/e300</code> on the host machine.
  
 
     $ ls ~/newinstall/
 
     $ ls ~/newinstall/
 +
  
 
Expected output:
 
Expected output:
 
<pre>
 
<pre>
environment-setup-armv7ahf-vfp-neon-oe-linux-gnueabi
 
 
setup_env.sh
 
setup_env.sh
site-config-armv7ahf-vfp-neon-oe-linux-gnueabi
 
src
 
sysroots
 
 
usr
 
usr
version-armv7ahf-vfp-neon-oe-linux-gnueabi
 
 
</pre>
 
</pre>
  
 
Next, we will need to setup the system environment on the E31x to use the newly compiled version of UHD.
 
Next, we will need to setup the system environment on the E31x to use the newly compiled version of UHD.
  
We will first verify that the E31x is using the existing UHD installation, using the <code>which</code> command:
+
Verify that the E31x is using the existing UHD installation, using the <code>which</code> command:
  
     $ which uhd_usrp_probe
+
     # which uhd_usrp_probe
  
 
Expected output:
 
Expected output:
Line 261: Line 276:
 
     /usr/bin/uhd_usrp_probe
 
     /usr/bin/uhd_usrp_probe
  
Next, source the setup_env.sh file:
+
Next, source the <code>setup.env<code> file:
  
     $ cd ~/newinstall
+
     # cd ~/newinstall
     $ source ./setup_env.sh
+
     # source ./setup.env
  
Now we will verify that the newly compiled UHD is being used, again using the <code>which</code> command:
+
Verify that the newly compiled UHD is being used, again using the <code>which</code> command:
  
     $ which uhd_usrp_probe
+
     # which uhd_usrp_probe
  
 
Expected output:
 
Expected output:
Line 274: Line 289:
 
     /home/root/newinstall/usr/bin/uhd_usrp_probe
 
     /home/root/newinstall/usr/bin/uhd_usrp_probe
  
Next, we must download the correct FPGA images for the new installation. Run the utility <code>uhd_images_downloader</code>, since the E3xx is not connected to the internet, this will throw an error:
+
Next, run <code>uhd_usrp_probe</code>:
  
     $ uhd_images_downloader
+
     # uhd_usrp_probe
  
Expected output:
+
Expect output:
 
+
    UHD_IMAGES_DIR environment variable is set.
+
    Default install location: /home/root/newinstall/usr/share/uhd/images
+
    Images destination:      /home/root/newinstall/usr/share/uhd/images
+
    Downloading images from: '''<nowiki>http://files.ettus.com/binaries/images/uhd-images_4.0.0.rfnoc-devel-xxx-xxxxxxxxx.zip</nowiki>'''
+
    Downloading images to:  /tmp/tmpS1uIFt/4.0.0.rfnoc-devel-xxx-xxxxxxxxx.zip
+
    Downloader raised an unhandled exception: ('Connection aborted.', gaierror(-2, 'Name or service not known'))
+
    You can run this again with the '--verbose' flag to see more information
+
    If the problem persists, please email the output to: support@ettus.com
+
 
+
Note the URL to the FPGA images package which is trying to access. Copy this URL and return to a terminal that is on your host machine and download it into the <code>~/e300/src</code> folder.
+
 
+
On the host machine run:
+
 
+
    $ cd ~/e300/src
+
    $ wget http://files.ettus.com/binaries/images/uhd-images_4.0.0.rfnoc-devel-xxx-xxxxxxxxx.zip
+
 
+
* Note, This FPGA image package will vary depending upon the current version of UHD you are using. You must use the URL that is shown in the above output when trying to run <code>uhd_images_downloader</code>.
+
 
+
 
+
Next, decompress this file:
+
 
+
    $ unzip uhd-images_4.0.0.rfnoc-devel-xxx-xxxxxxxxx.zip
+
 
+
Note, the URL/paths may be slightly different than what is shown above due to different versions, however the process is the same.
+
 
+
Next we must create the folder for the FPGA images.
+
 
+
Navigate to the folder on your host machine:
+
 
+
    $ mkdir -p ~/e300/usr/share/uhd/images
+
    $ cd ~/e300/usr/share/uhd/images
+
 
+
Verify your directory with the pwd command:
+
 
+
    $ pwd
+
 
+
Expected output:
+
 
+
    /home/user/e300/usr/share/uhd/images
+
 
+
Now, copy the FPGA images from the decompressed FPGA ZIP package:
+
 
+
    $ cp -R ~/e300/src/uhd-images_4.0.0.rfnoc-devel-xxx-xxxxxxxxx/share/uhd/images/* .
+
 
+
Verify the copy was successful:
+
 
+
    $ ls
+
 
+
Expected Output:
+
 
<pre>
 
<pre>
$ ls
 
4.0.0.rfnoc-devel.tag    usrp_b200_fpga.bin            usrp_n200_fw.bin                usrp_x300_fpga_RFNOC_XG.bit
 
bit                      usrp_b200_fw.hex              usrp_n200_r2_fpga.bin          usrp_x300_fpga_RFNOC_XG.lvbitx
 
LICENSE                  usrp_b200mini_fpga.bin        usrp_n200_r3_fpga.bin          usrp_x300_fpga_XG.bit
 
octoclock_bootloader.hex  usrp_b205mini_fpga.bin        usrp_n200_r4_fpga.bin          usrp_x300_fpga_XG.lvbitx
 
octoclock_r4_fw.hex      usrp_b210_fpga.bin            usrp_n210_fw.bin                usrp_x310_fpga_HG.bit
 
usrp1_fpga_4rx.rbf        usrp_e100_fpga_v2.bin        usrp_n210_r2_fpga.bin          usrp_x310_fpga_HG.lvbitx
 
usrp1_fpga.rbf            usrp_e110_fpga.bin            usrp_n210_r3_fpga.bin          usrp_x310_fpga_RFNOC_HG.bit
 
usrp1_fw.ihx              usrp_e310_fpga.bit            usrp_n210_r4_fpga.bin          usrp_x310_fpga_RFNOC_HG.lvbitx
 
usrp2_fpga.bin            usrp_e310_fpga_RFNOC.bit      usrp_n230_fpga.bit              usrp_x310_fpga_RFNOC_XG.bit
 
usrp2_fw.bin              usrp_e310_fpga_RFNOC_sg3.bit  usrp_x300_fpga_HG.bit          usrp_x310_fpga_RFNOC_XG.lvbitx
 
usrp_b100_fpga_2rx.bin    usrp_e310_fpga_sg3.bit        usrp_x300_fpga_HG.lvbitx        usrp_x310_fpga_XG.bit
 
usrp_b100_fpga.bin        usrp_e3xx_fpga_idle.bit      usrp_x300_fpga_RFNOC_HG.bit    usrp_x310_fpga_XG.lvbitx
 
usrp_b100_fw.ihx          usrp_e3xx_fpga_idle_sg3.bit  usrp_x300_fpga_RFNOC_HG.lvbitx  winusb_driver
 
</pre>
 
  
Next, in order to save space on the E31x when we transfer this build to the E31x, delete all non-E31x FPGA images.
+
# uhd_usrp_probe  
 
+
[INFO] [UHD] linux; GNU C++ version 4.9.2; Boost_105700; UHD_3.14.1.HEAD-0-gbfb9c1c7
    $ rm -v usrp1_f*
+
    $ rm -v usrp2_f*
+
    $ rm -v usrp_b*
+
    $ rm -v usrp_n2*
+
    $ rm -v usrp_x3*
+
    $ rm -v usrp_e1*
+
    $ rm -v octoclock_*
+
    $ rm -vrf winusb_driver/
+
    $ rm -vrf bit/
+
 
+
Verify the folder structure:
+
 
+
    $ ls
+
 
+
Expected Output:
+
<pre>
+
4.0.0.rfnoc-devel.tag  usrp_e310_fpga.bit        usrp_e310_fpga_RFNOC_sg3.bit  usrp_e3xx_fpga_idle.bit
+
LICENSE                usrp_e310_fpga_RFNOC.bit  usrp_e310_fpga_sg3.bit        usrp_e3xx_fpga_idle_sg3.bit
+
</pre>
+
 
+
Next, return to the terminal which is connected via SSH to the E31x and run <code>uhd_usrp_probe</code>:
+
 
+
    $ uhd_usrp_probe
+
 
+
Expect output:
+
<pre>
+
[INFO] [UHDlinux; GNU C++ version 4.9.2; Boost_105700; UHD_4.0.0.rfnoc-devel-xxx-xxxxxxxxx]
+
 
[INFO] [E300] Loading FPGA image: /home/root/newinstall/usr/share/uhd/images/usrp_e310_fpga_sg3.bit...
 
[INFO] [E300] Loading FPGA image: /home/root/newinstall/usr/share/uhd/images/usrp_e310_fpga_sg3.bit...
 
[INFO] [E300] FPGA image loaded
 
[INFO] [E300] FPGA image loaded
 +
[INFO] [E300] Detecting internal GPS....
 +
[INFO] [E300] GPSDO found
 
[INFO] [E300] Initializing core control (global registers)...
 
[INFO] [E300] Initializing core control (global registers)...
 
 
[INFO] [E300] Performing register loopback test...  
 
[INFO] [E300] Performing register loopback test...  
 
[INFO] [E300] Register loopback test passed
 
[INFO] [E300] Register loopback test passed
[INFO] [RFNOC RADIO] Register loopback test passed
+
[INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000000000)
[INFO] [RFNOC RADIO] Register loopback test passed
+
[INFO] [0/DDC_0] Initializing block control (NOC ID: 0xDDC0000000000000)
[WARNING] [RFNOC] [0/fosphor_0] defines 2 input buffer sizes, but 1 input ports
+
[INFO] [0/DUC_0] Initializing block control (NOC ID: 0xD0C0000000000002)
[INFO] [AD936X] Performing CODEC loopback test...
+
[INFO] [AD936X] CODEC loopback test passed
+
[INFO] [AD936X] Performing CODEC loopback test...
+
[INFO] [AD936X] CODEC loopback test passed
+
[INFO] [CORES] Performing timer loopback test...
+
[INFO] [CORES] Timer loopback test passed
+
 
   _____________________________________________________
 
   _____________________________________________________
 
  /
 
  /
Line 395: Line 313:
 
|    _____________________________________________________
 
|    _____________________________________________________
 
|    /
 
|    /
|  |      Mboard: E3XX
+
|  |      Mboard: E3XX SG3
 
|  |  product: 30675
 
|  |  product: 30675
 
|  |  revision: 6
 
|  |  revision: 6
 
|  |  serial: xxxxxxx
 
|  |  serial: xxxxxxx
|  |  mac-addr: 00:00:00:00:00:00
+
|  |  mac-addr: 00:80:2f:25:82:bb
 
|  |  FPGA Version: 255.0
 
|  |  FPGA Version: 255.0
|  |  FPGA git hash: f764326-dirty
+
|  |  FPGA git hash: e39334f
 
|  |  RFNoC capable: Yes
 
|  |  RFNoC capable: Yes
 
|  |   
 
|  |   
|  |  Time sources:  none, internal, external
+
|  |  Time sources:  none, internal, external, gpsdo
 
|  |  Clock sources: internal
 
|  |  Clock sources: internal
|  |  Sensors: temp, ref_locked
+
|  |  Sensors: temp, ref_locked, gps_locked, gps_time, gps_position, gps_gpgga, gps_gprmc
 
|  |    _____________________________________________________
 
|  |    _____________________________________________________
 
|  |    /
 
|  |    /
Line 421: Line 339:
 
|  |  |      RX Dboard: A
 
|  |  |      RX Dboard: A
 
|  |  |  ID: E310 MIMO XCVR (0x0110)
 
|  |  |  ID: E310 MIMO XCVR (0x0110)
|  |  |  Serial: xxxxxx
+
|  |  |  Serial: xxxxxxx
 
|  |  |    _____________________________________________________
 
|  |  |    _____________________________________________________
 
|  |  |    /
 
|  |  |    /
Line 463: Line 381:
 
|  |  |      TX Dboard: A
 
|  |  |      TX Dboard: A
 
|  |  |  ID: E310 MIMO XCVR (0x0110)
 
|  |  |  ID: E310 MIMO XCVR (0x0110)
|  |  |  Serial: xxxxxx
+
|  |  |  Serial: xxxxxxxx
 
|  |  |    _____________________________________________________
 
|  |  |    _____________________________________________________
 
|  |  |    /
 
|  |  |    /
Line 496: Line 414:
 
|  |  |   
 
|  |  |   
 
|  |  |  * Radio_0
 
|  |  |  * Radio_0
|  |  |  * FIFO_0
+
|  |  |  * DDC_0
|  |  |  * Window_0
+
|  |  |  * DUC_0
|  |  |  * FFT_0
+
 
|  |  |  * fosphor_0
+
[INFO] [E300] Loading FPGA image: /home/root/newinstall/usr/share/uhd/images/usrp_e3xx_fpga_idle_sg3.bit...
|  |  |  * FIFO_1
+
[INFO] [E300] FPGA image loaded
|  |  |  * FIR_0
+
 
  
 
</pre>
 
</pre>
Line 507: Line 425:
 
At this point, it's possible to run the included UHD example programs with the newly compiled UHD.
 
At this point, it's possible to run the included UHD example programs with the newly compiled UHD.
  
     $ cd ~/newinstall/usr/lib/uhd/examples/
+
     # cd ~/newinstall/usr/lib/uhd/examples/
     $ ./rx_samples_to_file --freq 100e6 --gain 0 --ant TX/RX --rate 1e6 --null
+
     # ./rx_samples_to_file --freq 100e6 --gain 0 --ant TX/RX --rate 1e6 --duration 10 --null
  
 +
== Install python-six dependency to the OE SDK ==
 +
GNU Radio versions that are newer than 3.7.10.2 require <code>python-six</code>, which is not included within the <code>release-4</code> SDK. In this step <code>python-six</code> will be installed into the OE sysroot.
  
Press <code>CTRL+C</code> to exit the program.
+
Return to the terminal which is being used to cross-compile, or open a new terminal and source the OE SDK environemnt setup file before proceeding.
 +
 
 +
    $ cd ~/rfnoc/src
 +
    $ wget <nowiki>https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/six-1.11.0.tar.gz</nowiki>
 +
    $ tar -zxvf six-1.11.0.tar.gz
 +
    $ cd six-1.11.0
 +
    $ python setup.py install --prefix=~/rfnoc/oe/sysroots/x86_64-oesdk-linux/usr
  
 
== Cross-Compiling GNU Radio ==
 
== Cross-Compiling GNU Radio ==
On the host computer, navigate to the <code>~/e300/src</code> directory, clone and cross-compile GNU Radio:
+
Next, clone and cross-compile GNU Radio for the E31x. On the host machine:
  
     $ cd ~/e300/src
+
     $ cd ~/rfnoc/src/gnuradio
    $ git clone -b v3.7.10.2 --recursive <nowiki>https://github.com/gnuradio/gnuradio.git</nowiki>
+
     $ mkdir build-arm
    $ cd gnuradio/
+
     $ cd build-arm
     $ mkdir build
+
     $ cmake -Wno-dev -DCMAKE_TOOLCHAIN_FILE=~/rfnoc/src/gnuradio/cmake/Toolchains/oe-sdk_cross.cmake -DENABLE_GR_WXGUI=OFF -DENABLE_GR_VOCODER=OFF -DENABLE_GR_DTV=OFF -DENABLE_GR_ATSC=OFF -DENABLE_DOXYGEN=OFF -DCMAKE_INSTALL_PREFIX=/usr ../
     $ cd build
+
     $ cmake -Wno-dev -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/oe-sdk_cross.cmake -DENABLE_GR_WXGUI=OFF -DENABLE_GR_VOCODER=OFF -DENABLE_GR_DTV=OFF -DENABLE_GR_ATSC=OFF -DENABLE_DOXYGEN=OFF -DCMAKE_INSTALL_PREFIX=/usr ../
+
 
     $ make -j4
 
     $ make -j4
     $ make install DESTDIR=~/e300/
+
     $ make install DESTDIR=~/rfnoc/e300/
     $ make install DESTDIR=~/e300/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/
+
     $ make install DESTDIR=~/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/
  
 
Next, verify your GNU Radio installation was successful. On the E31x terminal, run the command:
 
Next, verify your GNU Radio installation was successful. On the E31x terminal, run the command:
Line 532: Line 456:
 
Expected output:
 
Expected output:
  
     3.7.10.2
+
     3.7.13.5
  
 
== Cross-Compiling gr-ettus ==
 
== Cross-Compiling gr-ettus ==
Next, we will clone and cross-compile <code>gr-ettus</code>. On the host machine, navigate to <code>~/e300/src</code>:
+
Next, clone and cross-compile <code>gr-ettus</code>. On the host machine:
  
     $ cd ~/e300/src
+
     $ cd ~/rfnoc/src/gr-ettus
    $ git clone -b master <nowiki>https://github.com/EttusResearch/gr-ettus.git</nowiki>
+
     $ mkdir build-arm
    $ cd gr-ettus/
+
     $ cd build-arm
     $ mkdir build
+
     $ cmake -DCMAKE_TOOLCHAIN_FILE=~/rfnoc/src/gnuradio/cmake/Toolchains/oe-sdk_cross.cmake -DCMAKE_INSTALL_PREFIX=/usr ..
     $ cd build
+
     $ cmake -DCMAKE_TOOLCHAIN_FILE=~/e300/src/gnuradio/cmake/Toolchains/oe-sdk_cross.cmake -DCMAKE_INSTALL_PREFIX=/usr ..
+
 
     $ make -j4
 
     $ make -j4
     $ make install DESTDIR=~/e300/
+
     $ make install DESTDIR=~/rfnoc/e300/
     $ make install DESTDIR=~/e300/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/
+
     $ make install DESTDIR=~/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/
  
At this point you should have a fully functional UHD RFNoC, GNU Radio and gr-ettus installation. However being that the compiled sources are not located on the E31x we will need to transfer the files to the E31x.
+
At this point you should have a fully functional UHD RFNoC, GNU Radio and gr-ettus installation. However being that the compiled sources are not located on the E31x (and only temporarily mounted via SSHFS) they will need to copied to the E31x's file system.
  
On the host machine navigate to your home directory:
+
On the E31x navigate to your home directory and create a folder, <code>localinstall</code>
  
Next, create a folder on the E31x, <code>localinstall</code>
+
    # mkdir -p ~/localinstall
  
    $ mkdir -p ~/localinstall
+
Next, copy the <code>etc/</code>, <code>setup.env</code> and <code>usr/</code> folder from the remotely mounted folder:
  
Next, copy the <code>etc/</code>, <code>setup_env.sh</code> and <code>usr/</code> folder to this new local folder:
+
    # cd ~/localinstall
  
     $ cd ~/localinstall
+
     # cp -v ~/newinstall/setup.env .
 
+
     # cp -Rv ~/newinstall/etc .
    $ cp -Rv ~/newinstall/setup_env.sh .
+
     # cp -Rv ~/newinstall/usr .
     $ cp -Rv ~/newinstall/etc .
+
     $ cp -Rv ~/newinstall/usr .
+
  
 
Verify the folder contents:
 
Verify the folder contents:
  
     $ ls ~/localinstall
+
     # ls ~/localinstall
  
 
Expected Output:
 
Expected Output:
Line 575: Line 495:
 
</pre>
 
</pre>
  
Next, we will need to update the <code>setup_env.sh</code> file that is located within the <code>~/localinstall/</code> folder.
+
Next, we will need to update the <code>setup.env</code> file that is located within the <code>~/localinstall/</code> folder.
  
 
Verify your directory location with the <code>pwd</code> command:
 
Verify your directory location with the <code>pwd</code> command:
Line 585: Line 505:
 
     /home/root/localinstall
 
     /home/root/localinstall
  
Edit the <code>setup_env.sh</code> file to update the <code>PATH</code> variable to point to your new installation location (<code>/home/root/localinstall</code>):
+
Edit the <code>setup.env</code> file to update the <code>PATH</code> variable to point to your new installation location (<code>/home/root/localinstall</code>):
  
     $ sed -i 's/newinstall/localinstall/g' setup_env.sh
+
     $ sed -i 's/newinstall/localinstall/g' setup.env
  
 
Verify your edit was successful with the command <code>cat</code>:
 
Verify your edit was successful with the command <code>cat</code>:
  
     $ cat setup_env.sh
+
     $ cat setup.env
  
 
Expected Output:
 
Expected Output:
Line 609: Line 529:
 
Note, the <code>LOCALPREFIX</code> variable has been updated to the new location.
 
Note, the <code>LOCALPREFIX</code> variable has been updated to the new location.
  
This <code>setup_env.sh</code> file needs to be source in order to utilize the new <code>~/localinstall</code> location.
+
This <code>setup.env</code> file needs to be source in order to utilize the new <code>~/localinstall</code> location.
  
     $ source ./setup_env.sh
+
     $ source ./setup.env
  
 
Verify that the environment is setup correctly:
 
Verify that the environment is setup correctly:
Line 621: Line 541:
 
     /home/root/localinstall/usr/bin/uhd_usrp_probe
 
     /home/root/localinstall/usr/bin/uhd_usrp_probe
  
We can now dismount the remotely connected SSHFS folder. On the E31x, run the command:
+
We can now dismount the remotely connected SSHFS folder. On the E31x, run the commands:
 +
 
 +
    # cd ~/
 +
    # umount ~/newinstall
 +
    # rm -rf ~/newinstall
 +
 
 +
 
 +
= Building a custom RFNoC FPGA Image =
 +
The default FPGA image shipped with UHD releases only contains the <code>Radio</code>, <code>DDC</code>, and <code>DUC</code> blocks. In order to explore the additional RFNoC blocks, a custom FPGA image will need to be built.
 +
 
 +
To build a FPGA image for the USRP E31x, the Xilinx Vivado toolchain must be installed. A future application note will cover a step-by-step install guide for Vivado. The E31x FPGA is a Zynq 7020 and can be built using the free Vivado WebPACK tools. Vivado System and Design Edition will also work.
 +
 
 +
Note: UHD 3.14.x.x requires Vivado 2017.4.
 +
 
 +
UHD provides several tools for building FPGA images. The step below assume you have a working installation of Xilinx Vivado WebPACK.
 +
 
 +
The first step is to source the environment setup file for the Vivado toolchain.
 +
 
 +
In a new terminal, run:
 +
 
 +
    $ source ~/rfnoc/src/uhd/fpga-src/usrp3/top/e300/setupenv.sh
 +
 
 +
Next, you can use either the <code>uhd_image_builder_gui.py</code> utility or the command line version <code>uhd_image_builder.py</code> to build the FPGA image.
 +
 
 +
In this step we will build a FPGA image with the following blocks:
 +
 
 +
- 1x FFT
 +
- 1x Window
 +
- 1x Fosphor
 +
- 2x FIFO
 +
 
 +
Note: Depending upon your host machine performance, it can take a few hours to build a FPGA image.
 +
 
 +
== Building a FPGA image with uhd_image_builder.py ==
 +
 
 +
    $ ./uhd_image_builder.py fft window fosphor -t E310_RFNOC_sg3 -d E310 -m 5 --fill-with-fifos
 +
 
 +
== Building an FPGA image with uhd_image_builder_gui.py ==
 +
Note: <code>uhd_image_builder_gui.py</code> requires Python3.
 +
 
 +
    $ cd ~/rfnoc/src/uhd/fpga-src/usrp3/tools/scripts
 +
    $ python3 uhd_image_builder_gui.py
 +
 
 +
- Select the <code>E310_RFNOC_SG3</code> as the build target
 +
- Select the FFT, Window, and Fosphor block by highlighting them and clicking <code>>></code> to add them to the design
 +
- Click the <code>Fill with FIFOs</code> checkbox
 +
- Then click <code>Generate .bit file</code>
 +
 
 +
== Copy FPGA Image to E31x and verify ==
 +
 
 +
Once the FPGA image has completed in the previous step, it will need to be copied to to the E31x.
 +
 
 +
    $ scp /path/to/e300.bit root@192.168.10.2:~/localinstall/.
 +
 
 +
Note: The location of the generate bit file is printed at the end of the building process.
 +
 
 +
Example location:
 +
 
 +
    /home/user/rfnoc/src/uhd/fpga-src/usrp3/top/e300/build-E310_RFNOC_sg3/e300.bit
 +
 
 +
Next, SSH into the E31x and run `uhd_usrp_probe`, using this FPGA new custom FPGA image. The custom FPGA image path should be passed as a device argument to the UHD application.
 +
 
 +
    $ ssh root@192.168.10.2
 +
 
 +
    # source ./localinstall/setup.env
 +
    # uhd_usrp_probe --args"fpga=/home/root/localinstall/e300.bit"
 +
 
 +
Expected Output:
 +
 
 +
<pre>
 +
# uhd_usrp_probe --args "fpga=/home/root/localinstall/e300.bit"
 +
[INFO] [UHD] linux; GNU C++ version 4.9.2; Boost_105700; UHD_3.14.1.HEAD-0-gbfb9c1c7
 +
[INFO] [E300] Loading FPGA image: /home/root/localinstall/e300.bit...
 +
[INFO] [E300] FPGA image loaded
 +
[INFO] [E300] Detecting internal GPS....
 +
[INFO] [E300] GPSDO found
 +
[INFO] [E300] Initializing core control (global registers)...
 +
 
 +
[INFO] [E300] Performing register loopback test...
 +
[INFO] [E300] Register loopback test passed
 +
[INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000000000)
 +
[WARNING] [RFNOC] Can't find a block controller for key FFT, using default block controller!
 +
[INFO] [0/FFT_0] Initializing block control (NOC ID: 0xFF70000000000000)
 +
[INFO] [0/Window_0] Initializing block control (NOC ID: 0xD053000000000000)
 +
[WARNING] [RFNOC] Can't find a block controller for key fosphor, using default block controller!
 +
[INFO] [0/fosphor_0] Initializing block control (NOC ID: 0x666F000000000000)
 +
[INFO] [0/FIFO_0] Initializing block control (NOC ID: 0xF1F0000000000000)
 +
[INFO] [0/FIFO_1] Initializing block control (NOC ID: 0xF1F0000000000000)
 +
  _____________________________________________________
 +
/
 +
|      Device: E-Series Device
 +
|    _____________________________________________________
 +
|    /
 +
|  |      Mboard: E3XX SG3
 +
|  |  product: 30675
 +
|  |  revision: 6
 +
|  |  serial: xxxxxxx
 +
|  |  mac-addr: 00:80:2f:25:82:bb
 +
|  |  FPGA Version: 255.0
 +
|  |  FPGA git hash: e39334f-dirty
 +
|  |  RFNoC capable: Yes
 +
|  | 
 +
|  |  Time sources:  none, internal, external, gpsdo
 +
|  |  Clock sources: internal
 +
|  |  Sensors: temp, ref_locked, gps_locked, gps_time, gps_position, gps_gpgga, gps_gprmc
 +
|  |    _____________________________________________________
 +
|  |    /
 +
|  |  |      RX DSP: 0
 +
|  |  | 
 +
|  |  |  Freq range: 0.000 to 0.000 MHz
 +
|  |    _____________________________________________________
 +
|  |    /
 +
|  |  |      RX DSP: 1
 +
|  |  | 
 +
|  |  |  Freq range: 0.000 to 0.000 MHz
 +
|  |    _____________________________________________________
 +
|  |    /
 +
|  |  |      RX Dboard: A
 +
|  |  |  ID: E310 MIMO XCVR (0x0110)
 +
|  |  |  Serial: xxxxxxx
 +
|  |  |    _____________________________________________________
 +
|  |  |    /
 +
|  |  |  |      RX Frontend: A
 +
|  |  |  |  Name: FE-RX2
 +
|  |  |  |  Antennas: TX/RX, RX2
 +
|  |  |  |  Sensors: temp, rssi, lo_locked
 +
|  |  |  |  Freq range: 50.000 to 6000.000 MHz
 +
|  |  |  |  Gain range PGA: 0.0 to 76.0 step 1.0 dB
 +
|  |  |  |  Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
 +
|  |  |  |  Connection Type: IQ
 +
|  |  |  |  Uses LO offset: No
 +
|  |  |    _____________________________________________________
 +
|  |  |    /
 +
|  |  |  |      RX Frontend: B
 +
|  |  |  |  Name: FE-RX1
 +
|  |  |  |  Antennas: TX/RX, RX2
 +
|  |  |  |  Sensors: temp, rssi, lo_locked
 +
|  |  |  |  Freq range: 50.000 to 6000.000 MHz
 +
|  |  |  |  Gain range PGA: 0.0 to 76.0 step 1.0 dB
 +
|  |  |  |  Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
 +
|  |  |  |  Connection Type: IQ
 +
|  |  |  |  Uses LO offset: No
 +
|  |  |    _____________________________________________________
 +
|  |  |    /
 +
|  |  |  |      RX Codec: A
 +
|  |  |  |  Name: E3x0 RX dual ADC
 +
|  |  |  |  Gain Elements: None
 +
|  |    _____________________________________________________
 +
|  |    /
 +
|  |  |      TX DSP: 0
 +
|  |  | 
 +
|  |  |  Freq range: 0.000 to 0.000 MHz
 +
|  |    _____________________________________________________
 +
|  |    /
 +
|  |  |      TX DSP: 1
 +
|  |  | 
 +
|  |  |  Freq range: 0.000 to 0.000 MHz
 +
|  |    _____________________________________________________
 +
|  |    /
 +
|  |  |      TX Dboard: A
 +
|  |  |  ID: E310 MIMO XCVR (0x0110)
 +
|  |  |  Serial: xxxxxxx
 +
|  |  |    _____________________________________________________
 +
|  |  |    /
 +
|  |  |  |      TX Frontend: A
 +
|  |  |  |  Name: FE-TX2
 +
|  |  |  |  Antennas: TX/RX
 +
|  |  |  |  Sensors: temp, lo_locked
 +
|  |  |  |  Freq range: 50.000 to 6000.000 MHz
 +
|  |  |  |  Gain range PGA: 0.0 to 89.8 step 0.2 dB
 +
|  |  |  |  Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
 +
|  |  |  |  Connection Type: IQ
 +
|  |  |  |  Uses LO offset: No
 +
|  |  |    _____________________________________________________
 +
|  |  |    /
 +
|  |  |  |      TX Frontend: B
 +
|  |  |  |  Name: FE-TX1
 +
|  |  |  |  Antennas: TX/RX
 +
|  |  |  |  Sensors: temp, lo_locked
 +
|  |  |  |  Freq range: 50.000 to 6000.000 MHz
 +
|  |  |  |  Gain range PGA: 0.0 to 89.8 step 0.2 dB
 +
|  |  |  |  Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
 +
|  |  |  |  Connection Type: IQ
 +
|  |  |  |  Uses LO offset: No
 +
|  |  |    _____________________________________________________
 +
|  |  |    /
 +
|  |  |  |      TX Codec: A
 +
|  |  |  |  Name: E3x0 TX dual DAC
 +
|  |  |  |  Gain Elements: None
 +
|  |    _____________________________________________________
 +
|  |    /
 +
|  |  |      RFNoC blocks on this device:
 +
|  |  | 
 +
|  |  |  * Radio_0
 +
|  |  |  * FFT_0
 +
|  |  |  * Window_0
 +
|  |  |  * fosphor_0
 +
|  |  |  * FIFO_0
 +
|  |  |  * FIFO_1
 +
 
 +
[INFO] [E300] Loading FPGA image: /home/root/localinstall/usr/share/uhd/images/usrp_e3xx_fpga_idle_sg3.bit...
 +
[INFO] [E300] FPGA image loaded
 +
 
 +
</pre>
 +
 
 +
Note: At the end of the <code>uhd_usrp_probe</code> output is a list of blocks within this custom FPGA image.
  
    $ umount ~/newinstall
 
  
 
= Running RFNoC Fosphor =
 
= Running RFNoC Fosphor =
Line 629: Line 753:
 
In order to run RFNoC Fosphor, we will first need to generate the Python file to be ran on the E3xx USRP.
 
In order to run RFNoC Fosphor, we will first need to generate the Python file to be ran on the E3xx USRP.
  
On the Host machine, open GNU Radio:
+
On the Host machine, in a new terminal, open GNU Radio:
  
 
     $ gnuradio-companion
 
     $ gnuradio-companion
Line 635: Line 759:
 
Within GNU Radio, open the following files:
 
Within GNU Radio, open the following files:
  
     /home/user/rfnoc/gr-ettus/examples/rfnoc/rfnoc_fosphor_network_host.grc
+
     /home/user/rfnoc/src/gr-ettus/examples/rfnoc/rfnoc_fosphor_network_host.grc
     /home/user/rfnoc/gr-ettus/examples/rfnoc/rfnoc_fosphor_network_usrp.grc
+
     /home/user/rfnoc/src/gr-ettus/examples/rfnoc/rfnoc_fosphor_network_usrp.grc
  
 
[[File:e3xx_rfnoc_fosphor_1.png|700px|center]]
 
[[File:e3xx_rfnoc_fosphor_1.png|700px|center]]
Line 642: Line 766:
 
Select the <code>rfnoc_fosphor_network_usrp.grc</code> flowgraph.
 
Select the <code>rfnoc_fosphor_network_usrp.grc</code> flowgraph.
  
Modify the Variable <code>ip_addr</code> and set the value to match the E3xx USRP's address: <code>192.168.10.1</code>
+
Modify the Variable <code>ip_addr</code> and set the value to match the Host's address: <code>192.168.10.1</code>
 +
 
 +
Modify the <code>device3</code> block to set the <code>master_clock_rate</code> to be <code>56e6</code> and FPGA path argument.
 +
 
 +
Example:
 +
 
 +
    master_clock_rate=56e6,fpga=/home/root/localinstall/e300.bit
 +
 
 +
Modify the variable <code>fft_size</code> to be <code>512</code>
 +
 
 +
Modify the variable <code>spp</code> under the <code>USRP UHD Source</code> block to be <code>512</code>
  
 
[[File:e3xx_rfnoc_fosphor_2.png|700px|center]]
 
[[File:e3xx_rfnoc_fosphor_2.png|700px|center]]
Line 652: Line 786:
 
Copy the generated Python file, <code>rfnoc_fosphor_network_usrp.py</code> to the E3xx using the <code>scp</code> utility.
 
Copy the generated Python file, <code>rfnoc_fosphor_network_usrp.py</code> to the E3xx using the <code>scp</code> utility.
  
     $ scp /home/user/rfnoc/gr-ettus/examples/rfnoc/rfnoc_fosphor_network_usrp.py root@192.168.10.2:~/.
+
     $ scp /home/user/rfnoc/src/gr-ettus/examples/rfnoc/rfnoc_fosphor_network_usrp.py root@192.168.10.2:~/.
  
 
[[File:e3xx_rfnoc_fosphor_4.png|700px|center]]
 
[[File:e3xx_rfnoc_fosphor_4.png|700px|center]]
Line 669: Line 803:
 
     -rwxr-xr-- 1 root root 8980 Jan 15 04:43 rfnoc_fosphor_network_usrp.py
 
     -rwxr-xr-- 1 root root 8980 Jan 15 04:43 rfnoc_fosphor_network_usrp.py
  
Source the Environment Setup file, <code>setup_env.sh</code>.
+
Source the Environment Setup file, <code>setup.env</code>.
  
     # source ./localinstall/setup_env.sh
+
     # source ./localinstall/setup.env
  
 
Next, run <code>rfnoc_fosphor_network_usrp.py</code>. Leave this window open in the background.
 
Next, run <code>rfnoc_fosphor_network_usrp.py</code>. Leave this window open in the background.
  
 
     # python rfnoc_fosphor_network_usrp.py
 
     # python rfnoc_fosphor_network_usrp.py
 
[[File:e3xx_rfnoc_fosphor_5.png|700px|center]]
 
  
 
Return to <code>gnuradio-companion</code>, select the <code>rfnoc_fosphor_network_host.grc</code> flowgraph, and click the <code>Execute the flow graph</code> button.
 
Return to <code>gnuradio-companion</code>, select the <code>rfnoc_fosphor_network_host.grc</code> flowgraph, and click the <code>Execute the flow graph</code> button.

Latest revision as of 14:43, 5 August 2019

Application Note Number

AN-315

Revision History

Date Author Details
2017-09-28 Nate Temple Initial creation
2019-08-01 Nate Temple Update instructions for Ubuntu 18.x and mainline UHD


Abstract

This application note is one of a multi-part series which will cover the software development process on the USRP E310, E312 and E313. It will cover building UHD, GNU Radio and gr-ettus from source for the host machine, and cross-compiling UHD, GNU Radio and gr-ettus for the E3xx USRP with RFNoC enabled. It will then cover building a custom RFNoC FPGA image and running an example application RFNoC Fosphor.

Overview

Note: Linux only. This application note has been tested using Ubuntu 18.04.

Note: This application note is used with the release-4 E31x file system.

This application note has four sections:

1. Building UHD / GNU Radio / gr-ettus for the Host machine

2. Cross-compiling UHD / GNU Radio / gr-ettus for the E3xx USRP

3. Building a custom RFNoC FPGA image

4. Running an example application, RFNoC Fosphor


Installing UHD / GNU Radio / gr-ettus on the Host

This step is required in order to run the RFNoC Fosphor example. It is possible to operate the E3xx USRP with a RFNoC flowgraph without connecting it to a host machine. All of the processing is performed on the E3xx FPGA, the host is only used to display the FFT/Waterfall.

A more detailed guide to installing UHD / GNU Radio on Linux can be found at the following application note, which can be helpful for reference. https://kb.ettus.com/Building_and_Installing_the_USRP_Open-Source_Toolchain_(UHD_and_GNU_Radio)_on_Linux

This application note is using a vanilla Ubuntu 18.04 installation for the host operating system. If you are using another operating system, please refer to the above application note for specifics on dependency requirements. If you already have UHD and GNU Radio installed, you should first remove them before proceeding with this application note.

System Update

   $ sudo apt update
   $ sudo apt upgrade

Reconfigure Default Shell

Switch your default shell on the host computer from Dash to Bash. In some Linux distributions (e.g. Ubuntu) Dash is set as default shell, which may cause some issues. It is recommended to set the shell to Bash by running the following commands in the terminal. Choose No when prompted by the first command and the second command will validate the that Bash will be used.

   $ sudo dpkg-reconfigure dash

Verify Bash is the default shell.

   $ ll /bin/sh

Expected Output:

   lrwxrwxrwx 1 root root 4 Apr  2 22:00 /bin/sh -> bash*

Install Dependencies

   $ sudo apt -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.14-0 libcppunit-dev libcppunit-doc ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-qt4-doc libqwt6abi1 libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-dev libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk3.0 git libqt4-dev python-numpy ccache python-opengl libgsl-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-1.0-0-dev libqwtplot3d-qt5-dev pyqt4-dev-tools python-qwt5-qt4 cmake git wget libxi-dev gtk2-engines-pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq3-dev libzmq5 python-requests python-sphinx libcomedi-dev python-zmq libqwt-dev libqwt6abi1 python-six libgps-dev libgps23 gpsd gpsd-clients python-gps python-setuptools python3-pyqt5 dnsmasq sshfs

Create Working Directory

These folders will be used as a work area for cloning the sources and building.

   $ mkdir -p ~/rfnoc
   $ mkdir -p ~/rfnoc/src
   $ mkdir -p ~/rfnoc/oe
   $ mkdir -p ~/rfnoc/e300

Building UHD

   $ cd ~/rfnoc/src    
   $ git clone --recursive https://github.com/EttusResearch/uhd
   $ cd uhd
   $ git checkout v3.14.1.0
   $ git submodule update
   $ cd host
   $ mkdir build-host
   $ cd build-host
   $ cmake -DENABLE_E300=ON -DENABLE_GPSD=ON -DENABLE_RFNOC=ON ..
   $ make -j4
   $ sudo make install
   $ sudo ldconfig

Download UHD FPGA Images

   $ sudo uhd_images_downloader

Building GNU Radio

   $ cd ~/rfnoc/src 
   $ git clone --recursive https://github.com/gnuradio/gnuradio
   $ cd gnuradio/
   $ git checkout maint-3.7
   $ git submodule update
   $ mkdir build-host
   $ cd build-host
   $ cmake ..
   $ make -j4
   $ sudo make install
   $ sudo ldconfig

Building gr-ettus

   $ cd ~/rfnoc/src 
   $ git clone https://github.com/EttusResearch/gr-ettus.git
   $ cd gr-ettus
   $ mkdir build-host
   $ cd build-host
   $ cmake ..
   $ make -j4
   $ sudo make install
   $ sudo ldconfig

Verify Installation

Run the following command to verify UHD was installed properly.

   $ uhd_usrp_probe --version

Expected Output:

   3.14.1.HEAD-0-gbfb9c1c7

Run the following command to verify GNU Radio was installed properly.

   $ gnuradio-config-info --version

Expected Output:

   3.7.13.5

Cross-Compiling UHD / GNU Radio / gr-ettus for the E3xx USRP

SDK Setup

Download the OE SDK for the E31x release into the ~/rfnoc/src/ directory:

   $ cd ~/rfnoc/src
   $ wget http://files.ettus.com/e3xx_images/e3xx-release-4/oecore-x86_64-armv7ahf-vfp-neon-toolchain-nodistro.0.sh

Next, install the SDK to the ~/rfnoc/oe directory. Enter ~/rfnoc/oe for the installation directory when prompted.

   $ bash oecore-x86_64-armv7ahf-vfp-neon-toolchain-nodistro.0.sh 

Expected Output:

Enter target directory for SDK (default: /usr/local/oecore-x86_64): ~/rfnoc/oe
You are about to install the SDK to "/home/user/rfnoc/oe". Proceed[Y/n]?y
Extracting SDK...done
Setting it up...done
SDK has been successfully set up and is ready to be used.

Your ~/rfnoc/oe directory should have a structure such as below:

   $ ls ~/rfnoc/oe
   environment-setup-armv7ahf-vfp-neon-oe-linux-gnueabi       
   version-armv7ahf-vfp-neon-oe-linux-gnueabi
   site-config-armv7ahf-vfp-neon-oe-linux-gnueabi        
   sysroots

Source the OE SDK environment setup file:

   $ cd ~/rfnoc/oe
   $ source ./environment-setup-armv7ahf-vfp-neon-oe-linux-gnueabi 

Verify the environment has been setup correctly.

   $ echo $CC

Expected Output:

   arm-oe-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon --sysroot=/home/user/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi
  • Note: If you open a new terminal at any point, you will need to re-run the source command above to initialize the environment. The compiling environment setup is only needed for terminals that are cross-compiling the sources for the E31x. The terminals used later in this application note which are using SSH to connect to other devices do not need to have the compiling environment initialized.

Cross-Compiling UHD

   $ cd ~/rfnoc/src/uhd/host
   $ mkdir build-arm 
   $ cd build-arm
   $ cmake -DCMAKE_TOOLCHAIN_FILE=../host/cmake/Toolchains/oe-sdk_cross.cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_E300=ON -DENABLE_GPSD=ON -DENABLE_RFNOC=ON ..
   $ make -j4
   $ make install DESTDIR=~/rfnoc/e300
   $ make install DESTDIR=~/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/

Create Environment Setup File

Next, we will create an environment setup file that will set the correct system variables to point to our new installation when ran on the E31x.

   $ cd ~/rfnoc/e300
   $ touch setup.env
   $ nano setup.env

Add the following lines to setup.env:

LOCALPREFIX=~/newinstall/usr
export PATH=$LOCALPREFIX/bin:$PATH
export LD_LOAD_LIBRARY=$LOCALPREFIX/lib:$LD_LOAD_LIBRARY
export LD_LIBRARY_PATH=$LOCALPREFIX/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$LOCALPREFIX/lib/python2.7/site-packages:$PYTHONPATH
export PKG_CONFIG_PATH=$LOCALPREFIX/lib/pkgconfig:$PKG_CONFIG_PATH
export GRC_BLOCKS_PATH=$LOCALPREFIX/share/gnuradio/grc/blocks:$GRC_BLOCKS_PATH
export UHD_RFNOC_DIR=$LOCALPREFIX/share/uhd/rfnoc/
export UHD_IMAGES_DIR=$LOCALPREFIX/share/uhd/images

Copy default FPGA images

   $ mkdir -p ~/rfnoc/e300/usr/share/uhd/images
   $ cd ~/rfnoc/e300/usr/share/uhd/images
   $ cp -Rv /usr/local/share/uhd/images/usrp_e310_fpga* .
   $ cp -Rv /usr/local/share/uhd/images/usrp_e3xx_fpga_idle* .


Mount and test the UHD build

Next, we will mount the ~/rfnoc/e300 folder using SSHFS in order to test our new installation.

  • Note: This application note assumes you're using a static IP address of 192.168.10.2 for your E31x device, and that your host has the IP address of 192.168.10.1. If you're using different IP addresses, the commands below will need to be updated to reflect the correct IPs.

Open a new terminal and verify that you can ping the E31x:

   $ ping 192.168.10.2

Next, SSH into the E31x.

   $ ssh root@192.168.10.2

For this next step, your host computer will need to have OpenSSH Server installed.

Open a third terminal window on the host and run:

   $ sudo apt-get install openssh-server

Returning to the terminal which you're connected to the E31x via SSH, mount the ~/rfnoc/e300 folder onto the E31x.

First create a directory to mount the remote folder to with (running these commands on the E31x):

   # mkdir -p ~/newinstall
   # sshfs username@192.168.10.1:/home/user/rfnoc/e300 newinstall/
  • Note: The "username" in the above command needs to be updated to reflect your user on the host machine.

When prompted, enter the password of your user to complete the mounting of the remote file system.

Verify the mount was successful, your directory structure should match ~/rfnoc/e300 on the host machine.

   $ ls ~/newinstall/


Expected output:

setup_env.sh
usr

Next, we will need to setup the system environment on the E31x to use the newly compiled version of UHD.

Verify that the E31x is using the existing UHD installation, using the which command:

   # which uhd_usrp_probe

Expected output:

   /usr/bin/uhd_usrp_probe

Next, source the setup.env<code> file:

   # cd ~/newinstall
   # source ./setup.env

Verify that the newly compiled UHD is being used, again using the <code>which command:

   # which uhd_usrp_probe

Expected output:

   /home/root/newinstall/usr/bin/uhd_usrp_probe

Next, run uhd_usrp_probe:

   # uhd_usrp_probe

Expect output:


# uhd_usrp_probe 
[INFO] [UHD] linux; GNU C++ version 4.9.2; Boost_105700; UHD_3.14.1.HEAD-0-gbfb9c1c7
[INFO] [E300] Loading FPGA image: /home/root/newinstall/usr/share/uhd/images/usrp_e310_fpga_sg3.bit...
[INFO] [E300] FPGA image loaded
[INFO] [E300] Detecting internal GPS.... 
[INFO] [E300] GPSDO found
[INFO] [E300] Initializing core control (global registers)...
[INFO] [E300] Performing register loopback test... 
[INFO] [E300] Register loopback test passed
[INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000000000)
[INFO] [0/DDC_0] Initializing block control (NOC ID: 0xDDC0000000000000)
[INFO] [0/DUC_0] Initializing block control (NOC ID: 0xD0C0000000000002)
  _____________________________________________________
 /
|       Device: E-Series Device
|     _____________________________________________________
|    /
|   |       Mboard: E3XX SG3
|   |   product: 30675
|   |   revision: 6
|   |   serial: xxxxxxx
|   |   mac-addr: 00:80:2f:25:82:bb
|   |   FPGA Version: 255.0
|   |   FPGA git hash: e39334f
|   |   RFNoC capable: Yes
|   |   
|   |   Time sources:  none, internal, external, gpsdo
|   |   Clock sources: internal
|   |   Sensors: temp, ref_locked, gps_locked, gps_time, gps_position, gps_gpgga, gps_gprmc
|   |     _____________________________________________________
|   |    /
|   |   |       RX DSP: 0
|   |   |   
|   |   |   Freq range: 0.000 to 0.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       RX DSP: 1
|   |   |   
|   |   |   Freq range: 0.000 to 0.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       RX Dboard: A
|   |   |   ID: E310 MIMO XCVR (0x0110)
|   |   |   Serial: xxxxxxx
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Frontend: A
|   |   |   |   Name: FE-RX2
|   |   |   |   Antennas: TX/RX, RX2
|   |   |   |   Sensors: temp, rssi, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 76.0 step 1.0 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Frontend: B
|   |   |   |   Name: FE-RX1
|   |   |   |   Antennas: TX/RX, RX2
|   |   |   |   Sensors: temp, rssi, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 76.0 step 1.0 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Codec: A
|   |   |   |   Name: E3x0 RX dual ADC
|   |   |   |   Gain Elements: None
|   |     _____________________________________________________
|   |    /
|   |   |       TX DSP: 0
|   |   |   
|   |   |   Freq range: 0.000 to 0.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       TX DSP: 1
|   |   |   
|   |   |   Freq range: 0.000 to 0.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       TX Dboard: A
|   |   |   ID: E310 MIMO XCVR (0x0110)
|   |   |   Serial: xxxxxxxx
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Frontend: A
|   |   |   |   Name: FE-TX2
|   |   |   |   Antennas: TX/RX
|   |   |   |   Sensors: temp, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 89.8 step 0.2 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Frontend: B
|   |   |   |   Name: FE-TX1
|   |   |   |   Antennas: TX/RX
|   |   |   |   Sensors: temp, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 89.8 step 0.2 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Codec: A
|   |   |   |   Name: E3x0 TX dual DAC
|   |   |   |   Gain Elements: None
|   |     _____________________________________________________
|   |    /
|   |   |       RFNoC blocks on this device:
|   |   |   
|   |   |   * Radio_0
|   |   |   * DDC_0
|   |   |   * DUC_0

[INFO] [E300] Loading FPGA image: /home/root/newinstall/usr/share/uhd/images/usrp_e3xx_fpga_idle_sg3.bit...
[INFO] [E300] FPGA image loaded


At this point, it's possible to run the included UHD example programs with the newly compiled UHD.

   # cd ~/newinstall/usr/lib/uhd/examples/
   # ./rx_samples_to_file --freq 100e6 --gain 0 --ant TX/RX --rate 1e6 --duration 10 --null

Install python-six dependency to the OE SDK

GNU Radio versions that are newer than 3.7.10.2 require python-six, which is not included within the release-4 SDK. In this step python-six will be installed into the OE sysroot.

Return to the terminal which is being used to cross-compile, or open a new terminal and source the OE SDK environemnt setup file before proceeding.

   $ cd ~/rfnoc/src
   $ wget https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/six-1.11.0.tar.gz
   $ tar -zxvf six-1.11.0.tar.gz
   $ cd six-1.11.0
   $ python setup.py install --prefix=~/rfnoc/oe/sysroots/x86_64-oesdk-linux/usr

Cross-Compiling GNU Radio

Next, clone and cross-compile GNU Radio for the E31x. On the host machine:

   $ cd ~/rfnoc/src/gnuradio
   $ mkdir build-arm
   $ cd build-arm
   $ cmake -Wno-dev -DCMAKE_TOOLCHAIN_FILE=~/rfnoc/src/gnuradio/cmake/Toolchains/oe-sdk_cross.cmake -DENABLE_GR_WXGUI=OFF -DENABLE_GR_VOCODER=OFF -DENABLE_GR_DTV=OFF -DENABLE_GR_ATSC=OFF -DENABLE_DOXYGEN=OFF -DCMAKE_INSTALL_PREFIX=/usr ../
   $ make -j4
   $ make install DESTDIR=~/rfnoc/e300/
   $ make install DESTDIR=~/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/

Next, verify your GNU Radio installation was successful. On the E31x terminal, run the command:

   $ gnuradio-config-info --version

Expected output:

   3.7.13.5

Cross-Compiling gr-ettus

Next, clone and cross-compile gr-ettus. On the host machine:

   $ cd ~/rfnoc/src/gr-ettus
   $ mkdir build-arm
   $ cd build-arm
   $ cmake -DCMAKE_TOOLCHAIN_FILE=~/rfnoc/src/gnuradio/cmake/Toolchains/oe-sdk_cross.cmake -DCMAKE_INSTALL_PREFIX=/usr ..
   $ make -j4
   $ make install DESTDIR=~/rfnoc/e300/
   $ make install DESTDIR=~/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/

At this point you should have a fully functional UHD RFNoC, GNU Radio and gr-ettus installation. However being that the compiled sources are not located on the E31x (and only temporarily mounted via SSHFS) they will need to copied to the E31x's file system.

On the E31x navigate to your home directory and create a folder, localinstall

   # mkdir -p ~/localinstall

Next, copy the etc/, setup.env and usr/ folder from the remotely mounted folder:

   # cd ~/localinstall
   # cp -v ~/newinstall/setup.env .
   # cp -Rv ~/newinstall/etc .
   # cp -Rv ~/newinstall/usr .

Verify the folder contents:

   # ls ~/localinstall

Expected Output:

etc/
setup_env.sh
usr/

Next, we will need to update the setup.env file that is located within the ~/localinstall/ folder.

Verify your directory location with the pwd command:

   $ pwd

Expected Output:

   /home/root/localinstall

Edit the setup.env file to update the PATH variable to point to your new installation location (/home/root/localinstall):

   $ sed -i 's/newinstall/localinstall/g' setup.env

Verify your edit was successful with the command cat:

   $ cat setup.env

Expected Output:

LOCALPREFIX=~/localinstall/usr
export PATH=$LOCALPREFIX/bin:$PATH
export LD_LOAD_LIBRARY=$LOCALPREFIX/lib:$LD_LOAD_LIBRARY
export LD_LIBRARY_PATH=$LOCALPREFIX/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$LOCALPREFIX/lib/python2.7/site-packages:$PYTHONPATH
export PKG_CONFIG_PATH=$LOCALPREFIX/lib/pkgconfig:$PKG_CONFIG_PATH
export GRC_BLOCKS_PATH=$LOCALPREFIX/share/gnuradio/grc/blocks:$GRC_BLOCKS_PATH
export UHD_RFNOC_DIR=$LOCALPREFIX/share/uhd/rfnoc/
export UHD_IMAGES_DIR=$LOCALPREFIX/share/uhd/images

Note, the LOCALPREFIX variable has been updated to the new location.

This setup.env file needs to be source in order to utilize the new ~/localinstall location.

   $ source ./setup.env

Verify that the environment is setup correctly:

   $ which uhd_usrp_probe

Expected Output:

   /home/root/localinstall/usr/bin/uhd_usrp_probe

We can now dismount the remotely connected SSHFS folder. On the E31x, run the commands:

   # cd ~/
   # umount ~/newinstall
   # rm -rf ~/newinstall


Building a custom RFNoC FPGA Image

The default FPGA image shipped with UHD releases only contains the Radio, DDC, and DUC blocks. In order to explore the additional RFNoC blocks, a custom FPGA image will need to be built.

To build a FPGA image for the USRP E31x, the Xilinx Vivado toolchain must be installed. A future application note will cover a step-by-step install guide for Vivado. The E31x FPGA is a Zynq 7020 and can be built using the free Vivado WebPACK tools. Vivado System and Design Edition will also work.

Note: UHD 3.14.x.x requires Vivado 2017.4.

UHD provides several tools for building FPGA images. The step below assume you have a working installation of Xilinx Vivado WebPACK.

The first step is to source the environment setup file for the Vivado toolchain.

In a new terminal, run:

   $ source ~/rfnoc/src/uhd/fpga-src/usrp3/top/e300/setupenv.sh

Next, you can use either the uhd_image_builder_gui.py utility or the command line version uhd_image_builder.py to build the FPGA image.

In this step we will build a FPGA image with the following blocks:

- 1x FFT - 1x Window - 1x Fosphor - 2x FIFO

Note: Depending upon your host machine performance, it can take a few hours to build a FPGA image.

Building a FPGA image with uhd_image_builder.py

   $ ./uhd_image_builder.py fft window fosphor -t E310_RFNOC_sg3 -d E310 -m 5 --fill-with-fifos

Building an FPGA image with uhd_image_builder_gui.py

Note: uhd_image_builder_gui.py requires Python3.

   $ cd ~/rfnoc/src/uhd/fpga-src/usrp3/tools/scripts
   $ python3 uhd_image_builder_gui.py

- Select the E310_RFNOC_SG3 as the build target - Select the FFT, Window, and Fosphor block by highlighting them and clicking >> to add them to the design - Click the Fill with FIFOs checkbox - Then click Generate .bit file

Copy FPGA Image to E31x and verify

Once the FPGA image has completed in the previous step, it will need to be copied to to the E31x.

   $ scp /path/to/e300.bit root@192.168.10.2:~/localinstall/.

Note: The location of the generate bit file is printed at the end of the building process.

Example location:

   /home/user/rfnoc/src/uhd/fpga-src/usrp3/top/e300/build-E310_RFNOC_sg3/e300.bit

Next, SSH into the E31x and run `uhd_usrp_probe`, using this FPGA new custom FPGA image. The custom FPGA image path should be passed as a device argument to the UHD application.

   $ ssh root@192.168.10.2
   # source ./localinstall/setup.env
   # uhd_usrp_probe --args"fpga=/home/root/localinstall/e300.bit"

Expected Output:

# uhd_usrp_probe --args "fpga=/home/root/localinstall/e300.bit"
[INFO] [UHD] linux; GNU C++ version 4.9.2; Boost_105700; UHD_3.14.1.HEAD-0-gbfb9c1c7
[INFO] [E300] Loading FPGA image: /home/root/localinstall/e300.bit...
[INFO] [E300] FPGA image loaded
[INFO] [E300] Detecting internal GPS.... 
[INFO] [E300] GPSDO found
[INFO] [E300] Initializing core control (global registers)...

[INFO] [E300] Performing register loopback test... 
[INFO] [E300] Register loopback test passed
[INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000000000)
[WARNING] [RFNOC] Can't find a block controller for key FFT, using default block controller!
[INFO] [0/FFT_0] Initializing block control (NOC ID: 0xFF70000000000000)
[INFO] [0/Window_0] Initializing block control (NOC ID: 0xD053000000000000)
[WARNING] [RFNOC] Can't find a block controller for key fosphor, using default block controller!
[INFO] [0/fosphor_0] Initializing block control (NOC ID: 0x666F000000000000)
[INFO] [0/FIFO_0] Initializing block control (NOC ID: 0xF1F0000000000000)
[INFO] [0/FIFO_1] Initializing block control (NOC ID: 0xF1F0000000000000)
  _____________________________________________________
 /
|       Device: E-Series Device
|     _____________________________________________________
|    /
|   |       Mboard: E3XX SG3
|   |   product: 30675
|   |   revision: 6
|   |   serial: xxxxxxx
|   |   mac-addr: 00:80:2f:25:82:bb
|   |   FPGA Version: 255.0
|   |   FPGA git hash: e39334f-dirty
|   |   RFNoC capable: Yes
|   |   
|   |   Time sources:  none, internal, external, gpsdo
|   |   Clock sources: internal
|   |   Sensors: temp, ref_locked, gps_locked, gps_time, gps_position, gps_gpgga, gps_gprmc
|   |     _____________________________________________________
|   |    /
|   |   |       RX DSP: 0
|   |   |   
|   |   |   Freq range: 0.000 to 0.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       RX DSP: 1
|   |   |   
|   |   |   Freq range: 0.000 to 0.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       RX Dboard: A
|   |   |   ID: E310 MIMO XCVR (0x0110)
|   |   |   Serial: xxxxxxx
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Frontend: A
|   |   |   |   Name: FE-RX2
|   |   |   |   Antennas: TX/RX, RX2
|   |   |   |   Sensors: temp, rssi, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 76.0 step 1.0 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Frontend: B
|   |   |   |   Name: FE-RX1
|   |   |   |   Antennas: TX/RX, RX2
|   |   |   |   Sensors: temp, rssi, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 76.0 step 1.0 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Codec: A
|   |   |   |   Name: E3x0 RX dual ADC
|   |   |   |   Gain Elements: None
|   |     _____________________________________________________
|   |    /
|   |   |       TX DSP: 0
|   |   |   
|   |   |   Freq range: 0.000 to 0.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       TX DSP: 1
|   |   |   
|   |   |   Freq range: 0.000 to 0.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       TX Dboard: A
|   |   |   ID: E310 MIMO XCVR (0x0110)
|   |   |   Serial: xxxxxxx
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Frontend: A
|   |   |   |   Name: FE-TX2
|   |   |   |   Antennas: TX/RX
|   |   |   |   Sensors: temp, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 89.8 step 0.2 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Frontend: B
|   |   |   |   Name: FE-TX1
|   |   |   |   Antennas: TX/RX
|   |   |   |   Sensors: temp, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 89.8 step 0.2 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Codec: A
|   |   |   |   Name: E3x0 TX dual DAC
|   |   |   |   Gain Elements: None
|   |     _____________________________________________________
|   |    /
|   |   |       RFNoC blocks on this device:
|   |   |   
|   |   |   * Radio_0
|   |   |   * FFT_0
|   |   |   * Window_0
|   |   |   * fosphor_0
|   |   |   * FIFO_0
|   |   |   * FIFO_1

[INFO] [E300] Loading FPGA image: /home/root/localinstall/usr/share/uhd/images/usrp_e3xx_fpga_idle_sg3.bit...
[INFO] [E300] FPGA image loaded

Note: At the end of the uhd_usrp_probe output is a list of blocks within this custom FPGA image.


Running RFNoC Fosphor

In order to run RFNoC Fosphor, we will first need to generate the Python file to be ran on the E3xx USRP.

On the Host machine, in a new terminal, open GNU Radio:

   $ gnuradio-companion

Within GNU Radio, open the following files:

   /home/user/rfnoc/src/gr-ettus/examples/rfnoc/rfnoc_fosphor_network_host.grc
   /home/user/rfnoc/src/gr-ettus/examples/rfnoc/rfnoc_fosphor_network_usrp.grc
e3xx rfnoc fosphor 1.png

Select the rfnoc_fosphor_network_usrp.grc flowgraph.

Modify the Variable ip_addr and set the value to match the Host's address: 192.168.10.1

Modify the device3 block to set the master_clock_rate to be 56e6 and FPGA path argument.

Example:

   master_clock_rate=56e6,fpga=/home/root/localinstall/e300.bit

Modify the variable fft_size to be 512

Modify the variable spp under the USRP UHD Source block to be 512

e3xx rfnoc fosphor 2.png

Next, click the Generate the flow graph button. Note the file path in the console where it is generating the rfnoc_fosphor_network_usrp.py is created.

e3xx rfnoc fosphor 3.png

Copy the generated Python file, rfnoc_fosphor_network_usrp.py to the E3xx using the scp utility.

   $ scp /home/user/rfnoc/src/gr-ettus/examples/rfnoc/rfnoc_fosphor_network_usrp.py root@192.168.10.2:~/.
e3xx rfnoc fosphor 4.png

You will now need to SSH to the USRP E3xx.

   $ ssh root@192.168.10.2

Verify that the rfnoc_fosphor_network_usrp.py file was copied to your E3xx.

   # ls -al rfnoc_fosphor_network_usrp.py 

Expected Output:

   root@ettus-e3xx-sg3:~# ls -al rfnoc_fosphor_network_usrp.py
   -rwxr-xr-- 1 root root 8980 Jan 15 04:43 rfnoc_fosphor_network_usrp.py

Source the Environment Setup file, setup.env.

   # source ./localinstall/setup.env

Next, run rfnoc_fosphor_network_usrp.py. Leave this window open in the background.

   # python rfnoc_fosphor_network_usrp.py

Return to gnuradio-companion, select the rfnoc_fosphor_network_host.grc flowgraph, and click the Execute the flow graph button.

e3xx rfnoc fosphor 6.png

Maximize the GUI window that has started. RFNoC Fosphor should be running now on the E3xx and be displayed on your host computer. Adjust the Frequency to a strong set of signals, and adjust the Gain slider as needed to produce the best signal to noise ratio for your RF environment.

e3xx rfnoc fosphor 7.png