8.3.8.3 AGC
The TLV320ADC3100 includes automatic gain control (AGC) for ADC recording. AGC can be used to maintain a nominally constant output level when recording speech. As opposed to manually setting the PGA gain, in the AGC mode, the circuitry automatically adjusts the PGA gain as the input signal becomes overly loud or very weak, such as when a person speaking into a microphone moves closer to or farther from the microphone. The AGC algorithm has several programmable parameters (including target gain, attack and decay time constants, noise threshold, and maximum PGA applicable) that allow the algorithm to be fine-tuned for any particular application. The algorithm uses the absolute average of the signal (which is the average of the absolute value of the signal) as a measure of the nominal amplitude of the output signal. Because the gain can be changed at the sample interval time, the AGC algorithm operates at the ADC sample rate.
- Target level represents the nominal output level at which the AGC attempts to hold the ADC output signal level. The TLV320ADC3100 allows programming of eight different target levels that can be programmed from –5.5 dB to –24 dB relative to a full-scale signal. Because the TLV320ADC3100 reacts to the signal absolute average and not to peak levels, TI recommends that the target level be set with enough margin to avoid clipping at the occurrence of loud sounds.
- Attack time determines how quickly the AGC circuitry reduces the PGA gain when the output signal level exceeds the target level resulting from an increase in input signal level. A wide range of attack-time programmability is supported in terms of number of samples (that is, the number of ADC sample-frequency clock cycles).
- Decay time determines how quickly the PGA gain is increased when the output signal level falls below the target level resulting from a reduction in input signal level. A wide range of decay-time programmability is supported in terms of number of samples (that is, the number of ADC sample-frequency clock cycles).
- Noise threshold. If the input signal level falls below the noise threshold, the AGC considers the duration that the signal level remains below the threshold as silence, and thus brings down the gain to 0 dB in steps of 0.5 dB every sample period and sets the noise-threshold flag. The gain stays at 0 dB unless the input signal average rises above the noise threshold setting, thus preventing noise from being amplified in the absence of a signal. The noise threshold level in the AGC algorithm is programmable from –30 dB to –90 dB of full-scale. When the AGC noise threshold is set to –70 dB, –80 db, or –90 dB, the maximum applicable microphone input PGA setting must be greater than or equal to 11.5 dB, 21.5 dB, or 31.5 dB, respectively. This operation includes hysteresis and debounce to prevent the AGC gain from cycling between high gain and 0 dB when signals are near the noise threshold level. The noise (or silence) detection feature can also be entirely disabled.
- Maximum applicable PGA allows the maximum gain applied by the AGC to be restricted. This restriction can be used for limiting PGA gain in situations where environmental noise is greater than the programmed noise threshold. Microphone input maximum PGA can be programmed from 0 dB to 40 dB in steps of 0.5 dB.
- Hysteresis, as the name suggests, determines a window around the noise threshold that must be exceeded to detect if the recorded signal is indeed either noise or signal. If the energy of the recorded signal is initially greater than the noise threshold, then the AGC recognizes the signal as noise only when the energy of the recorded signal falls below the noise threshold by a value given by hysteresis. Similarly, after the recorded signal is recognized as noise, for the AGC to recognize the sound as a signal, its energy must exceed the noise threshold by a value given by the hysteresis setting. In order to prevent the AGC from jumping between noise and signal states (which can happen when the energy of the recorded signal is very close to the noise threshold), a non-zero hysteresis value must be chosen. The hysteresis feature can also be disabled.
- Debounce time (noise and signal) determines the hysteresis in time domain for noise detection. The AGC continuously calculates the energy of the recorded signal. If the calculated energy is less than the set noise threshold, then the AGC does not increase the input gain to achieve the target level. However, to handle audible artifacts that can occur when the energy of the input signal is very close to the noise threshold, the AGC checks if the energy of the recorded signal is less than the noise threshold for a duration greater than the noise debounce time. Similarly, the AGC starts increasing the input-signal gain to reach the target level when the calculated energy of the input signal is greater than the noise threshold. Again, to avoid audible artifacts when the input-signal energy is very close to noise threshold, the energy of the input signal must continuously exceed the noise threshold value for the signal debounce time. If the debounce times are kept very small, then audible artifacts can result by rapidly enabling and disabling the AGC function. At the same time, if the debounce time is kept too large, then the AGC can take more time to respond to changes in input signal levels with respect to the noise threshold. Both noise and signal debounce time can be disabled.
- The AGC noise threshold flag is a read-only flag indicating that the input signal has levels lower than the noise threshold, and thus is detected as noise (or silence). In such a condition, the AGC applies a gain of 0 dB.
- Gain applied by the AGC is a read-only register setting that gives a real-time feedback to the system on the gain applied by the AGC to the recorded signal. This setting, along with the target setting, can be used to determine the input signal level. In a steady state situation:
Target level (dB ) = gain applied by AGC (dB) + input signal level (dB)
When the AGC noise threshold flag is set, then the status of the gain applied by the AGC is not valid.
- The AGC saturation flag is a read-only flag indicating that the ADC output signal has not reached its target level. However, the AGC is unable to increase the gain further because the required gain is higher than the maximum allowed PGA gain. Such a situation can happen when the input signal has very low energy and the noise threshold is also set very low. When the AGC noise threshold flag is set, the status of the AGC saturation flag must be ignored.
- The ADC saturation flag is a read-only flag indicating an overflow condition in the ADC channel. On overflow, the signal is clipped and distortion results. This distortion typically happens when the AGC target level is kept very high and the energy in the input signal increases faster than the attack time.
- An AGC low-pass filter is used to help determine the average level of the input signal. This average level is compared to the programmed detection levels in the AGC to provide the correct functionality. This low-pass filter is in the form of a first-order IIR filter. Two 8-bit registers are used to form the 16-bit digital coefficient, as shown in the Register Maps section. In this way, a total of six registers are programmed to form the three IIR coefficients. Equation 2 shows how the transfer function of the filter is implemented for signal-level detection:
Equation 2.
where
- Coefficient N0 can be programmed by writing into page 4, registers 2 and 3
- Coefficient N1 can be programmed by writing into page 4, registers 4 and 5
- Coefficient D1 can be programmed by writing into page 4, registers 6 and 7
- N0, N1, and D1 are 16-bit, 2s-complement numbers, and their default values implement a low-pass filter with cutoff at 0.002735 × ADC_fS
Table 3 lists various AGC programming options. The AGC can be used only if the analog microphone input is routed to the ADC channel.
Figure 28 illustrates the input and output signals along with the decay and attack times of the AGC.
Table 3. AGC Parameter Settings
FUNCTION |
CONTROL REGISTER
LEFT ADC |
CONTROL REGISTER
RIGHT ADC |
BIT |
AGC enable |
Page 0, register 86 |
Page 0, register 94 |
7 |
Target level |
Page 0, register 86 |
Page 0, register 94 |
6:4 |
Hysteresis |
Page 0, register 87 |
Page 0, register 95 |
7:6 |
Noise threshold |
Page 0, register 87 |
Page 0, register 95 |
5:1 |
Maximum applicable PGA |
Page 0, register 88 |
Page 0, register 96 |
6:0 |
Time constants (attack time) |
Page 0, register 89 |
Page 0, register 97 |
7:0 |
Time constants (decay time) |
Page 0, register 90 |
Page 0, register 98 |
7:0 |
Debounce time (noise) |
Page 0, register 91 |
Page 0, register 99 |
4:0 |
Debounce time (signal) |
Page 0, register 92 |
Page 0, register 100 |
3:0 |
Gain applied by the AGC |
Page 0, register 93 |
Page 0, register 101 |
7:0 (read-only) |
AGC noise-threshold flag |
Page 0, register 45 (sticky flag),
Page 0, register 47 (non-sticky flag) |
Page 0, register 45 (sticky flag),
Page 0, register 47 (non-sticky flag) |
6:5 (read-only) |
AGC saturation flag |
Page 0, register 36 (sticky flag) |
Page 0, register 36 (sticky flag) |
5, 1 (read-only) |
ADC saturation flag |
Page 0, register 42 (sticky flag),
Page 0, register 43 (non-sticky flag) |
Page 0, register 42 (sticky flag),
Page 0, register 43 (non-sticky flag) |
3:2 (read-only) |
The TLV320ADC3100 includes two analog audio input pins, which can be configured as one fully-differential pair and one single-ended input, or as three single-ended audio inputs. These pins connect through series resistors and switches to the virtual ground terminals of two fully differential operational amplifiers (one per ADC and PGA channel). By selecting to turn on only one set of switches per operational amplifier at a time, the inputs can be effectively multiplexed to each ADC PGA channel.
By selecting to turn on multiple sets of switches per operational amplifier at a time, mixing can also be achieved. Mixing of multiple inputs can easily lead to PGA outputs that exceed the range of the internal operational amplifiers, resulting in saturation and clipping of the mixed output signal. Whenever mixing is being implemented, take adequate precautions to avoid such a saturation case from occurring. In general, the mixed signal must not exceed 2 VPP (single-ended) or 4 VPP (differential).
In most mixing applications, there is also a general requirement to adjust the levels of the individual signals being mixed. For example, if a soft signal and a large signal are to be mixed and played together, the soft signal generally must be amplified to a level comparable to the large signal before mixing. In order to accommodate this requirement, the TLV320ADC3100 includes an input level control on each of the individual inputs before they are mixed or multiplexed into the ADC PGAs, with programmable attenuation at 0 dB, –6 dB, or off.
NOTE
This input-level control is not intended to be a volume control, but instead used for coarse level setting. Finer soft-stepping of the input level is implemented in this device by the ADC PGA.
Figure 29 shows various available configurations for the audio input.
Table 4 lists the available routing configurations for the audio signals on the TLV320ADC3100.
Table 4. TLV320ADC3100 Audio Signals
AUDIO SIGNALS AVAILABLE TO THE LEFT ADC |
AUDIO SIGNALS AVAILABLE TO THE RIGHT ADC |
SINGLE-ENDED INPUTS |
DIFFERENTIAL INPUTS |
SINGLE-ENDED INPUTS |
DIFFERENTIAL INPUTS |
IN2L(P) |
IN2L(P), IN3L(M) |
IN2R(P) |
IN2R(P), IN3R(M) |
IN3L(M) |
IN2R(P), IN3R(M) |
IN3R(M) |
IN2L(P), IN3L(M) |
Inputs can be selected as single-ended instead of fully differential, and mixing or multiplexing into the ADC PGAs is also possible in this mode. However, an input pair cannot be selected as fully differential for connection to one ADC PGA and simultaneously selected as single-ended for connection to the other ADC PGA channel. However, an input can be selected or mixed into both the left and right channel PGAs, as long as the PGA has the same configuration for both channels (either both single-ended or both fully differential).