Changes between Version 1 and Version 2 of Tutorials/Wireless/Spectrum Sensing


Ignore:
Timestamp:
Nov 5, 2019, 6:20:32 PM (5 years ago)
Author:
prasanthi
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/Wireless/Spectrum Sensing

    v1 v2  
    1 == Spectrum Sensing ==
     1== Basic usage ==
     2
     3=== Desciption ===
     4In 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.
     5
     6=== Prerequisites ===
     7In 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.
     8
     9=== Set up ===
     10For 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.
     11 1. Sign up for a [https://cosmos-lab.org/portal-2/ COSMOS account]
     12 2. [Documentation/Short/CreateRes Create a resource reservation on sandbox 1]
     13 3. [Documentation/Short/Login Login into your reserved domain.]
     14 4. Load baseline_uhd.ndz on your resource. [Documentation/Short/LoadImage  - this is done via OMF commands.]
     15
     16When 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.
     17
     18=== Configure and detect the radio ===
     19* Once your node is ready and turned on, ssh into the Krypton's host
     20{{{
     21console:~$ ssh root@sdr2-lg1.sb1.cosmos-lab.org
     22}}}
     23
     24* 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}}}.
     25
     26 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.
     27
     28* Run ''uhd_find_devices' and check if the X310 is detected
     29{{{
     30root@sdr-console> uhd_find_devices --args="type=x300"
     31
     32[INFO] [UHD] linux; GNU C++ version 7.4.0; Boost_106501; UHD_3.14.0.HEAD-0-g6875d061
     33--------------------------------------------------
     34-- UHD Device 0
     35--------------------------------------------------
     36Device Address:
     37    serial: 31557B9
     38    fpga: HG
     39    name:
     40    product: X310
     41    resource: RIO0
     42    type: x300
     43
     44}}}
     45
     46 The output enumerates all the SDRs that were detected. Krypton has only one PCIe radio device of type=x300.
     47
     48* 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.
     49{{{
     50root@sdr-console> uhd_usrp_probe --args="resource=rio0,type=x300"
     51
     52[INFO] [UHD] linux; GNU C++ version 7.4.0; Boost_106501; UHD_3.14.0.HEAD-0-g6875d061
     53[INFO] [X300] X300 initialization sequence...
     54[INFO] [X300] Connecting to niusrpriorpc at localhost:5444...
     55[INFO] [X300] Using LVBITX bitfile /usr/local/share/uhd/images/usrp_x310_fpga_HG.lvbitx...
     56[INFO] [X300] Radio 1x clock: 200 MHz
     57[INFO] [GPS] Found an internal GPSDO: LC_XO, Firmware Rev 0.929a
     58[INFO] [0/DmaFIFO_0] Initializing block control (NOC ID: 0xF1F0D00000000000)
     59[INFO] [0/DmaFIFO_0] BIST passed (Throughput: 1301 MB/s)
     60[INFO] [0/DmaFIFO_0] BIST passed (Throughput: 1303 MB/s)
     61[INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000000001)
     62[INFO] [0/Radio_1] Initializing block control (NOC ID: 0x12AD100000000001)
     63[INFO] [0/DDC_0] Initializing block control (NOC ID: 0xDDC0000000000000)
     64[INFO] [0/DDC_1] Initializing block control (NOC ID: 0xDDC0000000000000)
     65[INFO] [0/DUC_0] Initializing block control (NOC ID: 0xD0C0000000000000)
     66[INFO] [0/DUC_1] Initializing block control (NOC ID: 0xD0C0000000000000)
     67  _____________________________________________________
     68 /
     69|       Device: X-Series Device
     70|     _____________________________________________________
     71|    /
     72|   |       Mboard: X310
     73|   |   revision: 12
     74|   |   revision_compat: 7
     75|   |   product: 30810
     76|   |   mac-addr0: 00:11:22:33:44:55
     77|   |   mac-addr1: 66:77:88:99:aa:bb
     78|   |   gateway: 192.168.10.1
     79|   |   ip-addr0: 192.168.10.2
     80|   |   subnet0: 255.255.255.0
     81|   |   ip-addr1: 192.168.40.2
     82|   |   subnet1: 255.255.255.0
     83|   |   ip-addr2: 255.255.255.255
     84|   |   subnet2: 255.255.255.0
     85|   |   ip-addr3: 255.255.255.255
     86|   |   subnet3: 255.255.255.0
     87|   |   serial: 31557B9
     88|   |   FW Version: 6.0
     89|   |   FPGA Version: 35.1
     90|   |   FPGA git hash: 4c165a5
     91|   |   RFNoC capable: Yes
     92|   |
     93|   |   Time sources:  internal, external, gpsdo
     94|   |   Clock sources: internal, external, gpsdo
     95|   |   Sensors: gps_gpgga, gps_gprmc, gps_time, gps_locked, gps_servo, ref_locked
     96|   |     _____________________________________________________
     97|   |    /
     98|   |   |       RX Dboard: A
     99|   |   |   ID: UBX-TDD (0x0203)
     100|   |   |   Serial: 31584CF
     101|   |   |     _____________________________________________________
     102|   |   |    /
     103|   |   |   |       RX Frontend: 0
     104|   |   |   |   Name: UBX RX
     105|   |   |   |   Antennas: TX/RX, RX2, CAL
     106|   |   |   |   Sensors: lo_locked
     107|   |   |   |   Freq range: 10.000 to 6000.000 MHz
     108|   |   |   |   Gain range PGA0: 0.0 to 31.5 step 0.5 dB
     109|   |   |   |   Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
     110|   |   |   |   Connection Type: IQ
     111|   |   |   |   Uses LO offset: No
     112|   |   |     _____________________________________________________
     113|   |   |    /
     114|   |   |   |       RX Codec: A
     115|   |   |   |   Name: ads62p48
     116|   |   |   |   Gain range digital: 0.0 to 6.0 step 0.5 dB
     117|   |     _____________________________________________________
     118|   |    /
     119|   |   |       RX Dboard: B
     120|   |   |   ID: UBX-TDD (0x0203)
     121|   |   |   Serial: 31584EE
     122|   |   |     _____________________________________________________
     123|   |   |    /
     124|   |   |   |       RX Frontend: 0
     125|   |   |   |   Name: UBX RX
     126|   |   |   |   Antennas: TX/RX, RX2, CAL
     127|   |   |   |   Sensors: lo_locked
     128|   |   |   |   Freq range: 10.000 to 6000.000 MHz
     129|   |   |   |   Gain range PGA0: 0.0 to 31.5 step 0.5 dB
     130|   |   |   |   Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
     131|   |   |   |   Connection Type: IQ
     132|   |   |   |   Uses LO offset: No
     133|   |   |     _____________________________________________________
     134|   |   |    /
     135|   |   |   |       RX Codec: B
     136|   |   |   |   Name: ads62p48
     137|   |   |   |   Gain range digital: 0.0 to 6.0 step 0.5 dB
     138|   |     _____________________________________________________
     139|   |    /
     140|   |   |       TX Dboard: A
     141|   |   |   ID: UBX-TDD (0x0202)
     142|   |   |   Serial: 31584CF
     143|   |   |     _____________________________________________________
     144|   |   |    /
     145|   |   |   |       TX Frontend: 0
     146|   |   |   |   Name: UBX TX
     147|   |   |   |   Antennas: TX/RX, CAL
     148|   |   |   |   Sensors: lo_locked
     149|   |   |   |   Freq range: 10.000 to 6000.000 MHz
     150|   |   |   |   Gain range PGA0: 0.0 to 31.5 step 0.5 dB
     151|   |   |   |   Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
     152|   |   |   |   Connection Type: QI
     153|   |   |   |   Uses LO offset: No
     154|   |   |     _____________________________________________________
     155|   |   |    /
     156|   |   |   |       TX Codec: A
     157|   |   |   |   Name: ad9146
     158|   |   |   |   Gain Elements: None
     159|   |     _____________________________________________________
     160|   |    /
     161|   |   |       TX Dboard: B
     162|   |   |   ID: UBX-TDD (0x0202)
     163|   |   |   Serial: 31584EE
     164|   |   |     _____________________________________________________
     165|   |   |    /
     166|   |   |   |       TX Frontend: 0
     167|   |   |   |   Name: UBX TX
     168|   |   |   |   Antennas: TX/RX, CAL
     169|   |   |   |   Sensors: lo_locked
     170|   |   |   |   Freq range: 10.000 to 6000.000 MHz
     171|   |   |   |   Gain range PGA0: 0.0 to 31.5 step 0.5 dB
     172|   |   |   |   Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
     173|   |   |   |   Connection Type: QI
     174|   |   |   |   Uses LO offset: No
     175|   |   |     _____________________________________________________
     176|   |   |    /
     177|   |   |   |       TX Codec: B
     178|   |   |   |   Name: ad9146
     179|   |   |   |   Gain Elements: None
     180|   |     _____________________________________________________
     181|   |    /
     182|   |   |       RFNoC blocks on this device:
     183|   |   |
     184|   |   |   * DmaFIFO_0
     185|   |   |   * Radio_0
     186|   |   |   * Radio_1
     187|   |   |   * DDC_0
     188|   |   |   * DDC_1
     189|   |   |   * DUC_0
     190|   |   |   * DUC_1
     191
     192}}}
     193
     194=== Run the application ===
     195Download the application source code from the attachment section below.
     196{{{
     197root@sdr-console> wget https://wiki.cosmos-lab.org/raw-attachment/wiki/tutorials/basic_usage/spectrum_view.tar.gz
     198
     199root@sdr-console> tar -zxvf spectrum_view.tar.gz
     200
     201}}}
     202
     203Please 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.
     204{{{
     205root@sdr-console> apt update
     206root@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
     207
     208root@sdr-console> git clone https://github.com/zaphoyd/websocketpp.git
     209root@sdr-console> pushd websocketpp
     210root@sdr-console> cmake . -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON
     211root@sdr-console> make -j 4
     212root@sdr-console> make install
     213root@sdr-console> popd
     214}}}
     215
     216Now if all the dependencies installed successfully, compile application.
     217{{{
     218root@sdr-console> make
     219root@sdr-console> make install
     220}}}
     221
     222From 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.
     223{{{
     224root@sdr-console> ./app_read_sdr_samples
     225 INFO  11:51:08.262 (main.cpp:623) - Starting command server at 5180
     226 INFO  11:51:08.262 (main.cpp:175) - Starting websock server at 9002
     227...........
     228}}}
     229
     230In 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.
     231
     232When the viewer is first opened, the page display should be similar to the following
     233 || [[Image(basic_usage_spectrum_view_1.png, width=500px)]] ||
     234
     235Ensure the localhost field is set to ''localhost:5002'' and the device type field is set to ''type=x300''.
     236
     237Click the ''connect'' button once and a "WebSocket Connection" statement should be output by the application.
     238Now 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.
     239
     240Keep the default values for RATE, FREQ, GAIN and click on the HALTED button. This should display the spectrum if all went well.
     241 || [[Image(basic_usage_spectrum_view_2.png, width=500px)]] ||
     242
     243
     244=== Troubleshooting ===
     245Check the troubleshooting section in the [https://wiki.cosmos-lab.org/wiki/tutorials/krypton_usage Krypton usage page] for common errors.