wiki:Tutorials/Wireless/SpectrumSensing

Spectrum Sensing with USRP2974

Description

In this tutorial we'll demonstrate how to run a spectrum sensing application on a USRP2974 in COSMOS testbed.

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 the COSMOS work flow page to get started.

Resources

One SDR - USRP2974 is required for this experiment.

Execution

Load an image

  • Turn the node on
       omf tell -a on -t sdr2-s1-lg1.bed.cosmos-lab.org
    
  • Once your node is ready and turned on, ssh into the Krypton's host
       console:~$ ssh root@sdr2-s1-lg1
    

Configure and detect the radio

  • 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 Krypton usage page. There is also a trouble shooting section at the bottom on that page to update the Krypton's internal firmware if necessary.

  • Run uhd_find_devices' and check if the X310 is detected
    root@sdr2-s1-lg1:~# uhd_find_devices --args="type=x300"
    [INFO] [UHD] linux; GNU C++ version 7.4.0; Boost_106501; UHD_3.14.1.1-release
    --------------------------------------------------
    -- UHD Device 0
    --------------------------------------------------
    Device Address:
        serial: 3166636
        fpga: XG
        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@sdr2-s1-lg1:~# 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
    
    

Prepare the application

  • Download the application source code from the attachment section below.
    root@sdr2-s1-lg1:~# wget https://wiki.cosmos-lab.org/raw-attachment/wiki/tutorials/basic_usage/spectrum_view.tar.gz
    root@sdr2-s1-lg1:~# tar -zxvf spectrum_view.tar.gz
    
  • Please refer to the README file in SPECTRUM_VIEW directory for instructions on compiling and running the application. Before compiling the application, install and compile a few dependencies.
    root@sdr2-s1-lg1:~# apt update
    root@sdr2-s1-lg1:~# apt-get -y install libboost-all-dev liblog4cxx-dev cmake libfftw3-dev libxml2-dev libpopt-dev libsqlite3-dev pkg-config libxml2-utils gnulib
    
    root@sdr2-s1-lg1:~# git clone https://github.com/zaphoyd/websocketpp.git
    root@sdr2-s1-lg1:~# pushd websocketpp
    root@sdr2-s1-lg1:~/websocketpp# cmake . -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON
    root@sdr2-s1-lg1:~/websocketpp# make -j 4
    root@sdr2-s1-lg1:~/websocketpp# make install
    root@sdr2-s1-lg1:~/websocketpp# popd
    

Now if all the dependencies installed successfully, compile application.

root@sdr2-s1-lg1:~/SPECTRUM_VIEW# make

Setup SSH tunnel

This will be used by the web app to connect to a server running on the Krypton's host.

Run the experiment

  • From within the SPECTRUM_VIEW directory make and run the application to read samples from the Krypton's radio. There are two channels inside the radio which are being read out but only the first channel is displayed.
    root@sdr2-s1-lg1:~/SPECTRUM_VIEW# ./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
    ...........
    

In short the application runs a server listening for commands.

  • Just to briefly demonstrate some functionality, open the spectrum_view.html file in a Chrome browser.

When the viewer is first opened, the page display should be similar to the following

Ensure the localhost field is set to localhost:5002 and the device type field is set to type=x300.

  • Click the connect button once and a "Web Socket Connection" statement should be output by the application.

Now click on connect again to create a device handle. Finally click on submit to adjust the radio parameters and the Halted button to display a spectrogram.

Keep the default values for RATE, FREQ, GAIN and click on the HALTED button. This should display the spectrum if all went well.

Troubleshooting

Check the troubleshooting section in the Krypton usage page for common errors.

Last modified 4 years ago Last modified on May 11, 2020, 12:54:27 AM

Attachments (3)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.