AN-2596: ADRV904x CLGC Application Note
Scope
This user guide is a document to assist in understanding the ADRV904x transmit path output power control feature known as closed-loop gain control (CLGC).
This document explains how CLGC works and how to enable it in case of frequency division duplex (FDD) and time division duplex (TDD) systems.
CLGC details are already covered in the system development user guide (SDUG), and this document covers how to enable CLGC in practical implementation.
Closed Loop Gain Control
Why CLGC?
The power amplifier (PA) output power may fluctuate around the target level over time due to temperature changes and other factors, given a constant baseband signal level. CLGC can help reduce the fluctuation and meet standards and regulatory requirements (for example, ±2dB fluctuation is required by the LTE/5G new radio (NR) standard). The baseband signal level may change significantly due to the dynamics of power control and traffic load in a network (for example, dynamic range can be up to 20 dB in LTE). CLGC can help keep the output power linearly proportional to the baseband signal level.
Introduction
The ADRV904x CLGC is a closed-loop tracking calibration that adjusts front-end transmitter (Tx) attenuation to maintain a constant desired gain in the transmitter path from the baseband input to the PA output such that the PA output power is constant with respect to changes in temperature or other variations. The desired transmitter gain is set by adjusting the transmitter front-end attenuation such that the PA output reaches the desired power with the maximum nominal level of the baseband signal. The digital swing of the baseband signal is not affected because the attenuation is applied on the analog front-end of the transmitter channel.
Prerequisites to Enable GLGC
The correct transmitter to observation receiver (ORx) mapping is required to be configured during initialization. Digital predistortion (DPD) tracking calibration must be enabled for CLGC to run in the ADRV904x transceiver.
Transmitter to observation receiver path delay is expected to be known to and available for CLGC. As part of the DPD tracking calibration, the path delay is estimated, and the user need not run the path delay calibration separately.
Implementation
Figure 1 is a functional diagram where in the transmitter power and the observation receiver power are captured by the capture engine. The CLGC algorithm calculates the loop gain with the current transmitter attenuation and observation receiver gain settings. Depending on the expected loop gain, loop gain error is automatically calculated, and the error is minimized by controlling the transmitter attenuation in the transmitter path.
Tap Off Points
The transmitter and observation receiver power tap off points are shown in Figure 2 and Figure 3, and are not user configurable.
The transmitter power tap off point is after the pre-DPD half band one (HB1) output, which is the transmit signal strength indicator (TSSI2).
The observation receiver power tap off point is after the HB1 output, which is TSSI1.
CLGC Capture Modes
There are two capture modes for CLGC operation. The first one is TSSI mode, and the second one is peak detect mode.
TSSI Mode
TSSI mode uses the power meters in the transmitter and observation receiver paths to measure the loop gain and apply gain correction. The power detection happens within the measurement duration near the beginning of the transmitter to observation receiver mapping period.
The loop gain update happens once every transmitter to observation receiver mapping switching. Note that TSSI mode is preferred for nonbursty signals, such as test model 3.1 (TM3.1) and test model 1.1 (TM1.1).
Peak Detect Mode
Peak detect mode uses DPD peak search capture data to estimate the loop gain and apply gain correction. The power detection happens using the highest peak + 6000 samples in peak search window. If the data capture is incomplete, retry 10 times. The loop gain update happens once every transmitter to observation receiver mapping switching.
Note that this mode is preferred for bursty/sparse signals, such as synchronization signal block (SSB) and TM2.
Table 1 shows the comparison between the two capture modes.
Parameter | TSSI Mode | Peak Capture Mode |
Power Measurement | TSSI power meter | Peak capture |
Sample Alignment | Dependent on alignment of Tx and ORx enable signals | Tx and ORx sample captures are triggered synchronously, and captured samples further aligned in software. |
ORx Enable | Should align with Tx enable | ORx enable state can be high or aligned with Tx enable state |
Assumed Signal | Normal traffic (nonbursty signal) | Any kind of traffic; typically used on bursty signal (for example, TM2/SSB) |
Data Capture Size | capDurationUs (actual TSSI measurement time (μs)) | capPeriodUs (peak capture window length (μs)) |
Number of Data to Calculate Power | All of data in measurement duration | Highest peak + 6000 samples |
Timer | capPeriodUs (timeout for TSSI timer) | None |
CLGC Operation Modes
The CLGC functionality can operate in two modes:
- Passive loop gain measurement—This mode of operation is typically activated to determine initial operating point of the PA. When a transmitter is activated, the user determines the PA operating point by sending traffic and measuring the overall loop gain from the observer receiver to the transmitter. During this stage, the user can take advantage of the passive loop gain measurement mode, in which the CLGC algorithm simply measures the loop gain without actively adjusting the Tx front end attenuation. Once the ideal operating point is determined, the user can then enable active loop gain control mode.
- Active loop gain control—In this mode, CLGC measures the loop gain from the observation receiver to transmitter baseband and adjusts the transmitter front-end attenuation to maintain the loop gain. This mode of operation is typically activated during run time once the initial operating points are determined, and the initial observation receiver attenuation and transmitter attenuation settings are configured. For the active loop gain control mode, the user is required to configure the expected loop gain using the adi_adrv904x_ClgcTrackingConfigSet() application programming interface (API) through the expLoopPowGain parameter in the adi_adrv904x_DfeAppCalClgcTrackCfg_t data structure.
CLGC Related APIS
- The adi_adrv904x_ClgcCaptureConfigSet (adi_adrv904x_Device_t *const device, const uint32_t clgcTxChannelMask, const adi_adrv904x_DfeAppCalClgcCaptureCfg_t *const clgcCaptureCfg) API configures the CLGC capture configuration for the requested transmitter channel(s).
typedef struct adi_adrv904x_DfeAppCalClgcCaptureCfg { adi_adrv904x_DfeAppCalClgcCaptureMode_e capMode; /*!< CLGC capture mode: TSSI or peak detection */ uint32_t numCapBatches; /*!< number of TSSI measurement batches in TSSI mode */ uint32_t capDurationUs; /*!< TSSI measurement time (usec) of one batch in TSSI mode */ uint32_t capPeriodUs; /*!< timeout (usec) for TSSI timer of one batch, or window length in peak det mode */ float minTxPowThres; /*!< minimum Tx power threshold needed to run CLGC tracking for each of batches */ float minOrxPowThres; /*!< minimum ORx power threshold needed to run CLGC tracking for each of batches */ } adi_adrv904x_DfeAppCalClgcCaptureCfg_t;
- The adi_adrv904x_ClgcCaptureConfigGet (adi_adrv904x_Device_t *const device, const adi_adrv904x_TxChannels_e clgcTxChannelSel, adi_adrv904x_DfeAppCalClgcCaptureCfg_t *const clgcCaptureCfg) API retrieves the CLGC capture configuration for the requested transmitter channel from the device.
- The adi_adrv904x_ClgcTrackingConfigSet (adi_adrv904x_Device_t *const device, const uint32_t clgcTxChannelMask, const adi_adrv904x_DfeAppCalClgcTrackCfg_t *const clgcTrackCfg) API configures the CLGC tracking configuration for the requested transmitter channel(s).
typedef struct adi_adrv904x_DfeAppCalClgcTrackCfg { uint8_t enClgc; /*!< enable (1) or disable closed loop gain control */ uint8_t enPaProtect; /*!< enable (1) or disable PA protection assert check in CLGC */ float expLoopPowGain; /*!< expected Tx-ORx loop power gain for CLGC to track on */ float maxLoopGainAdjustdB; /*!< maximum loop gain adjustment in dB for Tx atten */ float minTxAttenLimitdB; /*!< minimum Tx attenuation limit in dB */ float maxTxAttenLimitdB; /*!< maximum Tx attenuation limit in dB */ } adi_adrv904x_DfeAppCalClgcTrackCfg_t;
- The adi_adrv904x_ClgcTrackingConfigGet (adi_adrv904x_Device_t *const device, const adi_adrv904x_TxChannels_e clgcTxChannelSel, adi_adrv904x_DfeAppCalClgcTrackCfg_t *const clgcTrackCfg) API retrieves the CLGC tracking configuration for the requested transmitter channel from the device.
- The adi_adrv904x_ClgcTrackingRun (adi_adrv904x_Device_t *const device, const uint32_t clgcTxChannelMask) API starts the CLGC tracking run for the requested transmitter channel(s).
- The adi_adrv904x_ClgcTrackingReset (adi_adrv904x_Device_t *const device, const uint32_t clgcTxChannelMask) API resets the CLGC tracking for the requested transmitter channel(s).
- The adi_adrv904x_DfeClgcStatusGet (adi_adrv904x_Device_t *const device, const adi_adrv904x_TxChannels_e clgcTxChannelSel, adi_adrv904x_DfeAppCalClgcStatus_t *const clgcStatus) API retrieves the CLGC status for the requested transmitter channel from the device.
CLGC Capture Configuration | Description |
Capture Mode | TSSI or peak mode |
Capture Duration | TSSI power meter measurement duration (units = μs) |
Capture Period | Peak search window for peak capture mode or maximum time period over which capDuration number of samples are averaged in TSSI mode |
Tx Power Threshold | Tx low-power threshold below which CLGC does not estimate loop gain (linear scale … range 0 to 1) |
ORx Power Threshold | ORx low-power threshold below which CLGC does not estimate loop gain (linear scale … range 0 to 1) |
CLGC Tracking Configuration | Description |
Enable CLGC | Loop gain control enable/disable |
Enable PA Protection Check | Check if PA protection is asserted before calibrating |
Expected Loop Gain | User configurable expected loop gain |
Max Loop Gain Adjust Limit | Upper limit of Tx attenuation that CLGC can set |
System Considerations
- Make sure there is enough headroom for the transmitter attenuation change. Typical expectation is estimating the loop gain at 6dB of transmitter attenuation. Therefore, CLGC can reduce the attenuation until 0dB if the loop gain increases over time.
- CLGC supports user configurable low-power threshold on the transmitter and observation receiver RMS power with a maximum limit of −60dBFS.
- CLGC must support transmitter attenuation step size in the 0.05dB to 6dB range for loop gain adjustment.
- CLGC aborts if the user applies a manual gain change in the middle of power measurement.
- Whenever there is a transmitter to observation receiver mapping change, the central processing unit (CPU) is interrupted to check the current transmitter to observation receiver mapping. If the observation receiver becomes unavailable to the transmitter, the current capture (transmitter and observation receiver TSSI measurements) are aborted. This triggers a retry—a new capture request is issued in CLGC firmware (FW).
- The capture request does not start until an available observation receiver is mapped to the transmitter. Therefore, the retry is synchronized with the transmitter to observation receiver mapping change period and starts at the next edge when an observation receiver becomes available to the transmitter.
- It is expected that the observation receiver path to have gain variations across temperature for which it is suggested that the customer can have a look-up table (LUT) for the variations. The difference in the gain across temperature can be used as delta in the loop gain for CLGC to run more accurately.
CLGC Evaluation Testing
To check whether CLGC is functional or not and to understand the CLGC feature, the user can use the evaluation board (EVB) setup and the Analog Devices, Inc., Analysis, Control, Evaluation (ACE) graphical user interface (GUI).
Test Setup
Test Steps
- The detailed sequence and steps are given in the SDUG.
- Make sure that the transmitter is connected back to observation receiver as per the transmitter to observation receiver mapping configured.
- Configure the CLGC parameters.
- Configure and enable DPD (make sure .RunCLGC is enabled).
- Keep CLGC in passive loop gain estimation mode (.enClgc is 0) and get the current loop gain value from the CLGC statistics.
- Change the loop gain from the estimated value. For example, if the current loop gain estimated is 20dB, change it to 30dB and set enClgc to 1. CLGC reduces the transmitter attenuation to the previous transmitter attenuation −10dB and this is tracked over time by the CLGC algorithm. At this point, the transmitter output power also comes down by 10dB from its previous value.
This way, the user can simulate the loop gain change and observe that the CLGC tracking calibration is running as expected.
Using ACE GUI
This is covered in the CLGC section of the evaluation system user guide document.
Example Configuration of CLGSC Parameters
def clgcCaptureConfigSetclgcCaptureConfigSet(channel = adi_adrvgen6_Channels_e.ADI_ADRVGEN6_CH0):
clgcCapConfig = adi_adrvgen6_DfeAppCalClgcCaptureCfg_t()
clgcCapConfig.capMode = adi_adrvgen6_DfeAppCalClgcCaptureMode_e.ADI_ADRVGEN6_DFE_APP_CAL_CLGC_CAPTURE_MODE_TSSI # TSSI or peak detect mode
clgcCapConfig.capDurationUs = 10000 # 10 ms
clgcCapConfig.capPeriodUs = 20000 # Timeout for TSSI mode
clgcCapConfig.minTxPowThres = 0.00001 # −50dBFS, < −50dBFS, CLGC does not calculate loop gain
clgcCapConfig.minOrxPowThres = 0.00001 # −50dBFS, < −50dBFS, CLGC does not calculate loop gain
adrv904x.dfe_clgc.ClgcCaptureConfigSet(int(channel), clgcCapConfig)
def clgcTrackingConfigSet_v3clgcTrackingConfigSet_v3(channel = adi_adrvgen6_Channels_e.ADI_ADRVGEN6_CH0, enClgc = 0, lpgain = 0):
clgcTrackingConfig = adi_adrvgen6_DfeAppCalClgcTrackCfg_t()
clgcTrackingConfig.enClgc = enClgc # 0 in passive loop gain estimation, 1 for active loop gain control
clgcTrackingConfig.enPaProtect = 0 # 1 for PA protection enable
clgcTrackingConfig.expLoopPowGain = lpgain # expected loop gain
clgcTrackingConfig.maxLoopGainAdjustdB = 0.1 # 0.1dB loop gain adjustment per iteration
clgcTrackingConfig.minTxAttenLimitdB = 3 # Attenuation does not go less than this and CLGC throws error
clgcTrackingConfig.maxTxAttenLimitdB = 10 # Attenuation does not go more than this and CLGC throws error
adrv904x.dfe_clgc.ClgcTrackingConfigSet(int(channel), clgcTrackingConfig)
Interpreting CLGC Statistics
Channel = ADI_ADRVGEN6_TX0 # CLGC status for transmitter Channel 0
CLGC error code: 0 # No error code
CLGC iteration count: 1539 # Iteration count increments if CLGC tracking calibration is enabled
CLGC update count: 205 # Update count increments
CLGC mean Tu power: 0.0254612 # 10 × log10 (0.0254612) → −15.94dBFS ~ −16dBFS
CLGC mean observation receiver power: 0.000126503 # 10 × log10 (0.000126503) → −38.94dBFS ~ −39dBFS
CLGC loop gain: 0.00496938 # 10 × log10 (0.00496938) → −23dB (−39 − (−16) → −23dB)
CLGC transmitter attenuation adjust −0.0266796 # Transmitter attenuation adjusted in this update
Current transmitter attenuation (mdB) 7900 # Current transmitter attenuation
CLGC Error Codes
The CLGC related error codes and the recovery actions are provided in the adrv904x_dfe_app_error_tables.h API software package.
Error Message | Error Code | Description | Main Cause | Main Recovery Action | Main Recovery Description |
ADI_ADRV904X_ DFE_APP_ERR_CODE _CLGC_C APTURE_ REQUEST_FAILED |
0xE122 | Application error: CLGC capture request | Invalid CLGC capture request | ADI_ADRV904X _ERR_ACT_CHECK _ PARAM |
Check CLGC capture configuration parameters |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_C APTURE_RESULT_ GET_ERROR |
0xE123 | Application error: CLGC capture result get | Service error when reading back power meter result | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Reset digital front end (DFE) and try again. Contact Analog Devices if the problem persists |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_C APTURE_SIGNAL_ LOW_ERROR |
0xE124 | Application error: Tx or ORx power is below threshold set | Power measurement cannot find healthy signal after maximum retries | ADI_ADRV904X_ ERR_ACT_CHECK_ PARAM |
Check Tx or ORx signal level and capture thresholds |
ADI_ADRV904X_DFE _APP_ERR_CODE_CLGC_ STATUS_GET_FUNC_ NOT_SUPPORTED |
0xE125 | Application error: Unsupported CLGC status get | Status get function not supported for provided tracking calibration status type | ADI_ADRV904X_ERR _ACT_CHECK_PARAM |
Check tracking calibration status type has a supported status get feature |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_STATUS _GET_INSUFFICIENT _MEMORY |
0xE126 | Application error: CLGC status buffer size | Invalid status buffer size for the calibration status type requested | ADI_ADRV904X_ ERR_ACT_CHECK_ PARAM |
Check status size for the calibration status type requested |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_CTRL _FUNC_NOT_SUPPORTED |
0xE127 | Application error: CLGC control command | Invalid control command provided | ADI_ADRV904X_ ERR_ACT_CHECK_ PARAM |
Check control command is valid |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_CTRL_ GET_INSUFFICIENT _MEMORY |
0xE128 | Application error: CLGC CTRL command buffer size | Invalid CTRL command buffer size for the calibration CTRL type requested | ADI_ADRV904X_ ERR_ACT_CHECK_ PARAM |
Check CTRL command size for the calibration CTRL type requested |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_PA _PROTECTION_ ASSERTED |
0xE129 | Application error: CLGC detects PA protection assertion | PA protection error asserted or Tx attenuation rampup/down in progress | ADI_ADRV904X_ ERR_ACT_CHECK_ FEATURE |
Check PA protection thresholds or Tx signal level |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_TX _ATTEN_ABOVE_ MAX_LIMIT |
0xE12A | Application error: CLGC Tx attenuation above maximum limit | CLGC failed to adjust Tx attenuation because it is above maximum limit | ADI_ADRV904X_ ERR_ACT_CHECK_ PARAM |
Check Tx attenuation limits or/and expected loop gain configured |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_TX _ATTEN_BELOW_ MIN_LIMIT |
0xE12B | Application error: CLGC Tx attenuation below minimum limit | CLGC failed to adjust Tx attenuation because it is below minimum limit | ADI_ADRV904X_ ERR_ACT_CHECK_ PARAM |
Check Tx attenuation limits or/and expected loop gain configured |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_C APTURE_EVENT_ UNEXPECTED |
0xE12C | Application error: Unexpected capture event received in capture state machine | Unexpected capture type received in capture state machine | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Reset DFE and try again. Contact Analog Devices if the problem persists |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_TX _ATTEN_SET_FAILED |
0xE12D | D Application error: CLGC unable to set Tx attenuation | Unexpected error returned when writing Tx attenuation to hardware (HW) | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Reset DFE and try again. Contact Analog Devices if the problem persists |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_TX _ATTEN_GET_FAILED |
0xE12E | Application error: CLGC unable to read back current Tx attenuation | Unexpected error returned when reading Tx attenuation from HW | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Reset DFE and try again. Contact Analog Devices if the problem persists |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_ ORX_ATTEN_ GET_FAILED |
0xE12F | Application error: CLGC unable to read back current ORx attenuation | Unexpected error returned when reading ORx attenuation from HW | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Reset DFE and try again. Contact Analog Devices if the problem persists |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_CAPTURE _ABORT_FAILED |
0xE130 | Application error: CLGC capture abort | Service error when aborting a CLGC capture | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Reset DFE and try again. Contact Analog Devices if the problem persists |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_C APTURE_DISCARD _FAILED |
0xE131 | 1 Application error: CLGC capture discard | Service error when discarding a CLGC capture | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Reset DFE and try again. Contact Analog Devices if the problem persists |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_EVENT_ REGISTER_FAILED |
0xE132 | Application error: Capture event registration | Operating system abstraction layer (OSAL) failed to register a capture event | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Reset DFE and try again. Contact Analog Devices if the problem persists |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_CAPTURE _START_FAILED |
0xE133 | Application error: Capture start even | Capture start error occurred | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Reset DFE and try again. Contact Analog Devices if the problem persists |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_ ABORTED_CAPTURE |
0xE134 | Application error: Capture aborted | Capture aborted due to exit request | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Reset DFE and try again. Contact Analog Devices if the problem persists |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_IN COMPLETE_CAPTURE |
0xE135 | Application error: Incomplete capture | DPD capture incomplete in CLGC peak detection mode | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Reset DFE and try again. Contact Analog Devices if the problem persists |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_TX _ORX_MAP_INVALID |
0xE136 | Application error: A Tx channel not mapped to an ORx channel | Tx to ORx map not set | ADI_ADRV904X_ ERR_ACT_CHECK_ PARAM |
Check and set Tx to ORx map |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_UNEXPE CTED_CAPTURE_ PERIOD_END_SIGNAL |
0xE137 | Application error: Unexpected capture period end signal | Unexpected capture period end signal | ADI_ADRV904X_ ERR_ACT_RESET_ FEATURE |
Contact Analog Devices |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_RX_CAPTURE _REQUEST_FAILED |
0xE138 | 8 Application error: Rx capture request failed | Invalid Rx capture request parameters | ADI_ADRV904X_ ERR_ACT_CHECK_ PARAM |
Check Rx capture request parameters are valid |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_DPD_BA D_CAPTURE_DATA |
0xE139 | Application error: Bad data captured | Bad waveform or incompleted capture | ADI_ADRV904X_ ERR_ACT_CHECK_ PARAM |
Check waveform |
ADI_ADRV904X_ DFE_APP_ERR_ CODE_CLGC_TX _ATTEN_CHANGED |
0xE13A | Application error: Tx attenuation is changed while CLGC is tracking | User initiated change | ADI_ADRV904X_ ERR_ACT_CHECK_ FEATURE |
It is mainly a warning that CLGC skips updating in the event |