== Simple Radio Example with USRP X310 on ORBIT Sandbox 2 == === Description === This tutorial shows a simple radio example - transmit a sine wave using an USRP X310 on ORBIT SB2, view it on another X310. === Set Up === Make a reservation on the [https://www.orbit-lab.org/schedule/ Orbit Scheduler] for using SB2. ==== Prepare the nodes ==== * Load baseline-uhd-3_13.ndz on nodes 1-1 and 1-2. {{{ prasanthi@console.sb2:~$ omf load -i baseline-uhd-3_13.ndz -t node1-1,node1-2 }}} * Once imaging is done, turn the nodes on and log in {{{ prasanthi@console.sb2:~$ omf tell -a on -t node1-1,node1-2 prasanthi@console.sb2:~$ ssh root@node1-1 prasanthi@console.sb2:~$ ssh root@node1-2 }}} ==== Prepare network setup for USRP access ==== Each X310 on SB2 is connected to its respective node through a 10G interface adapter installed in Port 0 of the USRP. In this configuration, the X310 will have a default IP address of 192.168.40.2 (see [http://files.ettus.com/manual/page_usrp_x3x0.html#x3x0_setup_network_host_interface X310 User Manual]). To setup network connectivity, make sure eth2 is configured with an address in the 192.168.40.0/24 subnet . {{{ root@node1-1:~# ifconfig eth2 192.168.40.1 netmask 255.255.255.0 mtu 9000 root@node1-1:~# ifconfig -a eth0 Link encap:Ethernet HWaddr 70:8b:cd:bc:84:4b BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) eth1 Link encap:Ethernet HWaddr 70:8b:cd:bc:84:4a inet addr:10.12.1.1 Bcast:10.12.255.255 Mask:255.255.0.0 inet6 addr: fe80::728b:cdff:febc:844a/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:166714 errors:0 dropped:0 overruns:0 frame:0 TX packets:79009 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:246154097 (246.1 MB) TX bytes:6546168 (6.5 MB) Interrupt:20 Memory:f7d00000-f7d20000 eth2 Link encap:Ethernet HWaddr f4:52:14:83:b7:20 inet addr:192.168.40.1 Bcast:192.168.40.255 Mask:255.255.255.0 inet6 addr: fe80::f652:14ff:fe83:b720/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:9000 Metric:1 RX packets:5263 errors:0 dropped:0 overruns:0 frame:0 TX packets:48 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:315780 (315.7 KB) TX bytes:3365 (3.3 KB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:325 errors:0 dropped:0 overruns:0 frame:0 TX packets:325 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:25308 (25.3 KB) TX bytes:25308 (25.3 KB) }}} With this setup, each node should be able to access the X310 connected to it. Check USRP access with uhd_find_devices and uhd_usrp_probe commands. {{{ root@node1-1:~# uhd_find_devices [INFO] [UHD] linux; GNU C++ version 5.4.0 20160609; Boost_105800; UHD_3.13.0.HEAD-0-g5b236772 -------------------------------------------------- -- UHD Device 0 -------------------------------------------------- Device Address: serial: 30F110A addr: 192.168.40.2 fpga: HG name: product: X310 type: x300 root@node1-1:~# uhd_usrp_probe [INFO] [UHD] linux; GNU C++ version 5.4.0 20160609; Boost_105800; UHD_3.13.0.HEAD-0-g5b236772 [INFO] [X300] X300 initialization sequence... [INFO] [X300] Maximum frame size: 8000 bytes. [INFO] [X300] Radio 1x clock: 200 MHz [INFO] [0/DmaFIFO_0] Initializing block control (NOC ID: 0xF1F0D00000000000) [ERROR] [0/DmaFIFO_0] Major compat number mismatch for noc_shell: Expecting 2, got 5. Error: RuntimeError: FPGA component `noc_shell' is revision 5 and UHD supports revision 2. Please either upgrade UHD (recommended) or downgrade the FPGA image. }}} If uhd_usrp_probe reports firmware incompatibility, please run uhd_images_downloader to make sure compatible firmware images are available, and then load a new image on to the USRP. {{{ root@node1-1:/usr/local/share/uhd# uhd_image_loader --args="type=x300,fpga=HG" [INFO] [UHD] linux; GNU C++ version 5.4.0 20160609; Boost_105800; UHD_3.13.0.HEAD-0-g5b236772 Unit: USRP X310 (30F110A, 192.168.40.2) FPGA Image: /usr/local/share/uhd/images/usrp_x310_fpga_HG.bit -- Initializing FPGA loading...successful. -- Loading HG FPGA image: 100% (121/121 sectors) -- Finalizing image load...successful. Power-cycle the USRP X310 to use the new image. }}} Power cycle the USRP - exit the node and use omf commands to power-cycle the node, which in turn power-cycles the USRP. Turn the nodes off. {{{ prasanthi@console.sb2:~$ omf tell -a offh -t node1-1,node1-2 }}} Once the off command is complete, wait for a minute and turn them back on. {{{ prasanthi@console.sb2:~$ omf tell -a on -t node1-1,node1-2 }}} Log on to the nodes, setup networking as described above and test USRP access {{{ root@node1-1:~# ifconfig eth2 192.168.40.1 mtu 9000 root@node1-1:~# uhd_usrp_probe . . . | | / | | | RFNoC blocks on this device: | | | | | | * DmaFIFO_0 | | | * Radio_0 | | | * Radio_1 | | | * DDC_0 | | | * DDC_1 | | | * DUC_0 | | | * DUC_1 }}} === Run the experiment === Once both the USRPs are ready and accessible, run the experiment. * Send a waveform from the TX node, node1-1 {{{ root@node1-1:~/uhd/host/build/examples# ./tx_waveforms --freq 2e9 --rate 10e6 --wave-type SINE --wave-freq 1e6 --gain 0 }}} * Run a spectrum analyzer application on the RX node, node1-2, to view the waveform {{{ root@node1-2:~/uhd/host/build/examples# ./rx_ascii_art_dft --freq 2e9 --rate 10e6 --gain 0 --ref-lvl -40 }}} || [[Image(SB2_ascii_art_sinewave.jpg)]]||