libbladeRF  1.7.2
Nuand bladeRF library
Enumerations | Functions
Corrections and calibration

Description

This group provides routines for performing calibration and applying corrections. These functions are thread-safe.

The automatic DC correction used by the bladeRF-cli is not part of this API, but it is implemented using libbladeRF. This automatic DC calibration code is available here under an "MIT" license.

Enumerations

enum  bladerf_cal_module {
  BLADERF_DC_CAL_INVALID = -1, BLADERF_DC_CAL_LPF_TUNING, BLADERF_DC_CAL_TX_LPF, BLADERF_DC_CAL_RX_LPF,
  BLADERF_DC_CAL_RXVGA2
}
 
enum  bladerf_correction { BLADERF_CORR_LMS_DCOFF_I, BLADERF_CORR_LMS_DCOFF_Q, BLADERF_CORR_FPGA_PHASE, BLADERF_CORR_FPGA_GAIN }
 
enum  bladerf_vctcxo_tamer_mode { BLADERF_VCTCXO_TAMER_INVALID = -1, BLADERF_VCTCXO_TAMER_DISABLED = 0, BLADERF_VCTCXO_TAMER_1_PPS = 1, BLADERF_VCTCXO_TAMER_10_MHZ = 2 }
 

Functions

API_EXPORT int CALL_CONV bladerf_set_correction (struct bladerf *dev, bladerf_module module, bladerf_correction corr, int16_t value)
 
API_EXPORT int CALL_CONV bladerf_get_correction (struct bladerf *dev, bladerf_module module, bladerf_correction corr, int16_t *value)
 
API_EXPORT int CALL_CONV bladerf_set_vctcxo_tamer_mode (struct bladerf *dev, bladerf_vctcxo_tamer_mode mode)
 
API_EXPORT int CALL_CONV bladerf_get_vctcxo_tamer_mode (struct bladerf *dev, bladerf_vctcxo_tamer_mode *mode)
 
API_EXPORT int CALL_CONV bladerf_dac_write (struct bladerf *dev, uint16_t val)
 
API_EXPORT int CALL_CONV bladerf_dac_read (struct bladerf *dev, uint16_t *val)
 

Enumeration Type Documentation

DC Calibration Modules

Definition at line 1844 of file libbladeRF.h.

Correction parameter selection

These values specify the correction parameter to modify or query when calling bladerf_set_correction() or bladerf_get_correction(). Note that the meaning of the value parameter to these functions depends upon the correction parameter.

Enumerator
BLADERF_CORR_LMS_DCOFF_I 

Adjusts the in-phase DC offset via controls provided by the LMS6002D front end. Valid values are [-2048, 2048], which are scaled to the available control bits in the LMS device.

BLADERF_CORR_LMS_DCOFF_Q 

Adjusts the quadrature DC offset via controls provided the LMS6002D front end. Valid values are [-2048, 2048], which are scaled to the available control bits.

BLADERF_CORR_FPGA_PHASE 

Adjusts FPGA-based phase correction of [-10, 10] degrees, via a provided count value of [-4096, 4096].

BLADERF_CORR_FPGA_GAIN 

Adjusts FPGA-based gain correction value in [-1.0, 1.0], via provided values in the range of [-4096, 4096].

Definition at line 1861 of file libbladeRF.h.

VCTCXO Tamer mode selection

These values control the use of header J71 pin 1 for taming the on-board VCTCXO to improve or sustain frequency accuracy.

When supplying input into the VCTCXO tamer, a 1.8V signal must be provided.

IMPORTANT: Exceeding 1.8V on J71-1 can damage the associated FPGA I/O bank. Ensure that you provide only a 1.8V signal!

Enumerator
BLADERF_VCTCXO_TAMER_INVALID 

Denotes an invalid selection or state

BLADERF_VCTCXO_TAMER_DISABLED 

Do not attempt to tame the VCTCXO with an input source.

BLADERF_VCTCXO_TAMER_1_PPS 

Use a 1 pps input source to tame the VCTCXO.

BLADERF_VCTCXO_TAMER_10_MHZ 

Use a 10 MHz input source to tame the VCTCXO.

Definition at line 1902 of file libbladeRF.h.

Function Documentation

API_EXPORT int CALL_CONV bladerf_dac_read ( struct bladerf *  dev,
uint16_t *  val 
)

Read value from VCTCXO trim DAC.

This is similar to bladerf_get_vctcxo_trim(), except that it returns the current trim DAC value, as opposed to the calibration value read from flash.

Use this if you are trying to query the value after having previously made calls to bladerf_dac_write().

Parameters
[in]devDevice handle
[out]valValue to read from VCTCXO trim DAC
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_dac_write ( struct bladerf *  dev,
uint16_t  val 
)

Write value to VCTCXO trim DAC.

This should not be used when the VCTCXO tamer is enabled.

Parameters
devDevice handle
valValue to write to VCTCXO trim DAC
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_get_correction ( struct bladerf *  dev,
bladerf_module  module,
bladerf_correction  corr,
int16_t *  value 
)

Obtain the current value of the specified configuration parameter

Parameters
[in]devDevice handle
[in]moduleModule to retrieve correction information from
[in]corrCorrection type
[out]valueCurrent value
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_get_vctcxo_tamer_mode ( struct bladerf *  dev,
bladerf_vctcxo_tamer_mode mode 
)

Get the current VCTCXO tamer mode

Parameters
[in]devDevice handle
[out]modeCurrent VCTCXO taming mode or BLADERF_VCTCXO_TAMER_INVALID if a failure occurs.
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_set_correction ( struct bladerf *  dev,
bladerf_module  module,
bladerf_correction  corr,
int16_t  value 
)

Set the value of the specified configuration parameter

See the bladerf_correction description for the valid ranges of the value parameter.

Parameters
devDevice handle
moduleModule to apply correction to
corrCorrection type
valueValue to apply
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_set_vctcxo_tamer_mode ( struct bladerf *  dev,
bladerf_vctcxo_tamer_mode  mode 
)

Set the VCTCXO tamer mode.

Parameters
devDevice handle
modeVCTCXO taming mode
Returns
0 on success, value from Error codes list on failure