libbladeRF  1.7.2
Nuand bladeRF library
Macros | Enumerations | Functions
Gain control

Description

These functions provide control over the device's RX and TX gain stages.

In general, the gains should be incremented in the following order (and decremented in the reverse order).

TX: TXVGA1, TXVGA2

RX: LNA, RXVGA, RXVGA2

These functions are thread-safe.

Macros

#define BLADERF_RXVGA1_GAIN_MIN   5
 
#define BLADERF_RXVGA1_GAIN_MAX   30
 
#define BLADERF_RXVGA2_GAIN_MIN   0
 
#define BLADERF_RXVGA2_GAIN_MAX   30
 
#define BLADERF_TXVGA1_GAIN_MIN   (-35)
 
#define BLADERF_TXVGA1_GAIN_MAX   (-4)
 
#define BLADERF_TXVGA2_GAIN_MIN   0
 
#define BLADERF_TXVGA2_GAIN_MAX   25
 
#define BLADERF_LNA_GAIN_MID_DB   3
 
#define BLADERF_LNA_GAIN_MAX_DB   6
 

Enumerations

enum  bladerf_lna_gain { BLADERF_LNA_GAIN_UNKNOWN, BLADERF_LNA_GAIN_BYPASS, BLADERF_LNA_GAIN_MID, BLADERF_LNA_GAIN_MAX }
 

Functions

API_EXPORT int CALL_CONV bladerf_set_txvga2 (struct bladerf *dev, int gain)
 
API_EXPORT int CALL_CONV bladerf_get_txvga2 (struct bladerf *dev, int *gain)
 
API_EXPORT int CALL_CONV bladerf_set_txvga1 (struct bladerf *dev, int gain)
 
API_EXPORT int CALL_CONV bladerf_get_txvga1 (struct bladerf *dev, int *gain)
 
API_EXPORT int CALL_CONV bladerf_set_lna_gain (struct bladerf *dev, bladerf_lna_gain gain)
 
API_EXPORT int CALL_CONV bladerf_get_lna_gain (struct bladerf *dev, bladerf_lna_gain *gain)
 
API_EXPORT int CALL_CONV bladerf_set_rxvga1 (struct bladerf *dev, int gain)
 
API_EXPORT int CALL_CONV bladerf_get_rxvga1 (struct bladerf *dev, int *gain)
 
API_EXPORT int CALL_CONV bladerf_set_rxvga2 (struct bladerf *dev, int gain)
 
API_EXPORT int CALL_CONV bladerf_get_rxvga2 (struct bladerf *dev, int *gain)
 
API_EXPORT int CALL_CONV bladerf_set_gain (struct bladerf *dev, bladerf_module mod, int gain)
 

Macro Definition Documentation

#define BLADERF_LNA_GAIN_MAX_DB   6

Gain in db of the LNA at max setting

Definition at line 567 of file libbladeRF.h.

#define BLADERF_LNA_GAIN_MID_DB   3

Gain in dB of the LNA at mid setting

Definition at line 566 of file libbladeRF.h.

#define BLADERF_RXVGA1_GAIN_MAX   30

Maximum RXVGA1 gain, in dB

Definition at line 536 of file libbladeRF.h.

#define BLADERF_RXVGA1_GAIN_MIN   5

Minimum RXVGA1 gain, in dB

Definition at line 533 of file libbladeRF.h.

#define BLADERF_RXVGA2_GAIN_MAX   30

Maximum RXVGA2 gain, in dB

Definition at line 542 of file libbladeRF.h.

#define BLADERF_RXVGA2_GAIN_MIN   0

Minimum RXVGA2 gain, in dB

Definition at line 539 of file libbladeRF.h.

#define BLADERF_TXVGA1_GAIN_MAX   (-4)

Maximum TXVGA1 gain, in dB

Definition at line 548 of file libbladeRF.h.

#define BLADERF_TXVGA1_GAIN_MIN   (-35)

Minimum TXVGA1 gain, in dB

Definition at line 545 of file libbladeRF.h.

#define BLADERF_TXVGA2_GAIN_MAX   25

Maximum TXVGA2 gain, in dB

Definition at line 554 of file libbladeRF.h.

#define BLADERF_TXVGA2_GAIN_MIN   0

Minimum TXVGA2 gain, in dB

Definition at line 551 of file libbladeRF.h.

Enumeration Type Documentation

LNA gain options

Enumerator
BLADERF_LNA_GAIN_UNKNOWN 

Invalid LNA gain

BLADERF_LNA_GAIN_BYPASS 

LNA bypassed - 0dB gain

BLADERF_LNA_GAIN_MID 

LNA Mid Gain (MAX-6dB)

BLADERF_LNA_GAIN_MAX 

LNA Max Gain

Definition at line 559 of file libbladeRF.h.

Function Documentation

API_EXPORT int CALL_CONV bladerf_get_lna_gain ( struct bladerf *  dev,
bladerf_lna_gain gain 
)

Get the LNA gain

Parameters
devDevice handle
gainPointer to the set gain level
API_EXPORT int CALL_CONV bladerf_get_rxvga1 ( struct bladerf *  dev,
int *  gain 
)

Get the pre-LPF VGA gain

Parameters
devDevice handle
gainPointer to the set gain level
API_EXPORT int CALL_CONV bladerf_get_rxvga2 ( struct bladerf *  dev,
int *  gain 
)

Get the post-LPF VGA gain

Parameters
devDevice handle
gainPointer to the set gain level
API_EXPORT int CALL_CONV bladerf_get_txvga1 ( struct bladerf *  dev,
int *  gain 
)

Get the post-LPF gain in dB

Parameters
devDevice handle
gainPointer to returned gain
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_get_txvga2 ( struct bladerf *  dev,
int *  gain 
)

Get the PA gain in dB

Parameters
devDevice handle
gainPointer to returned gain
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_set_gain ( struct bladerf *  dev,
bladerf_module  mod,
int  gain 
)

Set combined gain values

This function computes the optimal LNA, RXVGA1, and RVGA2 gains for a requested amount of RX gain, and computes the optimal TXVGA1 and TXVGA2 gains for a requested amount of TX gain.

Values outside the valid gain range will be clipped.

Parameters
devDevice handle
modModule
gainDesired gain
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_set_lna_gain ( struct bladerf *  dev,
bladerf_lna_gain  gain 
)

Set the LNA gain

Parameters
devDevice handle
gainDesired gain level
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_set_rxvga1 ( struct bladerf *  dev,
int  gain 
)

Set the pre-LPF VGA gain

Values outside the range of [ BLADERF_RXVGA1_GAIN_MIN, BLADERF_RXVGA1_GAIN_MAX ] will be clamped.

Parameters
devDevice handle
gainDesired gain
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_set_rxvga2 ( struct bladerf *  dev,
int  gain 
)

Set the post-LPF VGA gain

Values outside the range of [ BLADERF_RXVGA2_GAIN_MIN, BLADERF_RXVGA2_GAIN_MAX ] will be clamped.

Parameters
devDevice handle
gainDesired gain
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_set_txvga1 ( struct bladerf *  dev,
int  gain 
)

Set the post-LPF gain in dB

Values outside the range of [ BLADERF_TXVGA1_GAIN_MIN, BLADERF_TXVGA1_GAIN_MAX ] will be clamped.

Parameters
devDevice handle
gainDesired gain
Returns
0 on success, value from Error codes list on failure
API_EXPORT int CALL_CONV bladerf_set_txvga2 ( struct bladerf *  dev,
int  gain 
)

Set the PA gain in dB

Values outside the range of [ BLADERF_TXVGA2_GAIN_MIN, BLADERF_TXVGA2_GAIN_MAX ] will be clamped.

Parameters
devDevice handle
gainDesired gain
Returns
0 on success, value from Error codes list on failure