Extending the bladeRF Sample Rate
The 2023.02 release adds the capability of extending the bladeRF’s sampling rate and the addition of 8-bit mode. This update takes advantage of the hidden AD9361 overclocking feature and overcomes the throughput limitation by adopting a new multi-sample packing architecture. The following features have been added.
- AD9361 Overclock to 122.88MSPS IQ samples
- 8-bit Mode Support: LibbladeRF and FPGA
- 8-bit Mode Support: BladeRF CLI
- 8-bit Mode Support: OsmoSDR and gr-bladeRF
generate` function added to CLI
NOTE: Please note to use the Nuand gr-osmosdr fork from https://github.com/Nuand/gr-osmosdr . For instructions follow the latest Nuand PyBOMBS installation guide .
The AD9361 Overclock
An interesting discovery was made whereby the AD9361 can have some of its half band filters bypassed to allow higher sample rate samples to come out. To achieve this, several registers have to be configured which ultimately doubles the maximum TX and RX sample rates to 122.88MHz. This newly found feature piqued our interest and forged our goal to extend the sampling rate of the bladeRF micro 2.0.
The AD9361 TX and RX overclock is enabled when register 0x54 is assigned to register 0x003, which leads to disabling a half band filter, setting decimation to 1, and enabling filter bypass. The extended sampling rate was confirmed by measuring the frequency of the AD9361 data clock after the register write. When oversampling is active, this register configuration is set along with some specific gain, calibration, miller cap, and BBF cap adjustments. Information on how to enable 8-bit mode is explained in the CLI and GNU Radio block sections below. As is typical with overclocks, please bear in mind system stability may be affected. In our testing, we found the system to be quite stable. Fortunately, it appears that only a small portion of the chip runs at a faster rate, which is still lower than the AD9361’s ADCs default sampling rate.
libbladeRF and FPGA 8-bit Mode Support
To take advantage of the higher sampling rate, the maximum USB throughput of the bladeRF had to be extended by introducing an 8-bit bladeRF format. Therefore, BLADERF_FORMAT_SC8_Q7 and BLADERF_FORMAT_SC8_Q7_META were added. These modes are now available even in normal AD9361 modes as well.
These formats allow libbladeRF to work with an 8-bit sample buffer as it would with 16-bit samples. Furthermore, these modes also support applications that want a higher sampling rate but are limited by the USB 2.0 bandwidth.
We decide that introducing an 8-bit mode enable signal would be sufficient to notify the rest of the FPGA when an 8-bit format has been assigned to a streaming interface. When the FPGA receives an 8-bit enable from libbladeRF through the NiOS core, the FPGA becomes responsible for the 8-bit sample packing. The samples need to be converted and exchanged between the 64-bit TX/RX FIFO bus and the 12-bit I and Q AD9361 ports. The tables below show how the samples are packed between 16-bit and 8-bit formats within the FIFO.
16-bit FIFO Bus
8-bit FIFO Bus
fifo_reader and fifo_writer within the HDL sample architecture manage sample packing. Typically in 16-bit formats, the 4 most significant bits sign extend the lower 12 least significant bits (LSBs). The 12 LSBs are exchanged with the AD9361 to provide IQ samples to the transceiver. With an 8-bit format, only the top 8 MSBs are exchanged with the AD9361.
The secret sauce between sample formats is that 8-bit mode takes two data clock cycles to finish a sample exchange between the RX/TX FIFO and the AD9361. This allowed us to double the sampling rate while making a minimal impact to the HDL and software architecture as a whole. It also allowed us to add a new feature to existing bladeRF 2.0 micros!
bladeRF CLI Support
bladeRF-cli served as an 8-bit mode development tool, starting with the addition of the `
bitmode` command. The bladeRF-cli `
bitmode` has two settings, including `
16bit` and `
8bit`. These modes dictate the results of a few CLI functions. Commands, like the newly added `
set`, and `
rx` are now all dependent on the `
bitmode` state. `
bitmode` can be set simply by running `
set bitmode < 8bit | 16bit >`.
set samplerate` command has changed under the hood with this CLI update. It now sets the overclock and determines whether to halve the sampling rate before calling the streaming interface which is required to overclock. Note that after `
bitmode` has been assigned, `
set samplerate` will have to be reset to apply the overclock.
generate` function produces a known CW or noise figure based on the current sample rate and `
bitmode` state. To generate a CW with which to debug, provide the output file format and a sample rate divisor (from the sample rate) to generate the sample file. And likewise, for a pseudorandom noise figure (PRN), provide the output file format and the number of samples. The current `
bitmode` will dictate the magnitude of these outputs if not manually set. The troubleshooting or test opportunities with `
generate` are vast, so enjoy!
TX and RX had to change how samples were handled as well. The TX and RX commands now have to adapt to `
bitmode` for translation between CSV files or binary upon read read and write.
OsmoSDR and gr-bladeRF Support
The CLI is the go-to-tool, but gr-bladeRF and gr-osmosdr are essential tools for using the bladeRF in the GNU Radio ecosystem. To add support to the GNURadio ecosystem, each respective bladeRF module has been modified for 8-bit mode support.
We wanted the user to set the sample format to 8-bit and everything else that was dependent on it to be selected and configured automatically. Our solution was to add Feature and a Sample Format drop down options within the bladeRF Source and Sink blocks. The Feature setting enables the bladeRF 2.0 micro to go to the higher sampling rates. The Sample Format is used as a flag at runtime to determine the mode of the bladeRF; it is very similar in concept to what happens in the CLI.
This functionality has also been added to OsmoSDR, enabling 8-bit mode support within gr-osmosdr and OsmoSDR dependent applications such as GQRX. gr-bladeRF features a nice GUI dropdown to configure options. Enabling these options in gr-osmosdr can be done by setting the device string just like most other bladeRF settings. Please try “
bladerf=0,sample_format=8,feature=oversample” as the device string for gr-osmosdr and in GQRX.
One of the most useful applications of the extended sampling rate resides around 2.4GHz. The GQRX demonstration below picks up on the FHSS Bluetooth activity across all 79 BT channels.
There is a software upgrade waiting for you if you have a bladeRF micro 2.0! It extends the sampling rate and adds 8-bit formats to instantaneously see cool things like the entirety of all Bluetooth. Try it out using our updated CLI, FPGA image, and GNU Radio tools. Let us know what you think in the Nuand forums or Slack channel !
A special thanks to
Thank you Cellwizard for discovering and prototyping this AD9361 hack, and bringing it to our attention!