lpcware

LPC11U23 fails to lock PLL with IRC as PLL source

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by crawford on Sun Feb 08 16:00:16 MST 2015
I have a custom board with an LPC11U23F and an external 12Mhz crystal. I ran into trouble getting the PLL to lock on the external crystal so I decided to try using the IRC for now. Unfortunately, it seems that it won't lock on the IRC either! I can use the IRC directly as my main clock source, so I know there is nothing wrong with the IRC itself. I'm reasonably sure this is just some silly software misconfiguration but I could use another set of eyes.

This is the (inlined) code that I am using to initialize the clock:

void Chip_SystemInit(void)
{
        /* IRC should be powered up */
        // Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_IRC_PD);
        LPC_SYSCTL->PDRUNCFG &= ~(1 << 1);
        // Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_IRCOUT_PD);
        LPC_SYSCTL->PDRUNCFG &= ~(1 << 0);

        /* Set system PLL input to IRC */
        // Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_IRC);
LPC_SYSCTL->SYSPLLCLKSEL  = 0;
LPC_SYSCTL->SYSPLLCLKUEN  = 0;
LPC_SYSCTL->SYSPLLCLKUEN  = 1;

        /* Power down PLL to change the PLL divider ratio */
        // Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_SYSPLL_PD);
        LPC_SYSCTL->PDRUNCFG |= (1 << 7);

        /* Setup PLL for main oscillator rate (FCLKIN = 12MHz) * 4 = 48MHz */
        // Chip_Clock_SetupSystemPLL(3, 1);
        LPC_SYSCTL->SYSPLLCTRL = 0x23;

        /* Powerup system PLL */
        // Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSPLL_PD);
        LPC_SYSCTL->PDRUNCFG &= ~(1 << 7);

        /* Wait for PLL to lock (never locks) */
        // while (!Chip_Clock_IsSystemPLLLocked()) {}
        while ((LPC_SYSCTL->SYSPLLSTAT & 1) == 0);

        ...
}

Outcomes