Blade RF Soapy Support -- with Timestamps!

A new Soapy SDR module is available for the Blade RF from Nuand. The Soapy Blade RF module supports the Blade RF timestamped streams and most of the configuration capabilities. As a consequence, timestamped streaming with Blade RF is now automatically supported in platforms like Pothos and GNU Radio, and for anyone else using the Soapy SDR API.

Soapy Osmo project

The Blade RF has had Soapy SDR support for a while under the Soapy Osmo project. The gr-osmosdr bindings were a quick and easy way to get Soapy SDR support for a bunch of devices, since many of the device out there were already abstracted under one API. The osmosdr API is pretty good, but it lacks support for timestamped streams. And since timestamped streams is a notable feature of the Blade RF, I wanted to make sure that users would have access to it.

Blade RF API

The Blade RF API was a pleasure to work with. All the functions you would ever need are encapsulated within libbladeRF.h. The function calls were well documented with all of the little intricacies and side effects mentioned. And as far as C libraries go, I think it definitely has the right structure to it.

Streaming: There is actually more than one stream API available: synchronous and asynchronous. The asynchronous API looks a bit like a mirror of the underlying libusb AIO API: You register a callback which gets passed a buffer to process and release. Anyway, since the Soapy SDR stream calls where already synchronous, I went with the synchronous API as it was probably a better fit.

Measure Delay demo

Soapy SDR comes with a handle little python app that uses a device's timestamps to measure the delay of a pulse through the device (in a loopback fashion). See MeasureDelay.py

python MeasureDelay.py --dumpDir=/tmp --rate=10e6 --freq=2.5e9 --rxGain=30 --txGain=20

[INFO] bladerf_open_with_devinfo()
[INFO] setSampleRate(1, 10.000000 MHz), actual = 10.000000 MHz
[INFO] setSampleRate(0, 10.000000 MHz), actual = 10.000000 MHz
Actual Rx Rate 10.000000 Msps
Actual Tx Rate 10.000000 Msps
Create Rx and Tx streams
>>> Time delta 1.299000 us
Cleanup streams
Done!
[INFO] bladerf_close()

A pulse is transmitted at a time T in the near future:

The app begins an RX acquisition that overlaps some time before and after T. Then using the received timestamp and the position of the pulse, a delay is determined:

Its not much, but it shows that the timestamps are working!

Implementation details

Soapy SDR has a concept of device time in nanoseconds. This time reference is used to set and get the device time, and well as used to time transmit and receive streams. However, in the BladeRF, time is expressed as separate counters for the RX and TX that run at the sample rate. I wanted to be able to give users the illusion of a device time so timestamps coming from the RX stream could be used on the transmit stream.

  • To set the device time, I simply issue a reset to both counters and store the desired time delta
  • The device time can be computed from the time delta, current rx counter, and rx sample rate
  • We can do the same to translate device time to internal RX or TX time as well

Hamster for scale

(Hammie inspects the packaging)

Last edited: Tue, Jul 14 2015 - 06:15PM