Hi Brian,
The sample data sent to and received from the bladeRF are
IQ components. There are some links to a couple good articles on the topic of quadrature signals
on the wiki.
As far as the "best way" to receive and transmit samples, I'd say the answer is largely dependent on what you're ultimately looking to do and what tools and skills you have at your disposal. As it's a broad question with lots of possible answers, I'll do my best to provide a broad answer, with some hope that my thoughts here can be re-used this when writing up more documentation in the near future.
I hope you'll find something here useful. Without further ado, here's a classic "long-winded jynik answer!"
libbladeRF
The primary way to interact with the device programmatically via a host machine is through
libbladeRF, which has a C API. I haven't had time to test drive it lately, but I know michelp is working on
bladeRF Python bindings.
So if you want to write C code, you'll want to take a look at the
libbladeRF API docs. More specifically, you'll want to look at the
synchronous data transmission and reception functions.
I will be committing a better description of the "SC16Q11" format described in the aforementioned docs soon. For now, here's a quick copy/paste of the patch:
Code: Select all
/**
* Signed, Complex 16-bit Q11. This is the native format of the DAC data.
*
* Values in the range [-2048, 2048) are used to represent [-1.0, 1.0).
* Note that the lower bound here is inclusive, and the upper bound is
* exclusive. Ensure that provided samples stay within [-2048, 2047].
*
* Samples consist of interleaved IQ value pairs, with I being the first
* value in the pair. Each value in the pair is a right-aligned,
* little-endian int16_t. The FPGA ensures that these values are
* sign-extended.
*
* When using this format the minimum required buffer size, in bytes, is:
* <pre>
* buffer_size_min = [ 2 * num_samples * sizeof(int16_t) ]
* </pre>
*
* For example, to hold 2048 samples, a buffer must be at least 8192 bytes
* large.
*/
bladeRF-cli
bladeRF-cli is program built atop libbladeRF. It is primarily intended as a development and debugging tool that exposes libbladeRF functionality in a command-line interface. You can use this to configure the device, as well as transmit/receive samples to CSVs or binary files.
Generally, I use bladeRF-cli in conjunction with
Octave.
For example, to receive a ~2 seconds of data to a CSV file:
Code: Select all
$ bladeRF-cli -i
bladeRF> set samplerate rx 1M
Setting RX sample rate - req: 1000000 0/1Hz, actual: 1000000 0/1Hz
bladeRF> rx config file=~/Desktop/samples.csv format=csv n=2M
bladeRF> rx start
bladeRF> rx wait
bladeRF> quit
Then, I'll read in the samples into Octave to analyze them further. For example, he's a few commands to read in the above CSV and plot the magnitude of a signal over time.
Code: Select all
octave> samples = load('/home/jon/Desktop/samples.csv');
octave> signal = (samples(:,1) + i * samples(:,2)) ./ 2048.0;
octave> magnitude_db = 20 * log10(abs(signal));
octave> num_points = size(magnitude_db)(1);
octave> samplerate = 1e6;
octave> time = linspace(0, num_points - 1, num_points) ./ samplerate;
octave> plot(time, magnitude_db);
octave> xlabel('Time (s)')
octave> ylabel('dB')
octave> title('OOK signal from a 433MHz temperature sensor')
octave> axis([0 1.25 -30 0])
Below is a plot from some captured samples being transmitted by
this wireless thermometer:
FWIW, it looks more like this after a little more work in Octave (it's very zoomed in, x axis is in units of samples @ 1Msps):
GNU Radio
The bladeRF interfaces with
GNU Radio via
gr-osmosdr. With GNU Radio, you can quickly connect and configure various modules in order to generate, transmit, receive, (de)modulate and process signals.
GNU Radio Companion presents a GUI for doing this.
There's a bunch of awesome projects and example flowgraphs out there already, so I won't continue on this point. He's
one example posted on this forum.
Other software
There's a bunch of other cool software that you'll see people chatting about around here. Here's just a few that provide the ability to listen to demodulated audio, among other neat features... my apologies if I've forgotten anyone's favorite program.
For more info, be sure to have a look around the
bladeRF wiki and these forums.