This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Settings for 48Khz with 12.288MHz clock for AIC3204

Guru 15580 points

I am having trouble coming up with the correct PLL/clock settings to achieve a 48Khz sample rate, 16 bit samples, using a 12.288 MHz clock using an AIC 3204 on my custom board. Can someone give me a hand with the correct values for these parameters? Here is what I have so far, but the BCLK and WCLK are slightly high:

/* PLL and Clocks config and Power Up */
AIC3204_rset( 0, 0 );
AIC3204_rset( 27, 0x0d ); // BCLK and WCLK is set as output from AIC3204(Master)
AIC3204_rset( 28, 0x00 ); // Data offset = 0
AIC3204_rset( 4, 3 ); // PLL setting: PLLCLK <- MCLK, CODEC_CLKIN <-PLL CLK
AIC3204_rset( 6, 7 ); // PLL setting: J=7
AIC3204_rset( 7, 0x06 ); // PLL setting: HI_BYTE(D)
AIC3204_rset( 8, 0x90 ); // PLL setting: LO_BYTE(D)
AIC3204_rset( 30, 0x88 ); // For 32 bit clocks per frame in Master mode ONLY
// BCLK=DAC_CLK/N =(12,228,000/8) = 1.536MHz = 32*fs
AIC3204_rset( 5, 0x91 ); // PLL setting: Power up PLL, P=1 and R=1

__delay_cycles(20000);

AIC3204_rset( 13, 0 ); // Hi_Byte(DOSR) for DOSR = 128 decimal or 0x0080 DAC oversampling
AIC3204_rset( 14, 0x80 ); // Lo_Byte(DOSR) for DOSR = 128 decimal or 0x0080
AIC3204_rset( 20, 0x80 ); // AOSR for AOSR = 128 decimal or 0x0080 for decimation filters 1 to 6
AIC3204_rset( 11, 0x87 ); // Power up NDAC and set NDAC value to 7
AIC3204_rset( 12, 0x82 ); // Power up MDAC and set MDAC value to 2
AIC3204_rset( 18, 0x87 ); // Power up NADC and set NADC value to 7
AIC3204_rset( 19, 0x82 ); // Power up MADC and set MADC value to 2

  • You do not need to use the PLL if you want a 48kHz sampling rate and your master clock is 12.288MHz.

    You can configure the AIC3204 to use MCLK as the CODEC_CLKIN source and then configure NDAC & NADC = 2, MDAC & MADC = 1, DOSR & AOSR = 128 and this will give you 48kHz sampling rate

    (12.288 MHz / (2 * 128)) = 48kHz

  • D.

    Thanks! Works perfectly.

  • D.

    I'm afraid I spoke too soon. The WCLK is exactly 48khz, but there is now a brick wall filter effect in the audio output passband at 7.5khz. Any idea what may be causing this?

  • Are you 100% sure that the digital source material is not band limited? If you do not have any biquads enabled (and even if you did, they are all-pass by default), you should not see the sharp cut-off (especially not at ~8kHz).

    Do you measure this signal directly at the AIC3204 or is this after an analog filter on the output? The roll-off at lower frequencies also doesn't look right, assuming you measure the signal directly at the output?

  • D.

    D. Hartl said:
    Are you 100% sure that the digital source material is not band limited?

    Yes. I actually have two different boards. One uses a 12MHz crystal with the settings similar to those shown above. When I use two of these boards (audio in->ADC->I2S->DAC->audio out)  the passband is flat from 15Hz to >20KHz. However, when I use the 12.288MHz crystal with your setting on the receive side (it's actually a radio link) the passband is limited at ~7.5KHz as shown in the screen shot.

    D. Hartl said:
    If you do not have any biquads enabled

    Nope, no biquads are enabled.

    D. Hartl said:
    Do you measure this signal directly at the AIC3204 or is this after an analog filter on the output?

    This is measured directly at the output of the AIC3204. It is an identical circuit to the one that uses a 12MHz crystal, just with different initialization settings.

    D. Hartl said:
    The roll-off at lower frequencies also doesn't look right, assuming you measure the signal directly at the output?

    The low end roll off is due to undersized output capacitors on this board. This has been fixed on the newer design. As mentioned above, the new design is flat down to about 15Hz.

    Yes, this seems very strange. But I have measured it several times with the same result. Is there anything else it could be?