![]() |
libbladeRF
1.7.2
Nuand bladeRF library
|
These functions provide the ability to tune the RX and TX modules.
See this page for more detailed information about how the API performs this tuning, and for example code snippets.
These functions are thread-safe.
Data Structures | |
struct | bladerf_quick_tune |
Macros | |
#define | BLADERF_FREQUENCY_MIN_XB200 0u |
#define | BLADERF_FREQUENCY_MIN 237500000u |
#define | BLADERF_FREQUENCY_MAX 3800000000u |
#define | BLADERF_RETUNE_NOW 0 |
Enumerations | |
enum | bladerf_tuning_mode { BLADERF_TUNING_MODE_INVALID = -1, BLADERF_TUNING_MODE_HOST, BLADERF_TUNING_MODE_FPGA } |
Functions | |
API_EXPORT int CALL_CONV | bladerf_select_band (struct bladerf *dev, bladerf_module module, unsigned int frequency) |
API_EXPORT int CALL_CONV | bladerf_set_frequency (struct bladerf *dev, bladerf_module module, unsigned int frequency) |
API_EXPORT int CALL_CONV | bladerf_schedule_retune (struct bladerf *dev, bladerf_module module, uint64_t timestamp, unsigned int frequency, struct bladerf_quick_tune *quick_tune) |
API_EXPORT int CALL_CONV | bladerf_cancel_scheduled_retunes (struct bladerf *dev, bladerf_module module) |
API_EXPORT int CALL_CONV | bladerf_get_frequency (struct bladerf *dev, bladerf_module module, unsigned int *frequency) |
API_EXPORT int CALL_CONV | bladerf_get_quick_tune (struct bladerf *dev, bladerf_module module, struct bladerf_quick_tune *quick_tune) |
API_EXPORT int CALL_CONV | bladerf_set_tuning_mode (struct bladerf *dev, bladerf_tuning_mode mode) |
#define BLADERF_FREQUENCY_MAX 3800000000u |
Maximum tunable frequency, in Hz
Definition at line 1053 of file libbladeRF.h.
#define BLADERF_FREQUENCY_MIN 237500000u |
Minimum tunable frequency (without an XB-200 attached), in Hz
Definition at line 1050 of file libbladeRF.h.
#define BLADERF_FREQUENCY_MIN_XB200 0u |
Minimum tunable frequency (with an XB-200 attached), in HZ.
While this value is the lowest permitted, note that the components on the XB-200 are only rated down to 50 MHz. Be aware that performance will likely degrade as you tune to lower frequencies.
Definition at line 1047 of file libbladeRF.h.
#define BLADERF_RETUNE_NOW 0 |
Specifies that scheduled retune should occur immediately when using bladerf_schedule_retune().
Definition at line 1059 of file libbladeRF.h.
enum bladerf_tuning_mode |
Frequency tuning modes
BLADERF_TUNING_MODE_HOST is the default if either of the following conditions are true:
BLADERF_TUNING_MODE_FPGA is the default if both of the following conditions are true:
The default mode can be overridden by setting a BLADERF_DEFAULT_TUNING_MODE environment variable to "host" or "fpga". Overriding this value with a mode not supported by the FPGA will result in failures or unexpected behavior.
Definition at line 1078 of file libbladeRF.h.
API_EXPORT int CALL_CONV bladerf_cancel_scheduled_retunes | ( | struct bladerf * | dev, |
bladerf_module | module | ||
) |
Cancel all pending scheduled retune operations for the specified module.
This will be done automatically during bladerf_close() to ensure that previously queued retunes do not continue to occur after closing and then later re-opening a device.
dev | Device handle |
module | Module to cancel pending operations on |
API_EXPORT int CALL_CONV bladerf_get_frequency | ( | struct bladerf * | dev, |
bladerf_module | module, | ||
unsigned int * | frequency | ||
) |
Get module's current frequency in Hz
dev | Device handle |
module | Module to configure |
frequency | Pointer to the returned frequency |
API_EXPORT int CALL_CONV bladerf_get_quick_tune | ( | struct bladerf * | dev, |
bladerf_module | module, | ||
struct bladerf_quick_tune * | quick_tune | ||
) |
Fetch parameters used to tune the transceiver to the current frequency for use with bladerf_schedule_retune() to perform a "quick retune."
This allows for a faster retune, with a potential trade off of increased phase noise. Note that these parameters are sensitive to changes in the operating environment, and should be "refreshed" if planning to use the "quick retune" functionality over a long period of time.
[in] | dev | Device handle |
[in] | module | Module to query |
[out] | quick_tune | Quick retune parameters |
API_EXPORT int CALL_CONV bladerf_schedule_retune | ( | struct bladerf * | dev, |
bladerf_module | module, | ||
uint64_t | timestamp, | ||
unsigned int | frequency, | ||
struct bladerf_quick_tune * | quick_tune | ||
) |
Schedule a frequency retune to occur at specified sample timestamp value.
dev | Device handle |
module | Module to retune |
timestamp | Module's sample timestamp to perform the retune operation. If this value is in the past, the retune will occur immediately. To perform the retune immediately, specify BLADERF_RETUNE_NOW. |
frequency | Desired frequency, in Hz. |
quick_tune | If NULL, the frequency parameter will be used. If non-NULL, the provided "quick retune" values will be applied to the transceiver to tune it according to a previous state retrieved via bladerf_get_quick_tune(). |
API_EXPORT int CALL_CONV bladerf_select_band | ( | struct bladerf * | dev, |
bladerf_module | module, | ||
unsigned int | frequency | ||
) |
Select the appropriate band path given a frequency in Hz.
Most API users will not need to use this function, as bladerf_set_frequency() calls this internally after tuning the device.
The high band (LNA2 and PA2) is used for frequency
>= 1.5 GHz. Otherwise, The low band (LNA1 and PA1) is used.
Frequency values outside the range of [ BLADERF_FREQUENCY_MIN, BLADERF_FREQUENCY_MAX ] will be clamped.
dev | Device handle |
module | Module to configure |
frequency | Tuned frequency |
API_EXPORT int CALL_CONV bladerf_set_frequency | ( | struct bladerf * | dev, |
bladerf_module | module, | ||
unsigned int | frequency | ||
) |
Set module's frequency in Hz.
Values outside the range of [ BLADERF_FREQUENCY_MIN, BLADERF_FREQUENCY_MAX ] will be clamped.
For best results, it is recommended to keep the RX and TX frequencies at least 1 MHz apart, and to digitally mix on the RX side if reception closer to the TX frequency is required.
This calls bladerf_select_band() internally.
dev | Device handle |
module | Module to configure |
frequency | Desired frequency |
API_EXPORT int CALL_CONV bladerf_set_tuning_mode | ( | struct bladerf * | dev, |
bladerf_tuning_mode | mode | ||
) |
Set the device's tuning mode
dev | Device handle |
mode | Desired tuning mode. Note that the available modes depends on the FPGA version. |