English
Language : 

SGTL5000XNAA3 Datasheet, PDF (49/84 Pages) Freescale Semiconductor, Inc – Low Power Stereo Codec with Headphone Amp
DATASHEET
SGTL5000
6.2.4.5. Automatic Volume Control (AVC)
The AVC on/off function will be typically controlled by the end-user. End-user driven
programming steps are shown in section 6.3.
The default configuration of the AVC should work for most applications. However,
the following example shows how to change the configuration if needed.
// Configure threshold to -18dB
Write DAP_AVC_THRESHOLD 0x0A40
// Configure attack rate to 16dB/s
Write DAP_AVC_ATTACK 0x0014
// Configure decay rate to 2dB/s
Write DAP_AVC_DECAY 0x0028
6.2.5.
I2S Configuration
By default the I2S port on the chip is configured for 24-bits of data in I2S format with
SCLK set for 64*Fs. This can be modified by setting various bit-fields in
CHIP_I2S_CTRL register.
6.2.6. Volume Control
The outputs should be unmuted after all the configuration is complete.
//---------------- Input Volume Control---------------------
// Configure ADC left and right analog volume to desired default.
// Example shows volume of 0dB
Write CHIP_ANA_ADC_CTRL 0x0000
// Configure MIC gain if needed. Example shows gain of 20dB
Modify CHIP_MIC_CTRL->GAIN 0x0001 // bits 1:0
//---------------- Volume and Mute Control---------------------
// Configure HP_OUT left and right volume to minimum, unmute
// HP_OUT and ramp the volume up to desired volume.
Write CHIP_ANA_HP_CTRL 0x7F7F
Modify CHIP_ANA_CTRL->MUTE_HP 0x0000 // bit 5
// Code assumes that left and right volumes are set to same value
// So it only uses the left volume for the calculations
usCurrentVolLeft = 0x7F;
usNewVolLeft = usNewVol & 0xFF;
usNumSteps = usNewVolLeft - usCurrentVolLeft;
if (usNumSteps == 0) return;
// Ramp up
for (int i = 0; i < usNumSteps; i++ )
{
++usCurrentVolLeft;
usCurrentVol = (usCurrentVolLeft << 8) | (usCurrentVolLeft);
Write CHIP_ANA_HP_CTRL usCurrentVol;
}
// LINEOUT and DAC volume control
Modify CHIP_ANA_CTRL->MUTE_LO 0x0000 // bit 8
// Configure DAC left and right digital volume.
// volume of 0dB
Example shows
SGTL5000 EA2 DS-0-3
49