AnsweredAssumed Answered

LPC54102 PLL failure

Question asked by new Generation on Feb 22, 2017

Hello,

 

I'm new to this forum, so please be kind and forgive my errors.

 

General information

My current project is the evaluation of the LPC54102 processor. Until now, there were no serious problems, but:
I want to use the internal PLL (that seems different to other PLLs in LPC MCUs) and first configured it via LPCOpen and the libpower. That worked.

But I also was instructed to get the device working without any other libraries, which results in a ban of libpower.a.

Current status

So I recreated the whole project, that now uses makefiles and a custom startupcode/linkerscript, and rewrote the basic functions.
Now comes the PLL setup: I read the User Manual of the chip carefully and programmed the SYSCON-registers related to the PLL. The PLL sets also the lock-bit, which (for me) indicates, that its working.
The code of pll.c, which contains every relevant function, is attached.

Program

My current program uses this code:

#ifdef USE_OWN_CODE
flash_set_waitstates(96000000UL);
LPC_SYSCON->PDRUNCFGSET = SYSCON_PDRUNCFG_PD_SYS_PLL;
LPC_SYSCON->SYSPLLCLKSEL = SYSCON_PLLCLKSRC_IRC;
LPC_SYSCON->PDRUNCFGCLR = SYSCON_PDRUNCFG_PD_SYS_PLL;
pll_set_frequncy(12000000UL, 8);
while(!pll_is_locked()) ; /* wait for lock */
#else
Chip_POWER_SetPLL(8, 12000000);
Chip_POWER_SetVoltage(0,96000000);
#endif
LPC_SYSCON->MAINCLKSELB = SYSCON_MAIN_B_CLKSRC_SYSPLLOUT;

Problem

This code seems to work and sets the PLL registers to (as far as I can judge it) proper values.
But as soon as I switch the main clock to the PLL output the Debugger jumps to random addresses (e.g. 0xFFFFFEF00) and the execution of the application does not go on.

I compared the register values and they match (except the two registers AHBMATPRIO and ASYNCAPHCTRL that are not set, because the program does not reach the writes to them) as far as the memory view let me see. But I know that this view does not show everything (e.g. CPSTAT register). Maybe there is a register that is missing to be set in my code.

 

Basic question

How do I set up the PLL properly without using libpower?

I would be also interested in an user/reference manual to libpower.a.

Any help is welcome.

 

Best regards,
N.G.

Original Attachment has been moved to: pll.c.zip

Outcomes