AnsweredAssumed Answered

LPC824 running 30MHz - Unstable PLL?

Question asked by kenneth880320@hotmail.com on Oct 19, 2019
Latest reply on Oct 22, 2019 by ZhangJennie

I'm working on a project where I just happened to run a LPC824 at 30MHz with an external 12MHz crystal. According to the user manual (UM10800) this setup is supported, and it does seem to work "sometimes".

I say sometimes because as soon as the micro controller becomes just slightly warm (Only talking about 35c here) and you reset it, it wont lock the PLL anymore and it gets stuck trying to lock. 

 

I've included my code below, written in MCUXpresso with the SDK for the LPC824, just in case it is me doing something wrong: 

void SysCLKSET() {
//Configure XTAL pins
SYSCON->SYSAHBCLKCTRL |= (SYSCON_SYSAHBCLKCTRL_IOCON_MASK | SYSCON_SYSAHBCLKCTRL_SWM_MASK);
IOCON->PIO[IOCON_INDEX_PIO0_9] = 0;
IOCON->PIO[IOCON_INDEX_PIO0_8] = 0;
//Enable XTAL pins
SWM0->PINENABLE0 &= ~(SWM_PINENABLE0_XTALIN_MASK | SWM_PINENABLE0_XTALOUT_MASK);
//Set freq range
SYSCON->SYSOSCCTRL = 0;
//Turn on system OSC (XTAL)
SYSCON->PDRUNCFG &= ~(SYSCON_PDRUNCFG_SYSOSC_PD_MASK);
for(uint16_t delay = 0; delay < 8000; delay++)
__asm("nop"); 
//Turn off PLL
SYSCON->PDRUNCFG |= SYSCON_PDRUNCFG_SYSPLL_PD_MASK;
//Select system OSC for PLL (0=IRC, 1=OSC, 3=CLKIN)
SYSCON->SYSPLLCLKSEL = 1;
//Update PLL source selection - Page 41
SYSCON->SYSPLLCLKUEN = 0;
SYSCON->SYSPLLCLKUEN = 1;
//Configure PLL - 60MHz Main CLK - 30MHz System CLK
SYSCON->SYSPLLCTRL |= SYSCON_SYSPLLCTRL_MSEL(4) | SYSCON_SYSPLLCTRL_PSEL(1);
//Set System clk divider
SYSCON->SYSAHBCLKDIV = 2;
//Turn on PLL
SYSCON->PDRUNCFG &= ~SYSCON_PDRUNCFG_SYSPLL_PD_MASK;
//Wait for PLL to lock
while (SYSCON->SYSPLLSTAT != 1) {
}
//Change main CLK to PLL output - Page 41
SYSCON->MAINCLKSEL = SYSCON_MAINCLKSEL_SEL(3);
//Update clock source - Page 41
SYSCON->MAINCLKUEN = 0;
SYSCON->MAINCLKUEN = 1;
//Turn off IOCON
SYSCON->SYSAHBCLKCTRL &= ~SYSCON_SYSAHBCLKCTRL_IOCON_MASK;
}

I've also tried with the internal oscillator, and it yields the same result. If I however go down to 24MHz, everything seems to work as intended, and across temperature variations too. In my case I don't need it to run at the full 30MHz,  but I was curious why it didn't work, so I thought I would ask here. 

 

Any input is appreciated  

/Kenneth 

Outcomes