UM10208_2
© NXP B.V. 2007. All rights reserved.
User manual
Rev. 02 — 1 June 2007
282 of 362
NXP Semiconductors
UM10208
Chapter 22: LPC2800 DDAC
6.
Programming the Dual DAC and SAO2
6.1 Setting up the Dual DAC and SAO2
System initialization (reset) code should include the following steps if the Dual DAC and
SAO2 are used in the application:
1. Write the Stream I/O Configuration register with the prescribed/fixed bits. If the DAI is
used for I
2
S input, be sure that the DAI_OE bit is set properly for the DAI mode (see
).
2. Write the DDACCTRL and DDACSET registers with the desired values. Set PD in
DDACCTRL to 1 initially, per step 1 of
below.
3. Program the CGU to provide the following clocks:
a. 128 fs on its DDAC_DCLK output
b. 256 fs on its DDAC_CLK output if 8 kHz
≤
fs
≤
32 kHz and the MODE field in
DDACCTRL is 00, otherwise 128 fs on DDAC_CLK.
c. fs on its DAO_WS output (this signal is used for both the DAO and the dual DAC)
4. Perform the power-up procedure described in
below.
5. Write the SAO2 Interrupt Request register in the interrupt controller (INT_REQ21 -
0x8030 0464) to enable SAO2 interrupts at the desired priority level (see
6. Write the SAO2 Mask register with zero(es) in the desired interrupt condition(s). For
fully interrupt-driven applications, write a 0 to the LMTMK or LHALFMK bit (or RMTMK
or RHALFMK if only the R channel is used). For DMA operation, write a 0 to LUNDER
and/or RUNDER to allow interrupt for underrun (which indicates an error in DMA
operation or programming).
Since L and R values are removed from the SAO simultaneously, except for LUNDER and
RUNDER when using two DMA channels, there is no reason to enable both L and R
interrupts.
6.2 Power-up procedure
Transients (“plop”) on the AOUTL and AOUTR pins can be prevented by following the
following steps when powering up the Dual DAC:
1. Write DDACCTRL with a 1 in the PD bit.
2. Poll DDACSTAT until the PDOWN bit is 1.
3. Write DDACSET with 1 in LDYNPON and/or RDYNPON. This powers up the DAC(s).
4. Write DDACCTRL with a 0 in the PD bit.
5. Poll DDACSTAT until the MUTE bit is 0.
6.3 Power-down procedure
Transients (“plop”) on the AOUTL and AOUTR pins can be prevented by following the
following steps when powering down the Dual DAC:
1. Write DDACCTRL with a 1 in the PD bit.
2. Poll DDACSTAT until the PDOWN bit is 1.