PLL in LCP1788 not working

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

PLL in LCP1788 not working

677 Views
thinkuvpce
Contributor I

Hi all,

I am working on a project that utilizes LPC1788 MCU. I am using LPCOpen library.

I want to run it at 120 MHz clock speed. Function Chip_SetupIrcClocking(); is called code to set 120 MHz freq.

void Chip_SetupIrcClocking(void)
{
    /* Clock the CPU from SYSCLK, in case if it is clocked by PLL0 */
    Chip_Clock_SetCPUClockSource(SYSCTL_CCLKSRC_SYSCLK);

    /* Disable the PLL if it is enabled */
    if (Chip_Clock_IsMainPLLEnabled()) {
        Chip_Clock_DisablePLL(SYSCTL_MAIN_PLL, SYSCTL_PLL_ENABLE);
    }

    /* It is safe to switch the PLL Source to IRC */
    Chip_Clock_SetMainPLLSource(SYSCTL_PLLCLKSRC_IRC);

    /* FCCO = 12MHz * (9+1) * 2 * (0+1) = 240MHz */
    /* Fout = FCCO / ((0+1) * 2) = 120MHz */
    Chip_Clock_SetupPLL(SYSCTL_MAIN_PLL, 9, 0);

    Chip_Clock_EnablePLL(SYSCTL_MAIN_PLL, SYSCTL_PLL_ENABLE);
    Chip_Clock_SetCPUClockDiv(1);
    while (!Chip_Clock_IsMainPLLLocked()) {} /* Wait for the PLL to Lock */
    Chip_Clock_SetCPUClockSource(SYSCTL_CCLKSRC_MAINPLL);

    /* Peripheral clocking will be derived from PLL0 with a divider of 2 (60MHz) */
    Chip_Clock_SetPCLKDiv(1);
}

I have not changed in this function. It shows it sets multipler and per-scaler to proper values to get 120 MHz freq.

Chip_SYSCTL_EnableBoost();

Chip_SetupIrcClocking();

But MCU still runs on 12 MHz.

I have verified by checking SystemCoreClock variable. It shows 12000000 value.

I have also verified using test code as below:

    dprintf(UART_DEBUG_PORT, "START\r\n");
    for(int i = 0; i < 120 * 1000* 1000; i++) {
        asm("nop");
    }
    dprintf(UART_DEBUG_PORT, "END\r\n");

If MCU is running on 120 MHz it should take around 1 second to execute the code. But it takes around 10 seconds to execute. Which shows it is running on 12 MHz clock.

I have also tried to External Crystal but no luck. Any idea or suggestions ??

Labels (1)
0 Kudos
1 Reply

510 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

Thank you for your interest in NXP Semiconductor products and 
the opportunity to serve you.

You can use the periph_clkout demo to check that whether the frequency of system clock is expected.

Have a great day,
TIC

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

0 Kudos