wiki:SISOAGC

Version 3 (modified by gbmidd, 18 years ago) (diff)

--

Automatic Gain Control

Because received signals may have wildly varying magnitudes, a dynamic gain system is required to normalize the magnitude of the signal going into the receiver. This is needed to guarantee that clipping does not occur in the analog-digital converters, and also to ensure that the signal is large enough to be meaningful to the receiver.

The gain value is chosen using an automatic gain control (AGC) peripheral, which detects the magnitude of the received signal and determines radio-amplifier gains which place the baseband output signal in the correct range for the receiver.

Algorithm Details

The Maxim radios apply gain at two points during downconversion: first at RF and then at baseband, after the downconversion. The RF gain may be set to any of 0, 15 or 31 dB, while the baseband gain is less granular and may be set to values between 0 and 61 dB in steps of 2 dB.

The radio also returns a received signal strength indicator (RSSI), the output of an analog integrator, which gives an estimate of the received signal strength in dB. From this value, an approximate amount of gain may be determined by subtracting the RSSI from the target level.

The AGC peripheral is triggered by a packet-detect signal. After this arrives, the AGC reads the RSSI and computes a rough gain estimate as described. This gain is then decomposed into the RF and baseband (BB) gain parts. These gains are set, and the system is allowed to settle for some time.

After a settling period, a digital power measurement (vIQ) is computed (taken as the sum-complex magnitude in dB), providing a much more accurate estimate of the signal strength. The final adjustment to the gain is calculated by subtracting vIQ from the target level.

The final gain is set, and the gains are locked until the AGC is reset. At that time, the gains are reset to maximum RF (31 dB) and calibrated BB gain (dependent on the user-defined noise estimate).

DC Offset Correction

As a result of changing gains in the radios, a DC offset (DCO) may be introduced in the downconverted signal, and it may not be the same in the I and Q paths. The AGC peripheral contains a routine to remove the DCO, which may or may not enabled depending on user requirements.

API

A driver abstracts register-level operations from the programming-interface; below the functions for controlling the AGC are described. The driver is warpagc.h, and must be included in the code in order to define the functions below.

void agc_Initialize(int noise_estimate)

Resets and initializes the AGC peripheral with all required parameters. The calibration baseband gain is computed from the noise estimate, so an accurate guess of the noise floor is required. This value is generally near -85 dB.

Upon completing this routine, the AGC is enabled and online.

void agc_MasterReset()

Resets all state in the AGC, though does not reinitialize any parameters. All averagers and other state-machines are reset, and the AGC is enabled when the routine completes.

void agc_Reset()

Resets only the gain values, but no other state in the core.

void agc_FiltSel(unsigned int state)

Choose the downsampling filter depending on the value of state.

state = 0 : downsampling only

state = 1 : use 32-tap decimating filter

void agc_SetDCO(unsigned int state)

Enable or disable DC Offset correction

state = 0 : DCO disable

state = 1 : DCO enable

agc_SetTarget(signed int c)

Set the target signal strength value c in dB.