# Fast AGC Power Measurement Duration when using Rx FIR Output and Energy Loss Condition?

Question asked by c3commsystems on May 13, 2017

The questions and discussions in this post are related to the following few discussions:

Fast AGC does not unlock on energy lost with decimating FIR

Various Power Measurements in AD9361 Rx Chain

AD 9361 Fast Attack AGC Transition From State 2 to 3, and 3 to 5?

Based on above posts, I have the following conclusions:

(1) In order to use energy loss to unlock the gain, we have to clear Reg0x15C[D6].

(2) The selection of Reg0x15C[D6] applies to power measurement in all states of Fast AGC. So clear HB1 bit means that Fast AGC uses the RX FIR output samples for power measurement in state 2, 3 and 5.

However, I cannot use 0x15C[D3:D0] to control the Dec Power Measurement Duration. When I set 0x15C[D3:D0]=0000,  i.e., using 16 samples, the resulted AGC timing performance is OK. But, maybe due to the short duration, the resulted lock level varies significantly. Therefore, I'd like to increase the duration. With 0x15C[D3:D0]=0001, i.e., using 32 sample, the resulted AGC gain lock delayed dramatically and ended up unusable. Please talk a look at the following.

In this test setup, Rx FIR has a 2x decimation rate. Settling delay is 20 samples (0x111[D4:D0] = 01010). The targeted lock level is -18 dB from the full scale. The samples are recorded using 16 bits including sign, so the full scale power is about 90 dB and the targeted lock level is about 72 dB.

Fig. 1: Dec Power Measurement Duration is 16 samples (0x15C[D3:D0]=0000). The top figure is received real samples, the middle figure is the calculated power in dB. The bottom is a zoomed-in version of the middle figure.

The timing performance of Fast AGC is acceptable, as we can see from above. From the zoomed view, the AGC power adjustment takes about 130 samples. It is NOT clear to me  how this 130 samples relates to the 16-sample Dec Power Measurement Duration, but it works. On the other hand, the lock level may not be 72 dB as you can tell from the two bursts shown above.

I hope to get a better power estimation results by increasing the Dec Power Measurement Duration for state 2/3. So I increased the Dec Power Measurement Duration to 32. NO other changes at all. Now the performance is no longer acceptable.

Fig 2: Dec Power Measurement Duration is 16 samples (0x15C[D3:D0]=0001).

From the zoomed view, you can see that it took about 1600 samples for the gain change to take effect. And the lock level is still not ideal.

Two more observations:

(1) I also tried using 64 samples as the Dec Power Measurement Duration, the results are even worse. No gain changes at all for the complete packet duration. In other words, the whole burst is over ranged.

(2) Instead of sending out bursts, I used a continuous signal by reducing the gap between consecutive bursts to zeros. Without changing the RX settings, the AGC lock level performs perfectly. Any piece of recorded samples has a power level of 72 dB. In this scenario, the energy loss condition never triggers so when the gain locks, it stays. Nevertheless, the Dec Power Measurement Duration is still 32, it is amazing that the locking level is so accurate.

Looks like my problem is related with gain unlocking due to energy loss. In this case, Dec Power measurement Duration behaves differently from that explained in UG. Can someone help ?