Changes between Initial Version and Version 1 of Tutorials/k0SDR/Tutorial00b


Ignore:
Timestamp:
Jul 26, 2021, 5:09:05 AM (3 years ago)
Author:
mpk2138
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/k0SDR/Tutorial00b

    v1 v1  
     1[[TOC(Tutorials/k0SDR*, depth=3)]]
     2
     3''Last updated: 2021/07/26''
     4
     5== Working with USRP X310 ==
     6
     7=== Description ===
     8For this tutorial, we will now use two USRP X310s on ORBIT Sandbox 2 to transmit and receive a single frequency over the air to demonstrate the use of the '''U'''SRP '''H'''ardware '''D'''rivers (UHD) with the USRP X310. This tutorial can be run on other USRP X310s available of the grid as well. For details on available USRPs on the grid, please see [wiki:Hardware/fDevices/cSDR/gUSRP#GRID available USRP hardware in the grid].
     9
     10As with any of these tutorials, it is much more productive to ''write the commands by hand'' rather than just copy-paste them. This will help memorize what is going on.
     11
     12=== Hardware / Software Resources Utilized ===
     13We will be using the X310 radios in ORBIT Sandbox 2. One radio will be used to transmit, and the other to receive. For more information on these radios, please see the [[Hardware/bDomains/cSandboxes/bSB2|Sandbox 2]] page.
     14
     15We will use the following node image: {{{baseline-gr-uhd4-rc.ndz}}} which contains UHD 4.0.0 along with GNU Radio 3.8.
     16
     17=== Set Up ===
     18==== Imaging ====
     19First, make sure you have Sandbox 2 reserved and are logged into the console over SSH.
     20
     21We should make sure that both of the nodes are turned off:
     22
     23{{{mpk2138@console:~$ omf tell -a offh -t node1-1,node1-2}}}
     24
     25Then, we want to image the nodes with the following commands:
     26
     27{{{mpk2138@console:~$ omf load -i baseline-gr-uhd4-rc.ndz -t node1-1}}}
     28
     29{{{mpk2138@console:~$ omf load -i baseline-gr-uhd4-rc.ndz -t node1-2}}}
     30
     31Please note, it will take time to image the node, make sure that the first image process is finished before attempting to start the second.
     32
     33Once both nodes are imaged, we can now turn them back on:
     34
     35{{{mpk2138@console:~$ omf tell -a on -t node1-1,node1-2}}}
     36
     37==== Accessing the Nodes ====
     38
     39Give the node about a minute to turn on and be ready, and then SSH into the first node:
     40
     41{{{mpk2138@console:~$ ssh root@node1-1}}}
     42
     43Once you have SSH'd into {{{node1-1}}}, open a second SSH session and login to the Sandbox 2 console as before. On that new SSH session, SSH into the other node:
     44
     45{{{mpk2138@console:~$ ssh root@node1-2}}}
     46
     47At this stage, you should have two SSH windows open, each logged into one of the two nodes.
     48
     49==== Configuring the Network Interface ====
     50Each node is physically connected to one USRP X310 over a 10 Gbps Ethernet connection. However, the default network card interface configuration will need to be changed so that the node can communicate to the correct IP address.
     51
     52The USRP X310 uses a default IP address of {{{192.168.40.2}}} on its first 10 Gbps interface, which is the interface being used to connect to the node. So on '''both nodes''', run the following command to setup the network interface to use the correct IP address:
     53
     54{{{root@node1-X:~# ifconfig enp1s0 192.168.40.1}}}
     55
     56By setting the IP address of the interface named {{{enp1s0}}} on the node to {{{192.168.40.1}}} and using the default subnet mask of {{{255.255.255.0}}}, we are then able to communicate with any device with an IP between {{{192.168.40.2}}} and {{{192.168.40.254}}} using that interface. Since the USRP X310 has IP address {{{192.168.40.2}}} and is connected to interface {{{enp1s0}}}, we can now communicate with it. Confirm this with the following command:
     57
     58{{{root@node1-X:~# uhd_find_devices}}}
     59
     60This should yield the following output:
     61{{{
     62[INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_4.0.0.0-25-g1a34ba8a
     63--------------------------------------------------
     64-- UHD Device 0
     65--------------------------------------------------
     66Device Address:
     67    serial: 30F10F9
     68    addr: 192.168.40.2
     69    fpga: HG
     70    name:
     71    product: X310
     72    type: x300
     73}}}
     74
     75Please ensure this works before proceeding.
     76
     77=== Running the UHD example experiment ===
     78''See the troubleshooting section below for a common error and how to fix it.''
     79
     80Now, we can run the example UHD experiment to make sure that the radios are able to transmit and receive.
     81
     82Set up the USRP X310 on {{{node1-1}}} to transmit a 1 MHz sine wave sampled at 10 MHz, with 2GHz carrier frequency:
     83
     84{{{root@node1-1:~# cd /usr/local/lib/uhd/examples/}}}
     85
     86{{{root@node1-1:/usr/local/lib/uhd/examples/# ./tx_waveforms --freq 2e9 --rate 10e6 --wave-type SINE --wave-freq 1e6 --gain 0}}}
     87
     88
     89=== Troubleshooting ===
     90You may run into the following error when running the experiment:
     91
     92{{{
     93[INFO] [X300] X300 initialization sequence...
     94Error: RuntimeError: Expected FPGA compatibility number 38, but got 36:
     95The FPGA image on your device is not compatible with this host code build.
     96Download the appropriate FPGA images for this version of UHD.
     97Please run:
     98
     99 "/usr/local/lib/uhd/utils/uhd_images_downloader.py"
     100
     101Then burn a new image to the on-board flash storage of your
     102USRP X3xx device using the image loader utility. Use this command:
     103
     104"/usr/local/bin/uhd_image_loader" --args="type=x300,addr=192.168.40.2"
     105
     106For more information, refer to the UHD manual:
     107
     108 http://files.ettus.com/manual/page_usrp_x3x0.html#x3x0_flash
     109}}}
     110
     111This is basically saying that the FPGA on the USRP X310 is a different version than that expected by UHD. To fix this issue, simply follow the commands as stated:
     112
     113{{{root@node1-X:~# /usr/local/lib/uhd/utils/uhd_images_downloader.py}}}
     114
     115{{{root@node1-X:~# /usr/local/bin/uhd_image_loader --args="type=x300,addr=192.168.40.2"}}}
     116
     117Upon running the second command, you should see the following output:
     118
     119{{{
     120[INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_4.0.0.0-25-g1a34ba8a
     121Unit: USRP X310 (30F110A, 192.168.40.2)
     122FPGA Image: /usr/local/share/uhd/images/usrp_x310_fpga_HG.bit
     123-- Initializing FPGA loading...successful.
     124-- Loading HG FPGA image: 0% (0/121 sectors)
     125}}}
     126
     127'''''Do not do anything on the node while this is running'''''. An incomplete FPGA imaging process will brick the USRP X310 and render it totally unusable.
     128
     129When it has completed, exit the node:
     130
     131{{{root@node1-X:~# exit}}}
     132
     133Once back in the console, power cycle the node:
     134
     135{{{mpk2138@console:~$ omf tell -a offh -t node1-X}}}
     136
     137Wait a minute or so:
     138
     139{{{mpk2138@console:~$ omf tell -a on -t node1-X}}}
     140
     141You can now log back into the node over SSH and continue running the example experiment.
     142
     143The "imaging" outlined here is a very different procedure to "imaging" the node with a {{{.ndz}}} file. When imaging a node with a {{{.ndz}}} file, we are basically overwriting the hard drive with a backup. Imaging an FPGA on a USRP (or any FPGA in general) is the process of loading a new digital circuit configuration onto the FPGA's EEPROM - a much more delicate process which is why it must complete without disturbance.
     144