Simon,
Just wanted to touch base, as not to leave you in the dark.
I had a bit of a busy week and didn't get as far as I hoped with the thread safety items; I'm aiming to have the libbladeRF changes and associated test(s) available in master the end of the weekend, and will plan to post back here Sunday night with a status.
If you're happy waiting until then to get back to anything bladeRF-related, you can just ignore the rest of this post. Otherwise, you may find some of the below information helpful or interesting. I will probably not be around much to answer questions on the below items, as I will want to remain focused on the items promised above.
Since the last post...
- We've tagged another release candidate that's a cleanup of some bugs, so you may want to update to that in the near future.
- A firmware update is available to address a fix that caused stale samples left over in the first few buffers of data.
- An FPGA update is available to fix a defect in the reading back of IQ correction values.
- The Getting Started: Windows guide has been updated to recommend libusb 1.0.19, and the Verifying Basic Device Functionality wiki content has been moved to a common, more OS-agnostic page, with some more information about just testing a few operations in the bladeRF-cli program.
Regarding using the XB-200 in test programs...
libbladeRF_test_sync may soon be replaced by functionality present in the bladeRF-cli, which allows you to tune tune the lower ranges after running,
xb enable 200. Specificically, a community member is working on having the CLI use those sync functions instead of the async ones. If that turns out not to get merged in soon, I will add an
--xb200 option to
libbladeRF.
The
libbladeRF_test_ctrl program that currently gets built with libbladeRF basically just exercises the "control and configuration" functions (e.g., the accesssor functions for knobs like gain, bandwidth, loopback mode, etc). This has an
--xb200 to indicate that the tests should be run with the XB-200 enabled.
Below the invocation and contents of log.txt from running this on my Windows machine. Don't worry about the [Warning] messages about the samplerate rounding errors -- this is harmless and we'll be making that a "debug" output (that wouldn't show up here), rather than a warning in an upcoming commit. You should only be concerned if you see [Error] messages or non-zero failure counts at the end.
Note that this output is on a device running the new firmware and FPGA mentioned above. If you do not run FPGA v0.0.6, you will see a high failure count in the "correction" tests.
Code: Select all
C:\Users\Jon\Documents\projects\bladeRF\host\build\output\Debug\libbladeRF_test_ctrl.exe --xb200 > log.txt
test_sampling: Setting and reading back sampling modes...
test_lpf_mode: Setting and reading back RX LPF modes...
test_lpf_mode: Setting and reading back TX LPF modes...
test_enable_module: Enabling and disabling modules...
test_loopback: Setting and checking loopback modes...
test_xb200: Setting and reading back filter bank settings...
test_xb200: Setting and reading back path settings...
test_correction: Sweeping RX corrections...
I DC offset
Q DC offset
Phase
Gain
test_correction: Random RX corrections...
I DC offset
Q DC offset
Phase
Gain
test_correction: Sweeping TX corrections...
I DC offset
Q DC offset
Phase
Gain
test_correction: Random TX corrections...
I DC offset
Q DC offset
Phase
Gain
test_samplerate: Sweeping RX sample rates...
Sample rate currently set to 39580000 Hz...
test_samplerate: Applying random RX sample rates...
Sample rate currently set to 16264520 Hz...
test_samplerate: Applying random RX rational sample rates...
Sample rate currently set to 16429220 3543 /21836 Hz...
test_samplerate: Sweeping TX sample rates...
Sample rate currently set to 39580000 Hz...
test_samplerate: Applying random TX sample rates...
Sample rate currently set to 17750480 Hz...
test_samplerate: Applying random TX rational sample rates...
Sample rate currently set to 9791200 8902 /15513 Hz...
test_bandwidth: Sweeping RX bandwidths...
test_bandwidth: Applying random RX bandwidths...
test_bandwidth: Sweeping TX bandwidths...
test_bandwidth: Applying random TX bandwidths...
test_gain: Performing gain sweep...
TXVGA1
TXVGA2
LNA
RXVGA1
RXVGA2
test_gain: Applying random gains...
TXVGA1
TXVGA2
LNA
RXVGA1
RXVGA2
test_frequency: Performing RX frequency sweep...
Currently tuned to 3750000000 Hz...
test_frequency: Performing random RX tuning..
Currently tuned to 1538458020 Hz...
test_frequency: Performing TX frequency sweep...
Currently tuned to 3750000000 Hz...
test_frequency: Performing random TX tuning...
Currently tuned to 175694550 Hz...
Failure counts
--------------------------------------------
sampling 0
lpf_mode 0
enable_module 0
loopback 0
xb200 0
correction 0
samplerate 0
bandwidth 0
gain 0
frequency 0
Regarding the current state of thread-safety
Again, you may rather just wait until the end of the weekend than spend any further time with any of this. I just wanted to elaborate on a few items...
It is already possible to use the async and sync interfaces without any risk of race conditions,
if you follow some guidelines noted in the
async section of the docs. You shouldn't have to shut down the sync interface to change frequency, gains, bandwidth, samplerate, etc.
For example, we are happily streaming data (both half and full duplex) while concurrently tuning frequency, gains, bandwidth, etc. in the
gr-osmosdr's bladeRF support. (One can see view FFTs or waterfalls while changing parameters via their osmocom_fft program).
The general guidelines are as follows:
- Have a separate "control" thread and a separate "data thread".
- The "control" thread only calls the functions to tune freq, set gains, etc. This thread must not make bladerf_sync_* calls.
- The "data thread" only calls the bladerf_sync_ calls. This thread must not attempt to call any other API functions.
Under the hood, the data and control functions are specifically crafted to allow for this.
With that said, the above stipulations have confused people, and hence, we'll be adding more thread-safety guarantees in the API.
Enjoy your weekend,
Jon