I'm trying to setup the AGC on the AIC320TLV3206 and it seems to do nothing except immediately attenuate the signal and then never change after that regardless of input level.
When I investigate, several registers have unexpected values:
- The read-only AGC Gain Flag (page 0, reg 93) reads as 11100111 (or -12.5dB) which is outside and below the specified range of 1110 1000 to 0111 0100. The AGC is supposed to only reduce gain by as much as -12dB. How does this register ever get to 11100111?
- Even though the AGC Gain Flag reports negative gain, the ADC Fags register (page 0, reg 36) bits D5 and D1 are set indicating that the AGC gain is at the maximum allowed by the Max AGC Gain setting. This is obviously not the case because I read the Max AGC Gain (page 0, reg 93) and it is 0111 0100.
- How can the ADC Gain Status flag be set when the AGC Gain is negative and below the Max AGC Gain?
- I have adjusted the noise threshold to very high and very low and the noise flag never gets set.
When I disable the AGC, the analog bypass works well is is loud but when I enable it, the volume is very much attenuated. The PGA Gain setting (page 0, reg 59) remains unchanged with or without the AGC on.
My setup is as follows:
- Analog bypass with a mic connected to IN1 ==> PGA ==> Mixer Amp ==> Headphone Amp
- ADC is powered on at a 31.25kHz sample rate
I initialize the codec like this:
- Reset
- Setup power and clocks
- Setup the AGC
- Setup and power on the ADC
- Configure the signal routing and coupling
- Set gains on PGA, MA, and analog Volume
These are the AGC settings:
agc1.enabled = 1; agc1.target = 0; // 0 ~ 7 = -5.5 ~ -24.0dBFS agc1.gain_hysteresis = 0; // 0 ~ 3 = 0.5dB ~ 1.5dB agc1.rsvd = 0; agc2.hysteresis = 0; // 0 ~ 2 = 1dB - 4dB, 3 = disabled agc2.noise_threshold = 0; // 0 ~ 31 = -30dB ~ -90dB agc2.rsvd = 0; agc3.max_gain = 0b1110100; // 0b1110100 = 58dB agc3.rsvd = 0; agc4.attack_time = 0; // 0 ~ 31 = 1 ~ 63*ticks agc4.attack_time_scale = 0; // 0 ~ 7 = 1 ~ 128 agc5.decay_time = 0; // 0 ~ 31 = 1 ~ 63*ticks agc5.decay_time_scale = 0; // 0 ~ 7 = 1 ~ 128 agc6.noise_debounce = 0; agc6.rsvd = 0; agc7.signal_debounce = 0; agc7.rsvd = 0;
Do you have any suggestions for other things to check? Is is possible to tell if the ADC is even setup properly?
Thanks very much for your help!