3.1.1 Audio PLL Initialization

The code snippet given below initializes the Audio PLL to output AUDIOPLLCK at a frequency of 98.304 MHz with a 12 MHz reference input clock frequency.

/* Disable Audio PLL */
PMC->PMC_AUDIO_PLL0 = 0;

/* Set Audio PLL in active state */
PMC->PMC_AUDIO_PLL0 = PMC_AUDIO_PLL0_RESETN;

/* Set Audio PLL parameters – Numbers calculated in trial and error for above spec */
PMC->PMC_AUDIO_PLL0 |= PMC_AUDIO_PLL0_ND(56) | PMC_AUDIO_PLL0_QDPMC(6);

PMC->PMC_AUDIO_PLL1 = PMC_AUDIO_PLL1_FRACR(1442840);

/* Enable Audio PLL */
PMC->PMC_AUDIO_PLL0 |= PMC_AUDIO_PLL0_PLLEN | PMC_AUDIO_PLL0_PMCEN;

/* Wait for startup time until PLL is stabilized */
delay_us(100);

A frequency value of 98.304 MHz is chosen because the same frequency can be used to source the PDMIC interface as well as the CLASSD interface, which will be discussed in the next chapter.