Content originally posted in LPCWare by deSteini on Thu Jun 05 05:12:11 MST 2014
In my Startup code i also inizialise the Clock Settings. It worked all the time with the same settings perfect, until i got a problem with the Debugger. Now it seems my Code hangs when he wait that the PLL_Clock is locked.
My Code uses the XTAL as PLL, so do i understand it right, that maybe de Crystal is broken? And can i test this? Here are my inizialisation code:
SYS_CLK_CONF = CLK_SEL_XTAL | AUTOBLK;
/* PLL, 3-phase output control enable, and power down PLL. */
CGU_PLL_CTRL = P23EN | PLL_PD;
/* PLL, MSEL=16, 3-phase output control enable, power down PLL. */
CGU_PLL_CTRL = PLL_XTAL_SEL | (PLL_M_VALUE"<<"MSEL_SHIFT) | P23EN | PLL_PD;
/* PLL, MSEL=16, 3-phase output control enable, PLL normal operation. */
CGU_PLL_CTRL = PLL_XTAL_SEL | (PLL_M_VALUE"<<"MSEL_SHIFT) | P23EN;
/* Check lock bit, if unlocked, PLL_LOCK is always 0 */
//while ( !(CGU_PLL_STAT & PLL_LOCK) ); hangs
/* Check clock detection register to make sure PLL is present now. */
//while ( !(CGU_RDET & PLL_PRESENT) ); hangs also
Somebody has any ideas?
Thx in advance ;)
PS: "<<" only because otherwise it would be a command here