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
(Running RFNoC Fosphor)
Line 1: Line 1:
==Application Note Number==   
 
'''AN-315'''
 
 
==Revision History==
 
{| class="wikitable"
 
!Date
 
!Author
 
!Details
 
|-
 
|style="text-align:center;"| 2017-09-28
 
|style="text-align:center;"| Nate Temple
 
|style="text-align:center;"| Initial creation
 
|}
 
 
==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.
 
 
==Overview==
 
 
Note: Linux only. The application note has been tested using Ubuntu 16.04.3.
 
 
This application note has three sections:
 
 
1. Building rfnoc-devel UHD / GNU Radio / gr-ettus for the Host machine
 
 
2. Cross-compiling rfnoc-devel UHD / GNU Radio / gr-ettus for the E3xx USRP
 
 
3. Running an example application, RFNoC Fosphor
 
 
 
 
 
= Installing rfnoc-devel 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 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.
 
 
==System Update==
 
 
    $ sudo apt-get update
 
    $ sudo apt-get upgrade
 
 
== Reconfigure Default Shell ==
 
Switch your default shell on the host computer from <code>Dash</code> to <code>Bash</code>. In some Linux distributions (e.g. Ubuntu) <code>Dash</code> is set as default shell, which may cause some issues. It is recommended to set the shell to <code>Bash</code> by running the following commands in the terminal. Choose <code>No</code> when prompted by the first command and the second command will validate the that <code>Bash</code> 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-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
 
 
== Create Working Directory ==
 
This location will be used for building UHD / GNU Radio / gr-ettus for the Host installation.
 
 
    $ mkdir -p ~/rfnoc
 
    $ cd ~/rfnoc
 
 
== Building rfnoc-devel UHD ==
 
   
 
    $ git clone <nowiki>https://github.com/EttusResearch/uhd</nowiki>
 
    $ cd uhd
 
    $ git checkout rfnoc-devel
 
    $ mkdir build
 
    $ cd build
 
    $ cmake -DENABLE_E300=ON ..
 
    $ make -j4
 
    $ sudo make install
 
    $ sudo ldconfig
 
 
=== Download UHD FPGA Images ===
 
 
    $ sudo uhd_images_downloader
 
 
== Building GNU Radio ==
 
 
    $ cd ~/rfnoc
 
    $ git clone --recursive <nowiki>https://github.com/gnuradio/gnuradio</nowiki>
 
    $ cd gnuradio/
 
    $ git checkout v3.7.10.2
 
    $ mkdir build
 
    $ cd build
 
    $ cmake ..
 
    $ make -j4
 
    $ sudo make install
 
    $ sudo ldconfig
 
 
== Building gr-ettus ==
 
 
    $ cd ~/rfnoc
 
    $ git clone <nowiki>https://github.com/EttusResearch/gr-ettus.git</nowiki>
 
    $ cd gr-ettus
 
    $ mkdir build
 
    $ cd build
 
    $ cmake ..
 
    $ make -j4
 
    $ sudo make install
 
    $ sudo ldconfig
 
 
== Verify Installation ==
 
Run the following command to verify the <code>rfnoc-devel</code> branch of UHD was installed properly.
 
 
    $ uhd_usrp_probe --version
 
 
Expected Output:
 
 
    4.0.0.rfnoc-devel-xxx-xxxxxxxxx
 
 
= Cross-Compiling rfnoc-devel UHD / GNU Radio / gr-ettus for the E3xx USRP =
 
 
== Working Directory ==
 
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
 
 
Make a <code>src/</code> directory within the working directory.
 
 
    $ mkdir -p ~/e300/src
 
 
== SDK Setup ==
 
Download the OE SDK for the E31x release into the <code>src/</code> directory:
 
 
    $ cd ~/e300/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 <code>~/e300</code> directory. Enter <code>~/e300</code> for the installation directory when prompted.
 
 
    $ bash oecore-x86_64-armv7ahf-vfp-neon-toolchain-nodistro.0.sh
 
 
Expected Output:
 
 
<pre>
 
Enter target directory for SDK (default: /usr/local/oecore-x86_64): ~/e300
 
You are about to install the SDK to "/home/user/e300". Proceed[Y/n]?y
 
Extracting SDK...done
 
Setting it up...done
 
SDK has been successfully set up and is ready to be used.
 
</pre>
 
 
Your <code>~/e300</code> directory should have a structure such as below:
 
 
    $ ls ~/e300
 
    environment-setup-armv7ahf-vfp-neon-oe-linux-gnueabi  src      version-armv7ahf-vfp-neon-oe-linux-gnueabi
 
    site-config-armv7ahf-vfp-neon-oe-linux-gnueabi        sysroots
 
 
Source the environment setup file:
 
 
    $ cd ~/e300
 
    $ 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/e300/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.
 
 
== Cross-Compiling rfnoc-devel UHD ==
 
Next, download the <code>rfnoc-devel</code> branch of UHD.
 
 
    $ cd ~/e300/src
 
    $ git clone -b rfnoc-devel <nowiki>https://github.com/EttusResearch/uhd.git</nowiki>
 
 
Next, we will cross-compile the <code>rfnoc-devel</code> branch of UHD.
 
 
    $ 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 install DESTDIR=~/e300
 
    $ make install DESTDIR=~/e300/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/
 
 
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
 
    $ touch setup_env.sh
 
    $ nano setup_env.sh
 
 
Add the following lines to <code>setup_env.sh</code>:
 
 
<pre>
 
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
 
</pre>
 
 
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.
 
 
* 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.
 
 
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 <code>~/e300</code> 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: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 <code>~/e300</code> on the host machine.
 
 
    $ ls ~/newinstall/
 
 
Expected output:
 
<pre>
 
environment-setup-armv7ahf-vfp-neon-oe-linux-gnueabi
 
setup_env.sh
 
site-config-armv7ahf-vfp-neon-oe-linux-gnueabi
 
src
 
sysroots
 
usr
 
version-armv7ahf-vfp-neon-oe-linux-gnueabi
 
</pre>
 
 
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:
 
 
    $ which uhd_usrp_probe
 
 
Expected output:
 
 
    /usr/bin/uhd_usrp_probe
 
 
Next, source the setup_env.sh file:
 
 
    $ cd ~/newinstall
 
    $ source ./setup_env.sh
 
 
Now we will verify that the newly compiled UHD is being used, again using the <code>which</code> command:
 
 
    $ which uhd_usrp_probe
 
 
Expected output:
 
 
    /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:
 
 
    $ uhd_images_downloader
 
 
Expected 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>
 
$ 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.
 
 
    $ 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] FPGA image loaded
 
[INFO] [E300] Initializing core control (global registers)...
 
 
[INFO] [E300] Performing register loopback test...
 
[INFO] [E300] Register loopback test passed
 
[INFO] [RFNOC RADIO] Register loopback test passed
 
[INFO] [RFNOC RADIO] Register loopback test passed
 
[WARNING] [RFNOC] [0/fosphor_0] defines 2 input buffer sizes, but 1 input ports
 
[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
 
  _____________________________________________________
 
/
 
|      Device: E-Series Device
 
|    _____________________________________________________
 
|    /
 
|  |      Mboard: E3XX
 
|  |  product: 30675
 
|  |  revision: 6
 
|  |  serial: xxxxxxx
 
|  |  mac-addr: 00:00:00:00:00:00
 
|  |  FPGA Version: 255.0
 
|  |  FPGA git hash: f764326-dirty
 
|  |  RFNoC capable: Yes
 
|  | 
 
|  |  Time sources:  none, internal, external
 
|  |  Clock sources: internal
 
|  |  Sensors: temp, ref_locked
 
|  |    _____________________________________________________
 
|  |    /
 
|  |  |      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: xxxxxx
 
|  |  |    _____________________________________________________
 
|  |  |    /
 
|  |  |  |      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: xxxxxx
 
|  |  |    _____________________________________________________
 
|  |  |    /
 
|  |  |  |      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
 
|  |  |  * FIFO_0
 
|  |  |  * Window_0
 
|  |  |  * FFT_0
 
|  |  |  * fosphor_0
 
|  |  |  * FIFO_1
 
|  |  |  * FIR_0
 
 
</pre>
 
 
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 --null
 
 
 
Press <code>CTRL+C</code> to exit the program.
 
 
== Cross-Compiling GNU Radio ==
 
On the host computer, navigate to the <code>~/e300/src</code> directory, clone and cross-compile GNU Radio:
 
 
    $ cd ~/e300/src
 
    $ git clone -b v3.7.10.2 --recursive <nowiki>https://github.com/gnuradio/gnuradio.git</nowiki>
 
    $ cd gnuradio/
 
    $ mkdir build
 
    $ 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 install DESTDIR=~/e300/
 
    $ make install DESTDIR=~/e300/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.10.2
 
 
== 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>:
 
 
    $ cd ~/e300/src
 
    $ git clone -b master <nowiki>https://github.com/EttusResearch/gr-ettus.git</nowiki>
 
    $ cd gr-ettus/
 
    $ mkdir build
 
    $ cd build
 
    $ cmake -DCMAKE_TOOLCHAIN_FILE=~/e300/src/gnuradio/cmake/Toolchains/oe-sdk_cross.cmake -DCMAKE_INSTALL_PREFIX=/usr ..
 
    $ make -j4
 
    $ make install DESTDIR=~/e300/
 
    $ make install DESTDIR=~/e300/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.
 
 
Create a folder on the E31x, in the home directory, <code>localinstall</code>.
 
 
    $ mkdir -p ~/localinstall
 
 
Next, copy the <code>etc/</code>, <code>setup_env.sh</code> and <code>usr/</code> folder to this new local folder:
 
 
    $ cd ~/localinstall
 
 
    $ cp -Rv ~/newinstall/setup_env.sh .
 
    $ cp -Rv ~/newinstall/etc .
 
    $ cp -Rv ~/newinstall/usr .
 
 
Verify the folder contents:
 
 
    $ ls ~/localinstall
 
 
Expected Output:
 
 
<pre>
 
etc/
 
setup_env.sh
 
usr/
 
</pre>
 
 
Next, we will need to update the <code>setup_env.sh</code> file that is located within the <code>~/localinstall/</code> folder.
 
 
Verify your directory location with the <code>pwd</code> command:
 
 
    $ pwd
 
 
Expected Output:
 
 
    /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>):
 
 
    $ sed -i 's/newinstall/localinstall/g' setup_env.sh
 
 
Verify your edit was successful with the command <code>cat</code>:
 
 
    $ cat setup_env.sh
 
 
Expected Output:
 
 
<pre>
 
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
 
</pre>
 
 
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.
 
 
    $ source ./setup_env.sh
 
 
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 command:
 
 
    $ umount ~/newinstall
 
 
 
= Running RFNoC Fosphor =
 
= Running RFNoC Fosphor =
  
Line 657: Line 36:
 
Verify that the <code>rfnoc_fosphor_network_usrp.py</code> file was copied to your E3xx.
 
Verify that the <code>rfnoc_fosphor_network_usrp.py</code> file was copied to your E3xx.
  
     $ ls -al rfnoc_fosphor_network_usrp.py  
+
     # ls -al rfnoc_fosphor_network_usrp.py  
  
 
Expected Output:
 
Expected Output:
Line 666: Line 45:
 
Source the Environment Setup file, <code>setup_env.sh</code>.
 
Source the Environment Setup file, <code>setup_env.sh</code>.
  
     $ source ./localinstall/setup_env.sh
+
     # source ./localinstall/setup_env.sh
  
 
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]]
 
[[File:e3xx_rfnoc_fosphor_5.png|700px|center]]

Revision as of 01:00, 29 September 2017

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, open GNU Radio:

   $ gnuradio-companion

Within GNU Radio, open the following files:

   /home/user/rfnoc/gr-ettus/examples/rfnoc/rfnoc_fosphor_network_host.grc
   /home/user/rfnoc/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 E3xx USRP's address: 192.168.10.1

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/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.sh.

   # source ./localinstall/setup_env.sh

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

   # python rfnoc_fosphor_network_usrp.py
e3xx rfnoc fosphor 5.png

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