HAL: Calibration Overview
The radio hardware has a variety of calibration tasks which need to be done in order to ensure correct operation of the radio and baseband/PHY.
Noise Floor Calibration
Noise floor calibration is done periodically (by default every 30 seconds.) The baseband looks for a quiet period and attempts to sample the noise floor. If the RX signal is constantly busy (for example, if there's a constant noise source or there is noise from the board, noise spurs, etc) then the noise floor readings will be inaccurate and cause further issues.
Some of the baseband registers which take dB parameters are all referencing the current noise floor calibration results, so if the calibration is performed incorrectly, the baseband will start to exhibit some very strange behaviour.
The 802.11n chips use a master/slave interleaved ADC pairing to achieve the sample rate required. The DC offset and gain differences need to be compensated for in order to improve RX performance.
(TODO: flesh this out.)
ADC DC Offset Calibration
ADC DC Gain Calibration
TX Power Calibration
Closed-Loop TX Power Calibration
Closed-loop TX power calibration uses a power detector coupled to the output TX to determine the current signal level. It then uses a lookup table to match this power detector output to a target value in dBm. The output gain is then adjusted on the fly.
This is done using a TX power calibration table which is stored in the EEPROM and reassembled at interface reset time. These tables are stored per-chain and for a handful of operating frequencies.
(TODO: flesh this out further.)
Open-Loop TX Power Calibration
PAPD / RF Gain
This seems to be something specific to earlier chips. In summary, there seems to be some peak to peak TX gain check which is occasionally used to compensate for thermal changes.
For more background, see:
- ath_hal/ar5211/ar5211_reset.c: ar5211ResetGain(), ar5211GetRfgain(), ar5211IsGainAdjustNeeded(), ar5211AdjustGain(), ar5211SetRfgain().
This isn't required for AR5416 and later NICs - TX/RX thermal calibration is done differently.