LPC824 running 30MHz - Unstable PLL?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC824 running 30MHz - Unstable PLL?

632 Views
kenneth880320
Contributor I

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".

Capture1.JPG

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 :smileysilly: 

/Kenneth 

0 Kudos
3 Replies

515 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Kenneth Johansen 

I tested your issue on my LPC824 demo board.

Clock path:

pastedImage_1.png

my testing code is attached. the code is to blink on board LED D1.

the board is running with this code without any issue. I reset board for 10 times, the board still function well. 

I suggest you refer or test my demo, if you can find any issue on your code.


Have a great day,
Jun Zhang

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

515 Views
kenneth880320
Contributor I

Hey Jun 

I've taken a look at your provided code, and I don't see where you setup the frequency of the board to run 30MHz? In my SDK, calling BOARD_InitBootClocks() will only setup the board to run at 12MHz and not 30MHz as seen below: 

Capture.JPG

Also, I can get my code to run and lock the PLL, but as soon as I raise the temperature, and then reset the board, it will stop being able to lock the PLL. My problem is both a factor of resetting and temperature, so you can't just test it with a board without increasing the temperature and then trying to reset. 

/Kenneth

0 Kudos

515 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Kenneth,

This time, I test board with external system osc

pastedImage_1.png

In my attached demo, CLOCK_SetCoreSysClkDiv(2U) is to set SYSAHBCLKDIV as 2, thus system clock = 60M/2=30MHZ

pastedImage_2.png

I tested code with 35-40c environment, no reset issue.

I suggest you test my code with two more other board, if this problem is same? can you also test it with nxp demo board?


Have a great day,
Jun Zhang

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos