Version 3 (modified by nilanjan, 6 years ago) (diff)


USRP2 configration and data collection with OEDL script


In this tutorial we'll demonstrate exactly what the title says.

Hardware / Software Resourcesutilized

  1. 4 grid nodes with a USRP2 connect via Ethernet.
  2. ubuntu-12-04-uhd-daemon.ndz: node image with all the precompiled software required to configure the USRPs.
  3. uhd_exp1.rb - OEDL script executed on the console. This script configures the USRPs for data collection at specified frequencies, sampling rate, etc...
  4. uhd_daemon - a node background process that bridges the gap between OMF commands and USRP2.

Set up

  • Let's pick 4 nodes with a USRP2. For a current list of nodes with USRPs, goto the Orbit Scheduler, click on Status Page under Quick Links. Select the Grid Tab and filter by SDR and USRP_N210 or SBX. This will give a topology list of nodes (below) that can be used with the OMF commands:
  • After logging into grid console, make sure all nodes are turned off
    nilanjan@console.grid:~$ omf tell -a offh -t,,,
  • Verify state of node before continuing. Make sure all nodes are in the POWEROFF state.
    nilanjan@console.grid:~$ omf stat -t,,,
  • Image nodes
    nilanjan@console.grid:~$ omf load -i ubuntu-12-04-uhd-daemon.ndz -r 20 -t,,,
  • After nodes are imaged, verify that nodes are in POWEROFF state. Otherwise issue the following to turn them off for a reboot
    nilanjan@console.grid:~$ omf tell -a offh -t,,,
  • Turn nodes back on and verify they are in POWERON state
    nilanjan@console.grid:~$ omf tell -a on -t,,,
  • Download the OEDL experiment script uhd_exp1.rb to your local directory on the console. Executing this script will tell the USRP2 record spectrum data for a few seconds at different carrier frequencies. The contents of the uhd file is shown with additional comments:
    nilanjan@console.grid:~/UHD$ cat uhd_exp1.rb
    defProperty('rxfreq',  2400e6, "Starting rx frequency")
    defProperty('rxstep',  10e6, "Rx frequency increments")
    defProperty('nfreq',   10, "Number of frequency steps")
    defProperty('dwell',   10, "Number of seconds at each frequency step")
    defGroup('rxnode', ',,,')
    { |n|
    onEvent(:ALL_UP) do |event|
      info "Give machines some time to warm up"
      wait 4
      allGroups.uhd.u0.activate                        # starts uhd_daemon
      wait 3
      group("rxnode").uhd.u0.rxrate = "8e6"            # set receive chain sampling rate
      group("rxnode").uhd.u0.rxgain = "20"             # set receive chain gain (dB)
      group("rxnode").uhd.u0.numbins = "128"           # set size of fft
      group("rxnode").uhd.u0.avgwinlen = "32"          # set averaging window size for each fft bin across time.  
      group("rxnode").uhd.u0.omlfile = "spectrum.grid" # oml database file name to store fft data
      group("rxnode").uhd.u0.omlserver = "idb2:3003"   # oml server
      group("rxnode").uhd.u0.record                    # start recording thread
      ( { |i|                   # set up loop
        cf = property.rxfreq + (property.rxstep*i)     # compute next carrier frequency
        group("rxnode").uhd.u0.rxfreq = cf             # set receive chain carrier frequency (Hz)
        wait property.dwell                            # wait for number of seconds before computing next frequency
      group("rxnode").uhd.u0.stop                      # stop recording thread
      allGroups.uhd.u0.deactivate                      # stop uhd_daemon
      info "Finish it."

Execute script and view recorded data

  • To run the experiment script:
    nilanjan@console.grid:~/UHD$ omf exec uhd_exp1.rb
  • Once the script finishes, check the contents of the database file on specified oml server and directory. The data should be recorded in spectrum.grid.sq3.
    nilanjan@console.grid:~/UHD$ ssh idb2
    nilanjan@idb2:~$ cd /var/lib/oml2
    nilanjan@idb2:/var/lib/oml2$ ls -l spectrum.grid.sq3
    -rw-r--r-- 1 oml2 oml2 753561600 May 14 10:41 spectrum.grid.sq3
  • Dump the contents of spectrum.grid.sq3 to have a quick look inside the sql file.
    nilanjan@idb2:/var/lib/oml2$ sqlite3 spectrum.grid.sq3 ".dump"
  • The magnitude value of the fft bins are stored in binary format. The first entry of the db file is shown below. So when dumping the file contents the ftt bins data is shown as consecutive ascii representation of the binary floating point numbers.
  • 5/15/2013 - Work in progress...

Attachments (6)

Download all attachments as: .zip