AnsweredAssumed Answered

PLL in LCP1788 not working

Question asked by think uvpce on Feb 27, 2018
Latest reply on Mar 4, 2018 by jeremyzhou

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 ??

Outcomes