Example Code

Waveform Generation and Baseband Spectrum Analysis Soft Front Panel for USRP RIO

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • RF|Wireless


  • LabVIEW


  • NI RF Device Drivers

    Operating System

  • Windows

    Programming Language

  • LabVIEW G

Code and Documents


Download All


A quick video on the application:


This example is a short demonstration of the waveform transmit and receive capability of NI USRP devices. The application is designed to have a familiar feeling to users of traditional RF instrumentation. The application reacts to parameter changes on both TX and RX side dynamically. It was tested with NI USRP-2954R and NI USRP-2974 devices.


The transmit (TX) part of the application features CW and IQ waveform playback , on both  RF channels. The RFmx Waveform Creator may be used for creating a custom baseband signal, moreover text-based IQ files (*.csv, *.txt, *.iq) are supported. There is an option to transmit a custom IQ signal continuously, or as a burst-like signal (Finite Playback Mode). With the latter option, it is possible to define how many packets are sent over the RF channel.


The receiving (RX) part offers the possibility to visualize the spectrum and the power versus time graphs for received and down converted IF signals. It is possible, to set the LO frequency and the bandwidth of the IF signal, among other settings. Receiving signals are possible on both RF 0 and RF 1 ports of the USRP device.



Figure 1: System description


For further developing baseband waveforms, a utility application named “IQ BB Waveform Utility.vi” can also be found in this project. With it, the user can display the IQ Power Spectrum of the input waveform file, experiment with digital amplitude scaling, and even have the possibility to save the waveform as an IQ-file, or have it as a LabVIEW array output.



Figure 2: IQ Baseband Waveform Utility





How to Use

  • Installation:

    • LabVIEW 2018 64-bit or later.
    • NI-USRP 19.5 or later.
    • Download and extract USRP-VSG-demo.zip
    • Open the USRP-VSG-Streaming-demo.lvproj project file in LabVIEW
    • Open USRP VSG demo.vi
  • Transmit RF Signals

    • Check device configuration on „USRP Settings” tab
    • Run application
    • Navigate to „RF 0 TX” and/or „RF 1 TX” tab
    • To generate a CW signal:
      • Set the „Frequency [Hz]” control value to the desired value between the hardware limitations of the USRP device
      • Set “Full Scale Power (dBm)” to the desired value
      • Click the “RF OFF” button to enable the desired channel(s)
    • To generate an ARB (Arbitrary) signal:
      • Set the „Frequency [Hz]” control value, to the desired LO frequency you want to use for mixing your IF signal into the RF domain
      • Set “Full Scale Power (dBm)” to the desired output power of the scaled waveform
      • Click the “RF OFF” button
      • Click the “Modulation OFF” button, to enable ARB waveform playback
      • Select the IQ file containing the waveform definition in the “Modulation Description File” edit line
        • Enter the “Sample Rate” if chosen IQ file is in text-based format (.csv, .iq, .txt)
        • Currently TDMS files created with the RFmx Waveform Creator and text-based IQ files are supported (user created, check “IQ BB Waveform Utility.vi” for help)
      • Select “Playback Mode
        • For continuous transmission select “Continuous” option
        • Use “Finite” for burst-like operation
        • Set “Playback count” to setup packet count to transmit
          • Note: Enter -1 for non-stop Finite transmission.
        • Remaining packets count is visible in “Packets to TX” indicator
        • Click “Play Finite” to replay
    • Note: Apart from USRP Device Configurations, all controls are dynamically modifiable at runtime.

  • Receive RF Signals

    • Check device configuration on „USRP Settings” tab
    • Run application (if not already running)
    • Navigate to „RF 0 RX” and/or „RF 1 RX” tab
    • Select RX port from the “RX channel selector” drop-down menu
    • Select “Fc (Hz)” as LO frequency for the down conversion (center frequency of the “BB Spectrum” graph)
    • Select “IQ BW (S/s)” to set baseband (IF) signal bandwidth
      • Note: “RF BW (Hz)” indicates the maximum usable bandwidth given the “IQ BW (S/s)” value. This is due to an internal filter roll-off.
    • Select “Bin Width (Hz)” to define FFT resolution
      • Note: A good way to check application performance, is to look at the “Generation / Receiving Loop Timer” in the “USRP Settings” tab. If values are around 200 ms, consider choosing a higher “Bin Width (Hz)” value to ensure smooth operation.
    • Set “Reference Level (dBm)” to be able to capture full dynamic range
      • Note: Consider choosing value above highest signal peak power.
    • Press “RX OFF” to enable channel
    • Use “Autoscale” to scale display
      • Note: Use graph palette to interact with graph display.
    • Note: Apart from USRP Device Configurations, all controls are dynamically modifiable at runtime.


  • IQ BB Waveform Utility

    • Display Waveforms
      • Open the USRP-VSG-Streaming-demo.lvproj project file in LabVIEW
      • Open “IQ BB Waveform Utility.vi
      • Select the path to an IQ waveform file on “TDMS Waveform file path
        • Note: User can select text-based IQ file as well, need to set “IQ file sample rate” control value to be able to display it.
      • Set “Scaling” of the digital IF waveform amplitude
      • Run application
    • Generate IQ file
      • Do as above, until last step
      • Before running application:
        • Click “Create IQ file?” button
        • Select delimiter type from drop-down list
      • Run application
      • Select folder where to save IQ file
      • Set filename ( Best practice: include Sample Rate in file name)




Additional Information

A Windows executable version of the code is also provided in USRP VSG-A Launcher demo.zip

Usage is the same as described above, only exception is that the USRP configuration is done in a launcher window, before executing the application.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.