wiki:Tutorials/Wireless/SpectrumSensing

Version 3 (modified by prasanthi, 5 years ago) ( diff )

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.

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 COSMOS account
  2. Create a resource reservation on sandbox 1
  3. Login into your reserved domain.
  4. Load baseline_uhd.ndz on your resource. - 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 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
    
    

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

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@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

root@sdr-console> git clone https://github.com/zaphoyd/websocketpp.git
root@sdr-console> pushd websocketpp
root@sdr-console> cmake . -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON
root@sdr-console> make -j 4
root@sdr-console> make install
root@sdr-console> popd

Now if all the dependencies installed successfully, compile application.

root@sdr-console> make
root@sdr-console> make install

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@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
...........

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 make to create a device handle. Finally click on submit to adjust the radio parameters and the Go button to display a short spectrum bandwidth.

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.

Attachments (3)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.