Post Go back to editing

What does apdUpperThreshPeakExceededCnt actually count?

Thread Summary

The user inquired about the functionality of apdUpperThreshPeakExceededCnt and apdLowerThreshPeakExceededCnt, specifically whether they count samples, local maxima, or signal power/amplitude. The final answer clarified that these counters count AGC clock cycles where the APD thresholds are exceeded. The user also reported an issue with AGC recovery when the signal falls below the underload threshold (-32 dBFS) after fast attack is enabled, which the support engineer confirmed and noted that the issue occurs when the underload threshold is set below -23 dBFS. The problem has been raised internally for resolution.
AI Generated Content
Category: Software
Product Number: ADRV9002
Software Version: 26.0

Hello,

As per the title, what exactly does apdUpperThreshPeakExceededCnt / apdLowerThreshPeakExceededCnt actually count?

Is it samples?

Is it local maxima?

Are the peaks counted on the instantaneous power of the received signal or on the on the received signal amplitude?

Thank you in advance.

K.

Parents
  • Hi,

    I'll look into this question. The user guide section 'Analog Peak Detector (APD)' gives some  details on the general function of the detector.

    Regards,

    Conrad

  • Thank you Conrad.

    I have already read the APD section in the user guide, but it didn't seem very helpful with regard to my issue.

  • Hi,

    We are writing up an explanation for the question, we will get back to you.

    Regards

    Rahul  

  • Automatic Gain Control (AGC) has two modes of operation

    • Normal Mode
    • Fast Attack Mode

    Note: Assume the clock counter limit is 8 clock cycle.

    Normal Mode:

    Figure 1: Normal Mode

    Figure 1 illustrates the operation of the Normal mode AGC. During the first period, when the signal's peak power exceeds the threshold, the AGC clock counter begins counting. At some point within the first period (indicated in green), the AGC clock counter exceeds the required number of clock cycles. At the end of the first period, the attenuation levels are applied, reducing the signal's power below the threshold, and simultaneously, the AGC clock counter resets.

    In the second period, the signal again crosses the threshold, causing the AGC counter to start counting the clock cycles. However, before the counter exceeds the required number of cycles, the signal’s power drops below the threshold. Since the AGC counter doesn’t reach the necessary count, the attenuation is not triggered, and by the end of the second period, the AGC counter resets.

    Note: The 1st and 2nd periods are the gain update period which is set by the user in TES.

    Fast Attack Mode:

    Figure 2: Fast Attack Mode

    In this case, the key difference is when the attenuation is applied. During the first period, the signal exceeds the threshold, causing the AGC clock counter to surpass the clock cycle limit, triggering the attenuation immediately and resets the AGC counter. At the end of the first period, again AGC counter resets.

    In the second period, the signal once again exceeds the threshold, and the AGC clock counter reaches 4 clock cycles before the signal falls back below the threshold. After some time within the same period, the signal power rises above the threshold again, and the AGC clock counter continues counting, now reaching 10 clock cycles. This exceeds the AGC clock counter limit, triggering the attenuation. Here the AGC clock counter resets once the attenuation is triggered to take care of the situation where signal peak power goes above the threshold again within the same period as shown in the figure 2.

    Regards

    Rahul

  • Hi and thanks for the thorough reply. Through TES I have noticed that the lowest value I can set Gain Refresh Period to is 50.5us whether I have Fast Attack option enabled or not. Is that valid, is it really 50.5us the lowest value I can set it to when I have fast attack enabled or can it go even lower? Thank you.

  • Hi,

    In fast attack mode, the update happens whenever the signal exceeds the threshold, causing the AGC clock counter to surpass the clock cycle limit.

    Regards

    Rahul 

  • Hi,

    You didn’t answer my question though. I was asking about the Gain Refresh Period which you have denoted with vertical dashed lines in Figure 2. Does it go lower than 50.5us when fast attack is enabled or not?

  • Hi,

    Yes, we have been actively working on your request. It requires careful analysis to ensure accuracy before providing our recommendation, which is why our response may take some time. 

    We can reduce the gain update period below 50.5µs using Python or C. The core issue lies in the Rx gain. Attenuation occurs correctly during high signal power, but the system fails to apply the corresponding gain increase when the signal returns to normal. Since attenuation is applied instantly, whereas applying gain takes time, the minimum value for the gain update period is 50.5 us. 

    Regards

    Rahul

  • Hi,

    So basically what you are saying is that if I am using C code I can reduce the gain update period to a value lower than 50.5us? That way would gain (recovery) be applied faster when the signal level returns to normal ? Can you please explain in the simple recovery case, i.e., no "fast recovery", how are the parameters hbUnderRangeHighThreshCount, hbOverloadThreshCount and hbOverloadDurationCount connected to one another with an example like you did with the attack scenario?

  • Hi,

    any news yet regarding the recovery process of the AGC?

    Thank you.

  • Hi,

    We can reduce the gain update period below 50.5µs using Python or C. The core issue lies in the Rx gain. Attenuation occurs correctly during high signal power, but the system fails to apply the corresponding gain increase when the signal returns to normal. Since attenuation is applied instantly, whereas applying gain takes time, the minimum value for the gain update period is 50.5 us. 

    As I suggested, the minimum gain update period is 50.5us, you can set the value less than 50.5us but the issue is with the applying gain for example if you gain index is around 230 and at this time you signal power is reduced then the gain index should increment from 230 to lets say 240. This wont happen when the gain refresh period is less than 50.5us but decrementing the gain index will work. 

    Now coming to the parameters:

    The four-parameter feedback_inner_high_inner_low ,feedback_apd_high_apd_low, feedback_apd_low_hb_low & feedback_apd_high_hb_high are the threshold counter exceed status. There are two mode one is peak only where the analog peak detector and half band peak detector are considered i.e., feedback_apd_low_hb_low & feedback_apd_high_hb_high whereas in the case of peak and power mode, analog peak and power detectors are considered i.e., feedback_inner_high_inner_low & feedback_apd_high_apd_low. The GIPO pins are the used for indicating the over range and under range condition of the detectors (Analog peak detector(APD), Half-Band Peak detector and Power detector(rms and dynamic range of 60dB)).
    • feedback_apd_low_hb_low: Analog peak detector lower and Half band detector lower
    • feedback_apd_high_hb_high: Analog peak detector higher and Half band detector higher
    • feedback_inner_high_inner_low: Power detector higher and lower
    • feedback_apd_high_apd_low: Analog peak detector higher and lower
    Please refer to the user guide description and the Rx block chain below:



    In order to use the peak or peak + power detection mode, you can choose this option under the Gain control tab in TES and for assigning the GPIO that can be done under the GPIO tab of TES. You can also assign all the parameter details by modifying the below data structure.



    Data structure



    Data structure



    Power detector
    The figure below shows the example using the just the power detector and the parameters (overRangeHighPowerTresh, overRangeLowPowerTresh, underRangeHighPowerTresh and underRangeLowPowerTresh) are related to the power detector.



    The GPIO are the indicator of the inner high and low i.e., OverRangeLowerTresh and underRangeHighPowerTresh. This is also mentioned in the user guide as shown below:



    Peak detector
    The below figure shows the AGC working using the peak detector, here the peak detector has two level of threshold lower and higher i.e., apdHigherThresh is related to APD Hi Thrshld Counter Exceeded (GPIO 7) and apdLowThresh is related to APD Lo Thrshld Count Exceeded (GPIO 5).



    One can calculate the values of the lower and higher threshold value of analog peak detector are shown below

    For instance, if the peak underload threshold value is -9dBFS then the apdLowThresh will be 18

    Half Band detector
    The below figure shows the operation of the half band peak detector, here you can see 4 different threshold values (hbHighThresh, hbUnderRangeLowThresh, hbUnderRangeMidThresh & hbUnderRangeHighThresh). These levels are made so that the signal increment is in a ramp up manner as highlighted in the figure below:

    More information on GPIO:
    As can be seen from the below figures, the DGPIO pins from 4-7 are used for both the mode i.e., peak mode & power + peak mode. For instance, in peak mode, DGPIO 4 is assigned to feedback mask bit position to 0 (hb_low_threshold_counter_exceeded).


    Similarly, I have made the relation table for each mode and GPIO pin using the above figure



    Experiments:
    Case 1 (Peak Mode): In this case we have tested the peak mode option where the APD & HB peak detector LO and HI threshold are assigned to respective GPIO as shown below



    Step 1: When the signal power was well below the threshold values of APD and HB detector. You can see the GPIO pins are low.

    Step 2: When increasing the signal power, we can observe that the APD lower threshold exceeded

    Step 3 : When increasing the signal power further we can observe that HB lower threshold get exceeded, then APD higher and last the HB high. Please find the sequence below





    Case 2 (Power and Peak Mode): In this case we have tested the power and peak mode option where the power inner higher and lower is assigned to gpio 1 & 0 respectively whereas gpio 3 & 2 are assigned to APD high and lower threshold respectively.

    Power under load



    Peak lower threshold exceeded



    Peak higher threshold exceeded



    Power overloaded

    Regards

    Rahul

Reply
  • Hi,

    We can reduce the gain update period below 50.5µs using Python or C. The core issue lies in the Rx gain. Attenuation occurs correctly during high signal power, but the system fails to apply the corresponding gain increase when the signal returns to normal. Since attenuation is applied instantly, whereas applying gain takes time, the minimum value for the gain update period is 50.5 us. 

    As I suggested, the minimum gain update period is 50.5us, you can set the value less than 50.5us but the issue is with the applying gain for example if you gain index is around 230 and at this time you signal power is reduced then the gain index should increment from 230 to lets say 240. This wont happen when the gain refresh period is less than 50.5us but decrementing the gain index will work. 

    Now coming to the parameters:

    The four-parameter feedback_inner_high_inner_low ,feedback_apd_high_apd_low, feedback_apd_low_hb_low & feedback_apd_high_hb_high are the threshold counter exceed status. There are two mode one is peak only where the analog peak detector and half band peak detector are considered i.e., feedback_apd_low_hb_low & feedback_apd_high_hb_high whereas in the case of peak and power mode, analog peak and power detectors are considered i.e., feedback_inner_high_inner_low & feedback_apd_high_apd_low. The GIPO pins are the used for indicating the over range and under range condition of the detectors (Analog peak detector(APD), Half-Band Peak detector and Power detector(rms and dynamic range of 60dB)).
    • feedback_apd_low_hb_low: Analog peak detector lower and Half band detector lower
    • feedback_apd_high_hb_high: Analog peak detector higher and Half band detector higher
    • feedback_inner_high_inner_low: Power detector higher and lower
    • feedback_apd_high_apd_low: Analog peak detector higher and lower
    Please refer to the user guide description and the Rx block chain below:



    In order to use the peak or peak + power detection mode, you can choose this option under the Gain control tab in TES and for assigning the GPIO that can be done under the GPIO tab of TES. You can also assign all the parameter details by modifying the below data structure.



    Data structure



    Data structure



    Power detector
    The figure below shows the example using the just the power detector and the parameters (overRangeHighPowerTresh, overRangeLowPowerTresh, underRangeHighPowerTresh and underRangeLowPowerTresh) are related to the power detector.



    The GPIO are the indicator of the inner high and low i.e., OverRangeLowerTresh and underRangeHighPowerTresh. This is also mentioned in the user guide as shown below:



    Peak detector
    The below figure shows the AGC working using the peak detector, here the peak detector has two level of threshold lower and higher i.e., apdHigherThresh is related to APD Hi Thrshld Counter Exceeded (GPIO 7) and apdLowThresh is related to APD Lo Thrshld Count Exceeded (GPIO 5).



    One can calculate the values of the lower and higher threshold value of analog peak detector are shown below

    For instance, if the peak underload threshold value is -9dBFS then the apdLowThresh will be 18

    Half Band detector
    The below figure shows the operation of the half band peak detector, here you can see 4 different threshold values (hbHighThresh, hbUnderRangeLowThresh, hbUnderRangeMidThresh & hbUnderRangeHighThresh). These levels are made so that the signal increment is in a ramp up manner as highlighted in the figure below:

    More information on GPIO:
    As can be seen from the below figures, the DGPIO pins from 4-7 are used for both the mode i.e., peak mode & power + peak mode. For instance, in peak mode, DGPIO 4 is assigned to feedback mask bit position to 0 (hb_low_threshold_counter_exceeded).


    Similarly, I have made the relation table for each mode and GPIO pin using the above figure



    Experiments:
    Case 1 (Peak Mode): In this case we have tested the peak mode option where the APD & HB peak detector LO and HI threshold are assigned to respective GPIO as shown below



    Step 1: When the signal power was well below the threshold values of APD and HB detector. You can see the GPIO pins are low.

    Step 2: When increasing the signal power, we can observe that the APD lower threshold exceeded

    Step 3 : When increasing the signal power further we can observe that HB lower threshold get exceeded, then APD higher and last the HB high. Please find the sequence below





    Case 2 (Power and Peak Mode): In this case we have tested the power and peak mode option where the power inner higher and lower is assigned to gpio 1 & 0 respectively whereas gpio 3 & 2 are assigned to APD high and lower threshold respectively.

    Power under load



    Peak lower threshold exceeded



    Peak higher threshold exceeded



    Power overloaded

    Regards

    Rahul

Children

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.