UHD Examples

I recently added a couple of GNU Radio examples that use the UHD interface to the USRP devices. We have been lacking any examples of using the UHD interface, and these new apps are two of the more commonly used apps we have, so I wanted to provide some support as people migrate to UHD-only GNU Radio programs.

You can find these new apps in the source tree under gr-uhd/apps. They are:


  • uhd_fft.py: a simple spectrum analyzer program to display a received signal in a WX GUI. You can set the frequency, bandwidth, gain, and antenna, and you can display an FFT, waterfall, or time domain (oscilloscope) plot, where the FFT is the default.
  • uhd_rx_cfile.py: this is a simple script that stores all received samples to a file. Again, you can set parameters like the frequency, bandwidth, gain, and antenna port. You can also save samples as complex shorts (16 bit I&Q). You have to provide the name of the file to save the samples to, and you can either let it run until you stop it or provide a maximum number of samples to capture.


These should help us with a few things. First, it will give people who want to write programs with UHD a few examples of what to do, especially if they want to convert another program that we have to using the UHD interface. It will also help us reduce our dependency on the other "legacy" interfaces to USRPs and USRP2s.

Right now, gr-utils depends on gr-usrp, and we want to remove this dependency. Instead, I would rather see each gr-<interface> have an "apps" directory that contain applications using that particular interface. Doing this is going to mean a lot of duplication of code, but that's unavoidable until we construct some kind of hardware abstraction layer.

As a side note, one of the reasons we have been putting off making these kinds of apps is that we had envisioned re-imagining of some of them into full-blown programs. Instead of a uhd_fft.py, we wanted something like a gr_spectrum_analyzer that would provide all sorts of neat bells and whistles and look and feel more like a digital implementation of a spectrum analyzer. However, this is going to take time that no one really has right now. So I just made the decision to go and do these simple applications to get the ball rolling.