libbladeRF: Configuration File

| libbladeRF 2.5.0-git Nuand bladeRF library

Loading...
Searching...
No Matches
Configuration File

libbladeRF supports an optional configuration file. This feature is useful for specifying preferred default settings, or for configuring options that aren't yet supported by a third-party application. If found, the configuration file is parsed immediately after a bladeRF is opened and initialized by libbladeRF.

A configuration file may be named either `bladeRF.conf` (preferred) or `bladerf.conf`. libbladeRF uses the same search path it uses for finding FPGA images and calibration tables, defined by file_find() in file_ops.c:

Linux and OSX directories:

- The current working directory
- The directory containing the program being executed
- `~/.config/Nuand/bladeRF/`
- `~/.Nuand/bladeRF/`
- `/etc/Nuand/bladeRF/`
- `/usr/share/Nuand/bladeRF/`

Windows:

- The current working directory
- The directory containing the program being executed
- `C:\Users\USERNAME\AppData\Roaming\Nuand\bladeRF` (via FOLDERID_RoamingAppData)
- The installation path, via `HKEY_LOCAL_MACHINE\Software\Nuand LLC\Path`

Note: libbladeRF will only find and process the first configuration file it finds. Any other files appearing later in the search path will be ignored.

A valid configuration file may contain:

- Comments are lines starting with a `#`, and are ignored.
- Restrictions are lines starting with a `[` and ending with a `]`, and are used to apply a scope to a subset of options.
- Options themselves are specified by an option key, a space, and then a value.

The below example loads an FPGA image from `/home/user/hostedx40.rbf`, set the trim DAC value to 592, and set the frequency to 2.4 GHz, when any bladeRF is opened:

# Load the hostedx40.rbf FPGA image, set the trim DAC, and
# configure the frequency
fpga /home/user/hostedx40.rbf
trimdac 592
frequency 2.4G

## Restrictions

Options may be restricted to bladeRFs that match a particular description. A restriction applies to all options following it, until the next restriction (or the end of the file). When iterating through the configuration file, a given option will be applied if the target bladeRF matches the most recent restriction (or if there are no restrictions). If it does not, the option will be silently ignored.

### Matching by FPGA size

The following restrictions are based on the FPGA size on the bladeRF board:

- `[x40]` - Only boards matching BLADERF_FPGA_40KLE
- `[x115]` - Only boards matching BLADERF_FPGA_115KLE

The following example would program the FPGA with `/home/user/hostedx40.rbf` when initializing a bladeRF x40, but would program it with `/home/user/hostedx115.rbf` if the bladeRF is an x115 model.

trimdac 592
frequency 2.4G
[x40]
fpga /home/user/hostedx40.rbf
[x115]
fpga /home/user/hostedx115.rbf

### Matching by Device Identifier String

A restriction of `[<device identifier string>]` will limit the following options to bladeRFs matching that string. Under the hood, any square-bracketed string that is not otherwise recognized gets passed to bladerf_devstr_matches() as a possible device identifier string.

The general form of a device identifier string is:

    <backend>:[device=<bus>:<addr>] [instance=<n>] [serial=<serial>]

Note: Please see bladerf_open() for a complete description of device identifier strings.

The below example is similar to the above examples. However, it will apply different trimdac values to two specific boards, which are identified by serial number.

trimdac 592
frequency 2.4G
[x40]
fpga /home/user/hostedx40.rbf
[x115]
fpga /home/user/hostedx115.rbf
[*:serial=febe585efb9e3f36c87c3e4db1b2adee]
trimdac 440
[*:serial=07dea50449172fcd63e711d7e5fe9bb4]
trimdac 498

### Matching any device

Finally, a wildcard (`[*]`) or empty (`[]`) restriction will match any device, and may be used to "cancel" a previous restriction.

## Options

Options (unless ignored due to a restriction) will be applied sequentially, immediately following initialization of the bladeRF.

Note: If the same option key is specified more than once, it will be applied more than once; e.g. specifying `frequency 2.4G` and then `frequency 400M` will first tune the frequency to 2.4 GHz, and then to 400 MHz.

- `fpga <rbf_filename>`

  Loads the specified FPGA image via bladerf_load_fpga().

- `frequency <Hz>`

  Sets the bladeRF's RX and TX frequencies to a given frequency in Hz. Suffixes are supported.

  This option causes libbladeRF to call bladerf_set_frequency() on both BLADERF_RX and BLADERF_TX.

- `samplerate <rate>`

  Sets the sample rate for the RX ADC and TX to the given rate in samples per second. Suffixes are supported.

  This option causes libbladeRF to call bladerf_set_rational_sample_rate() on both BLADERF_RX and BLADERF_TX.

- `bandwidth <Hz>`

  Sets the RF bandwidth to a given value in Hz. Suffixes are supported.

  This option causes libbladeRF to call bladerf_set_bandwidth() on both BLADERF_RX and BLADERF_TX.

- `agc <bool>`

  Enables or disables automatic gain control mode, via bladerf_set_gain_mode().

  A true value (e.g. `on`) selects BLADERF_GAIN_AUTOMATIC, while a false value (e.g. `off`) selects BLADERF_GAIN_MANUAL.

- `gpio <uint>`

  Sets the GPIO register to a given value, using bladerf_config_gpio_write().

- `sampling <internal|external>`

  Sets the sampling source by calling bladerf_set_sampling().

  Choices are `internal` or `external`.

  See bladerf_sampling for important information.

- `trimdac <uint>`

  Sets the trim DAC value via bladerf_dac_write().

- `vctcxo_tamer <disabled|1pps|10mhz>`

  Sets the VCTCXO tamer method using bladerf_set_vctcxo_tamer_mode().

  Choices are `disabled`, `1PPS`, and `10MHz`.

  See bladerf_vctcxo_tamer_mode for important information.

- `biastee_rx <bool>`, `biastee_tx <bool>`

  Enables or disables the bias tee supply on the RX or TX ports respectively, via bladerf_set_bias_tee().

  A true value (e.g. `on`) turns the DC bias on, while a false value (e.g. `off`) turns the DC bias off.

- `clock_ref <bool>`

  Enables or disables taming by an external clock reference for BladeRF 2.0 via bladerf_set_pll_enable().

  A true value (e.g. `on`) turns the taming on, while a false value (e.g. `off`) turns the taming off.

- `refin_freq <Hz>`

  Sets the frequency of the external clock reference for BladeRF 2.0 in Hz via bladerf_set_pll_refclk(). Suffixes are supported.

- `clock_sel <onboard|external>`

  Selects the 38.4MHz clock source for BladeRF 2.0 via bladerf_set_clock_select().

  Possible values are `onboard` for the internal clock or `external` for and external 38.4MHz clock supplied on the clk_in connector.

- `clock_out <bool>`

  Enables or disables 38.4MHz clock on the clk_out connector for BladeRF 2.0 via bladerf_set_clock_output().

  A true value (e.g. `on`) turns the clock out on, while a false value (e.g. `off`) turns the clock out off.

### Suffixes

Where noted above, the following suffixes are supported:

- `G`, `GHz`: multiply by 1000*1000*1000
- `M`, `MHz`: multiply by 1000*1000
- `k`, `kHz`: multiply by 1000