You're correct - what you're seeing is DC offset. The LMS6002D on the bladeRF can inject some opposite voltages to compensate for this, and you can "tune" this via the
bladerf_set_correction(). Note that the magnitude of this DC offset is going to change with gain and frequency settings.
In general, you'll want to run the LMS6 DC calibrations first before using the aforementioned function to dial in the correction values, via
bladerf_calibrate_dc() for
each of the following LMS6002 modules: BLADERF_DC_CAL_LPF_TUNING, BLADERF_DC_CAL_TX_LPF, BLADERF_DC_CAL_RX_LPF, BLADERF_DC_CAL_RXVGA2.
As far as the bladeRF-cli goes, this procedure looks like:
Code: Select all
# Set the desired frequency and gain settings. For simplicity, we assume other
# parameters that do not affect DC offset (e.g., samplerate, bandwidth) are already
# configured.
bladeRF> set frequency tx 921M
Set TX frequency: 921000000Hz
bladeRF> set txvga1 -8
TXVGA1 Gain: -8 dB
bladeRF> set txvga2 0
TXVGA2 Gain: 0 dB
# Perform all the internal LMS6 calibrations, (i.e., each of the items associated
# with bladerf_calibrate_dc())
bladeRF> cal lms
Calibrating LMS LPF tuning module...
LPF tuning module: 23
Calibrating LMS TX LPF modules...
TX LPF I filter: 33
TX LPF Q filter: 43
Calibrating LMS RX LPF modules...
RX LPF I filter: 33
RX LPF Q filter: 17
Calibrating LMS RXVGA2 modules...
RX VGA2 DC reference module: 25
RX VGA2 stage 1, I channel: 33
RX VGA2 stage 1, Q channel: 30
RX VGA2 stage 2, I channel: 35
RX VGA2 stage 2, Q channel: 33
# Attempt to automatically find correction values that minimize DC offset
bladeRF> cal dc tx
TX DC I Setting = -81, error ~= 2.031774
TX DC Q Setting = 276, error ~= 1.671806
As you see, there may be some residual error if the correction value adjustments are too simply coarse. If you want to continue to adjust this manually in the CLI, one thing you can do is transmit a file of 0+0j and tweak the correction settings while you run. If you're in linux, it's sufficient to use /dev/zero. If you're in Windows, you'll need to find a way to generate a file full of zeros.
Code: Select all
bladeRF> tx config file=/dev/zero repeat=0;
bladeRF> tx start
bladeRF> cal dc tx -64 256
bladeRF> tx stop
bladeRF> cal dc tx -96 320
bladeRF> tx stop
If you're using GNU Radio gr-osmosdr blocks, be aware that you'll need to set the "DC Offset Mode" to "Manual." If you have it set to "Off" it will zeroize these correction values, overwriting your settings.
For an upcoming release, I'm working on cleaning up and improving some shortcomings and issues with this calibration. Hopefully that will be out soon after the holidays.
By the way, I have a quick and dirty little tool for on-off keying that might be of interest to you:
OOKiedokie
Cheers,
Jon