Hello,
I'm new to this forum, so please be kind and forgive my errors.
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.
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.
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;
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.
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
Solved! Go to Solution.
Hi N. G.,
Thanks for your reply.
I've ran the periph_pllfract demo with my my board (LPCXpresso54102 Rev A OM13077).
As a result, the demo works well (Fig 2) without encountering the same issue as you mentioned above, and I've attached the screenshot of testing result.
So I'd like to suggest that you'd better to check the hardware of your board again.
Fig 1
Fig 2
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi N. G.,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
In the periph_pllfract demo, the static void setPllRate(uint32_t rate) function has provided the appropriate flow to setup PLL configuration, please refer to it for details.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello,
thanks for your reply!
Unfortunately this example does not work!? The codes doesn't even reach main().
I investigated this issue and found out:
- the device powers normally up and jumps to the reset-handler
- normal startup-behavior is done
- everything is fine until Board_SetupClocking() is called
- this function itself calls Chip_SetupIrcClocking() which sets up the PLL using the internal RC-oscillator as its source
- the failure occurs exactly at the line Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_PLLOUT); which indicates that even in this basic example the PLL does not work.
Thus I haven't had a look on the source code of the periph_pllfract-example.
Thank you for your help.
Best regards,
N.G.
Hi N. G.,
Thanks for your reply.
I've ran the periph_pllfract demo with my my board (LPCXpresso54102 Rev A OM13077).
As a result, the demo works well (Fig 2) without encountering the same issue as you mentioned above, and I've attached the screenshot of testing result.
So I'd like to suggest that you'd better to check the hardware of your board again.
Fig 1
Fig 2
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------