[[Include(WikiToC)]] == Basic usage == === Desciption === In this tutorial we'll demonstrate how to navigate from the COSMOS sandbox to a single SDR on a node and run an application to read samples from the SDR. === Prerequisites === In order to access the test bed, create a reservation and have it approved by the reservation service. Access to the resources are granted after the reservation is confirmed. Please follow the process shown on [wiki:cosmos_workflow the COSMOS work flow page] to get started. === Set up === For this example we used the Krypton SDR on console.sb1.cosmos-lab.org. Follow the steps below to gain access to this console and set up your node with an appropriate image. 1. Sign up for a [https://cosmos-lab.org/portal-2/ COSMOS account] 2. [Documentation/Short/CreateRes Create a resource reservation on sandbox 1] 3. [Documentation/Short/Login Login into your reserved domain.] 4. Load baseline_uhd.ndz on your resource. [Documentation/Short/LoadImage - this is done via OMF commands.] When opening a terminal into console.sb1.cosmos-lab.org set up a tunnel from localhost:5002 to sdr2-lg1.sb1.cosmos-lab.org:9002. This will be used by the web app to connect to a server running on the Krypton's host. === Configure and detect the radio === * Once your node is ready and turned on, ssh into the Krypton's host {{{ console:~$ ssh root@sdr2-lg1.sb1.cosmos-lab.org }}} * The USRP 2974 requires a PCIe driver to control the FPGA with the embedded PC. In the provided images, this will load automatically on boot. If it has issues, you can run it manually via {{{ systemctl restart niusrprio.service}}}. Detailed steps for driver installation and radio detection are on the [https://wiki.cosmos-lab.org/wiki/tutorials/krypton_usage Krypton usage page]. There is also a trouble shooting section at the bottom on that page to update the Krypton's internal firmware if necesary. * Run ''uhd_find_devices' and check if the X310 is detected {{{ root@sdr-console> uhd_find_devices --args="type=x300" [INFO] [UHD] linux; GNU C++ version 7.4.0; Boost_106501; UHD_3.14.0.HEAD-0-g6875d061 -------------------------------------------------- -- UHD Device 0 -------------------------------------------------- Device Address: serial: 31557B9 fpga: HG name: product: X310 resource: RIO0 type: x300 }}} The output enumerates all the SDRs that were detected. Krypton has only one PCIe radio device of type=x300. * Use the ''uhd_usrp_probe'' command to get more details on the x300. Specifying ''resource=rio0'' ensures only the directly connected radio is probed, instead of the radios on the network. {{{ root@sdr-console> uhd_usrp_probe --args="resource=rio0,type=x300" [INFO] [UHD] linux; GNU C++ version 7.4.0; Boost_106501; UHD_3.14.0.HEAD-0-g6875d061 [INFO] [X300] X300 initialization sequence... [INFO] [X300] Connecting to niusrpriorpc at localhost:5444... [INFO] [X300] Using LVBITX bitfile /usr/local/share/uhd/images/usrp_x310_fpga_HG.lvbitx... [INFO] [X300] Radio 1x clock: 200 MHz [INFO] [GPS] Found an internal GPSDO: LC_XO, Firmware Rev 0.929a [INFO] [0/DmaFIFO_0] Initializing block control (NOC ID: 0xF1F0D00000000000) [INFO] [0/DmaFIFO_0] BIST passed (Throughput: 1301 MB/s) [INFO] [0/DmaFIFO_0] BIST passed (Throughput: 1303 MB/s) [INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000000001) [INFO] [0/Radio_1] Initializing block control (NOC ID: 0x12AD100000000001) [INFO] [0/DDC_0] Initializing block control (NOC ID: 0xDDC0000000000000) [INFO] [0/DDC_1] Initializing block control (NOC ID: 0xDDC0000000000000) [INFO] [0/DUC_0] Initializing block control (NOC ID: 0xD0C0000000000000) [INFO] [0/DUC_1] Initializing block control (NOC ID: 0xD0C0000000000000) _____________________________________________________ / | Device: X-Series Device | _____________________________________________________ | / | | Mboard: X310 | | revision: 12 | | revision_compat: 7 | | product: 30810 | | mac-addr0: 00:11:22:33:44:55 | | mac-addr1: 66:77:88:99:aa:bb | | gateway: 192.168.10.1 | | ip-addr0: 192.168.10.2 | | subnet0: 255.255.255.0 | | ip-addr1: 192.168.40.2 | | subnet1: 255.255.255.0 | | ip-addr2: 255.255.255.255 | | subnet2: 255.255.255.0 | | ip-addr3: 255.255.255.255 | | subnet3: 255.255.255.0 | | serial: 31557B9 | | FW Version: 6.0 | | FPGA Version: 35.1 | | FPGA git hash: 4c165a5 | | RFNoC capable: Yes | | | | Time sources: internal, external, gpsdo | | Clock sources: internal, external, gpsdo | | Sensors: gps_gpgga, gps_gprmc, gps_time, gps_locked, gps_servo, ref_locked | | _____________________________________________________ | | / | | | RX Dboard: A | | | ID: UBX-TDD (0x0203) | | | Serial: 31584CF | | | _____________________________________________________ | | | / | | | | RX Frontend: 0 | | | | Name: UBX RX | | | | Antennas: TX/RX, RX2, CAL | | | | Sensors: lo_locked | | | | Freq range: 10.000 to 6000.000 MHz | | | | Gain range PGA0: 0.0 to 31.5 step 0.5 dB | | | | Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz | | | | Connection Type: IQ | | | | Uses LO offset: No | | | _____________________________________________________ | | | / | | | | RX Codec: A | | | | Name: ads62p48 | | | | Gain range digital: 0.0 to 6.0 step 0.5 dB | | _____________________________________________________ | | / | | | RX Dboard: B | | | ID: UBX-TDD (0x0203) | | | Serial: 31584EE | | | _____________________________________________________ | | | / | | | | RX Frontend: 0 | | | | Name: UBX RX | | | | Antennas: TX/RX, RX2, CAL | | | | Sensors: lo_locked | | | | Freq range: 10.000 to 6000.000 MHz | | | | Gain range PGA0: 0.0 to 31.5 step 0.5 dB | | | | Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz | | | | Connection Type: IQ | | | | Uses LO offset: No | | | _____________________________________________________ | | | / | | | | RX Codec: B | | | | Name: ads62p48 | | | | Gain range digital: 0.0 to 6.0 step 0.5 dB | | _____________________________________________________ | | / | | | TX Dboard: A | | | ID: UBX-TDD (0x0202) | | | Serial: 31584CF | | | _____________________________________________________ | | | / | | | | TX Frontend: 0 | | | | Name: UBX TX | | | | Antennas: TX/RX, CAL | | | | Sensors: lo_locked | | | | Freq range: 10.000 to 6000.000 MHz | | | | Gain range PGA0: 0.0 to 31.5 step 0.5 dB | | | | Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz | | | | Connection Type: QI | | | | Uses LO offset: No | | | _____________________________________________________ | | | / | | | | TX Codec: A | | | | Name: ad9146 | | | | Gain Elements: None | | _____________________________________________________ | | / | | | TX Dboard: B | | | ID: UBX-TDD (0x0202) | | | Serial: 31584EE | | | _____________________________________________________ | | | / | | | | TX Frontend: 0 | | | | Name: UBX TX | | | | Antennas: TX/RX, CAL | | | | Sensors: lo_locked | | | | Freq range: 10.000 to 6000.000 MHz | | | | Gain range PGA0: 0.0 to 31.5 step 0.5 dB | | | | Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz | | | | Connection Type: QI | | | | Uses LO offset: No | | | _____________________________________________________ | | | / | | | | TX Codec: B | | | | Name: ad9146 | | | | Gain Elements: None | | _____________________________________________________ | | / | | | RFNoC blocks on this device: | | | | | | * DmaFIFO_0 | | | * Radio_0 | | | * Radio_1 | | | * DDC_0 | | | * DDC_1 | | | * DUC_0 | | | * DUC_1 }}} === Configure and run the application === * Download the application source code from the attachment section below. {{{ root@sdr-console> wget https://wiki.cosmos-lab.org/raw-attachment/wiki/tutorials/basic_usage/spectrum_view.tar.gz root@sdr-console> tar -zxvf spectrum_view.tar.gz root@sdr-console> cd SPECTRUM_VIEW }}} * Please refer to the README file in SPECTRUM_VIEW directory for instructions on compiling and running the application. Before compiling install a few required libraries. {{{ root@sdr-console> apt update root@sdr-console> apt-get -y install libboost-all-dev liblog4cxx-dev cmake libfftw3-dev libxml2-dev libpopt-dev libsqlite3-dev pkg-config libxml2-utils gnulib }}} * Now compile and make the websocket library. {{{ root@sdr-console> make websock }}} * Lastly compile the application - this will generate the executable ''app_read_sdr_samples'' that reads samples from the SDR. {{{ root@sdr-console> make }}} * Run the application - this will start a server that listens for commands to configure the radio and stream received spectrum samples. {{{ root@sdr-console> ./app_read_sdr_samples INFO 11:51:08.262 (main.cpp:623) - Starting command server at 5180 INFO 11:51:08.262 (main.cpp:175) - Starting websock server at 9002 ........... }}} === Visualize spectrum samples === * Download the spectrum visualizer web client to your desktop. It is all in another zip file - ''spectrum_view.zip''. Unzip this folder and open ''spectrum_view.html'' in a Chrome browser. When the viewer is first opened, the page display should be similar to the following || [[Image(basic_usage_spectrum_view_1.png, width=500px)]] || * Set the localhost field to ''localhost:5002''. (Recall from the set up section to create a tunnel from localhost:5002 to sdr2-lg1.sb1.cosmos-lab.org:9002 since the ''app_read_sdr_samples'' application has a websock server listening on that address:port.) Set the device type field is set to ''type=x300''. Click the ''connect'' button once and a "Websocket Connection" statement should be output by the application. Now click on ''make'' to create a device handle. The RF radio parameters are already populated with default values for 2.4 GHz WIFI band. To view other active spectrum bands change the RATE, FREQ, GAIN fields to || RF Parameter || value || description || || RATE || 25e6 || Sampling rate || || FREQ || 1925e6 || Center frequency || || GAIN || 30 || Receive gain || Then click on ''Submit'' to update the SDR. Click on the ''Halted'' button to begin streaming samples from the radio to the browser. This should display the spectrum if all went well. || [[Image(basic_usage_spectrum_view_3.png, width=500px)]] || === Troubleshooting === * Check the troubleshooting section in the [https://wiki.cosmos-lab.org/wiki/tutorials/krypton_usage Krypton usage page] for common errors.