/*! \page page_calibration Device Calibration

\tableofcontents

\section calibration_self Self-Calibration

UHD software comes with several self-calibration utilities for
minimizing IQ imbalance and DC offset. These utilities perform
calibration sweeps using transmit leakage into the receive path (special
equipment is not required). The results from a calibration are written
to a CSV file in the user's home directory. UHD software will
automatically apply corrections at runtime when the user re-tunes the
daughterboard LO. Calibration results are specific to an individual RF
board.

<b>Note:</b> When a calibration table is present, and the user wishes to
override the calibration settings through the API: the user should
re-apply the desired setting every time the LO is re-tuned.

UHD software comes with the following calibration utilities:

-   **uhd_cal_rx_iq_balance:** - mimimizes RX IQ imbalance vs. LO
    frequency
-   **uhd_cal_tx_dc_offset:** - mimimizes TX DC offset vs. LO
    frequency
-   **uhd_cal_tx_iq_balance:** - mimimizes TX IQ imbalance vs. LO
    frequency

The following RF frontends are supported by the self-calibration
utilities:

-   RFX Series transceiver boards
-   WBX Series transceiver boards
-   SBX Series transceiver boards
-   CBX Series transceiver boards

\subsection calibration_self_utils Calibration Utilities

UHD software installs the calibration utilities into
`<install-path>/bin`. **Disconnect** any external hardware from the
RF antenna ports, and run the following from the command line. Each
utility will take several minutes to complete:

    uhd_cal_rx_iq_balance --verbose --args=<optional device args>
    uhd_cal_tx_iq_balance --verbose --args=<optional device args>
    uhd_cal_tx_dc_offset --verbose --args=<optional device args>

See the output given by `--help` for more advanced options, such as
manually choosing the frequency range and step size for the sweeps.

<b>Note:</b> Your daughterboard needs a serial number to run a calibration
utility. Some older daughterboards may not have a serial number. If this
is the case, run the following command to burn a serial number into the
daughterboard's EEPROM:

    <install dir>/lib/uhd/utils/usrp_burn_db_eeprom --ser=<desired serial> --args=<optional device args>

\subsection calibration_data Calibration Data

By default, calibration files are stored in the user's home/application
directory:

-   **Linux:** `${HOME}/.uhd/cal/`
-   **Windows:** `%APPDATA%\.uhd\cal\`

If you would like to specify a custom directory, you can do so with the
`$UHD_CONFIG_DIR` environment variable:

-   **Custom (any OS):** `${UHD_CONFIG_DIR}/.uhd/cal/`

Calibration files can easily be moved from one machine to another by copying the
"cal" directory. Re-running a calibration utility will replace the existing
calibration file. The old calibration file will be renamed so it may be
recovered by the user.


\subsection ignore_cal_file Ignoring Calibration Files

At runtime, the user can choose to ignore a daughterboard's calibration file by
adding "ignore-cal-file" to the arguments. With the UHD API, it can be done as
follows:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
    uhd::device_addr_t hint;
    hint["type"] = "usrp1";
    hint["ignore-cal-file"] = "";
    uhd::device_addrs_t dev_addrs = uhd::device::find(hint);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Using tx_waveforms as an example, the user can apply this argument as follows:

    tx_waveforms --args="addr=192.168.10.2,ignore-cal-file" --freq=100e6 --rate=1e6

*/
// vim:ft=doxygen:
