English
Language : 

SGTL5000XNAA3R2 Datasheet, PDF (26/68 Pages) Freescale Semiconductor, Inc – Low Power Stereo Codec with Headphone Amp
FUNCTIONAL DEVICE OPERATION
PROGRAMMING EXAMPLES
PROGRAMMING EXAMPLES
This section provides programming examples showing
how to configure the chip. The registers can be written/read
by using I2C communication protocol. The chip also supports
SPI communication protocol (not supported in the 20 QFN
package), but only register write operation is supported.
PROTOTYPE FOR READING AND WRITING A REGISTER
The generic register read write prototype is used
throughout this section, as shown by the following. The I2C or
SPI implementation is specific to the I2C/SPI hardware used
in the system.
// This prototype writes a value to the entire register. All
// bit-fields of the register will be written.
Write REGISTER REGISTERVALUE
// This prototype writes a value only to the bit-field specified.
// In the actual implementation, the other bit-fields should be
// masked to prevent them from being written. Also, the
// actual implementation should left-shift the BITFIELDVALUE
// by appropriate number to match the starting bit location of
// the BITFIELD.
Modify REGISTER -> BITFIELD, BITFIELDVALUE //Bitfield
Location
// Example implementation
// Modify DAP_EN (bit 0) bit to value 1 to enable DAP block
Modify(DAP_CONTROL_REG, 0xFFFE, 1 <<
DAP_EN_STARTBIT);
// Example Implementation of Modify
void Modify(unsigned short usRegister,
unsigned short usClearMask,
unsigned short usSetValue)
{
unsigned short usData;
// 1) Read current value
ReadRegister(usRegister, &usData);
// 2) Clear out old bits
usData = usData & usClearMask;
// 3) set new bit values
usData = usData | usSetValue;
// 4) Write out new value created
WriteRegister(usRegister, usData);
}
CHIP CONFIGURATION
All outputs (LINEOUT, HP_OUT, I2S_OUT) are muted by
default on power up. To avoid any pops/clicks, the outputs
should remain muted during these chip configuration steps.
Refer to Volume Control for volume and mute control.
Initialization
Chip Powerup and Supply Configurations
After the power supplies for the chip are turned on, the
following initialization sequence should be followed. Please
note that certain steps may be optional or different values
may need to be written based on the power supply voltage
used and desired configuration. The initialization sequence
below assumes VDDIO = 3.3 V and VDDA = 1.8 V.
//--------------- Power Supply Configuration----------------
// NOTE: This next 2 Write calls is needed ONLY if VDDD is
// internally driven by the chip
// Configure VDDD level to 1.2V (bits 3:0)
Write CHIP_LINREG_CTRL 0x0008
// Power up internal linear regulator (Set bit 9)
Write CHIP_ANA_POWER 0x7260
// NOTE: This next Write call is needed ONLY if VDDD is
// externally driven
// Turn off startup power supplies to save power (Clear bit 12 and
13)
Write CHIP_ANA_POWER 0x4260
// NOTE: The next 2 Write calls is needed only if both VDDA and
// VDDIO power supplies are less than 3.1V.
// Enable the internal oscillator for the charge pump (Set bit 11)
Write CHIP_CLK_TOP_CTRL 0x0800
// Enable charge pump (Set bit 11)
Write CHIP_ANA_POWER 0x4A60
// NOTE: The next 2 modify calls is only needed if both VDDA and
// VDDIO are greater than 3.1 V
// Configure the charge pump to use the VDDIO rail (set bit 5 and
bit 6)
Write CHIP_LINREG_CTRL 0x006C
//---- Reference Voltage and Bias Current Configuration----
// NOTE: The value written in the next 2 Write calls is dependent
// on the VDDA voltage value.
// Set ground, ADC, DAC reference voltage (bits 8:4). The value
should
// be set to VDDA/2. This example assumes VDDA = 1.8 V.
VDDA/2 = 0.9 V.
// The bias current should be set to 50% of the nominal value (bits
3:1)
Write CHIP_REF_CTRL 0x004E
// Set LINEOUT reference voltage to VDDIO/2 (1.65 V) (bits 5:0)
and bias current (bits 11:8) to the recommended value of 0.36 mA
for 10 kOhm load with 1.0 nF capacitance
Write CHIP_LINE_OUT_CTRL 0x0322
//------------Other Analog Block Configurations--------------
// Configure slow ramp up rate to minimize pop (bit 0)
Write CHIP_REF_CTRL 0x004F
// Enable short detect mode for headphone left/right
// and center channel and set short detect current trip level
// to 75 mA
Write CHIP_SHORT_CTRL 0x1106
// Enable Zero-cross detect if needed for HP_OUT (bit 5) and ADC
(bit 1)
SGTL5000
26
Analog Integrated Circuit Device Data
Freescale Semiconductor