SDK_2.2_LPCXpresso54608

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

SDK_2.2_LPCXpresso54608

1,275 Views
johannzimmerman
Contributor II

Hi all,

has someone already run the CPU with 180Mhz?

If so with what example from the SDK?

Have not found one...

I have the function BOARD_BootClockFROHF96M (); with the
call from BOARD_BootClockPLL180M (); replaced.

BOARD_BootClockPLL180M(); does not change MCU clock.
According to the function SystemCoreClockUpdate();
the variable SystemCoreClock =0 ???
In this case, the MCU is clocked at 48MHz.

What am I doing wrong?

Please help with an example.

0 Kudos
6 Replies

969 Views
johannzimmerman
Contributor II

Has anyone already implemented the function BOARD_BootClock220M () for the LPC54628?

Would be very grateful.

0 Kudos

969 Views
Alex_Tsai
Contributor II

In addition, The SystemCoreClockUpdate() seems to have bugs in line.351

clkRate = workRate / ((uint64_t)postdiv);
clkRate = workRate * 2; /* PLL CCO output is divided by 2 before to M-Divider */

The correct should be ...

clkRate = workRate / ((uint64_t)postdiv);
clkRate = clkRate * 2; /* PLL CCO output is divided by 2 before to M-Divider */

0 Kudos

969 Views
johannzimmerman
Contributor II

Thank you very much, the change does it.

0 Kudos

969 Views
Alex_Tsai
Contributor II

I think the fundamental problem is that CLKIN is define to 0 in system_LPC54608.h

Must be replace to 12000000u

0 Kudos

969 Views
soledad
NXP Employee
NXP Employee

Hi,

Please try the below code:

void BOARD_BootClock180M(void)
{
    /*!< Set up the clock sources */
    /*!< Set up FRO */
    POWER_DisablePD(kPDRUNCFG_PD_FRO_EN);                   /*!< Ensure FRO is on  */
    CLOCK_AttachClk(kFRO12M_to_MAIN_CLK);                  /*!< Switch to FRO 12MHz first to ensure we can change voltage without accidentally
                                                                being below the voltage for current speed */
    POWER_SetVoltageForFreq(180000000U);             /*!< Set voltage for the one of the fastest clock outputs: System clock output */
    CLOCK_SetFLASHAccessCyclesForFreq(180000000U);    /*!< Set FLASH wait states for core */

    /*!< Set up SYS PLL */
    const pll_setup_t pllSetup = {
        .syspllctrl =  SYSCON_SYSPLLCTRL_SELI(32U) | SYSCON_SYSPLLCTRL_SELP(16U) | SYSCON_SYSPLLCTRL_SELR(0U),
        .syspllndec = (SYSCON_SYSPLLNDEC_NDEC(770U)),
        .syspllpdec = (SYSCON_SYSPLLPDEC_PDEC(98U)),
        .syspllmdec = (SYSCON_SYSPLLMDEC_MDEC(8191U)),
        .pllRate = 180000000U,
        .flags =  PLL_SETUPFLAG_WAITLOCK | PLL_SETUPFLAG_POWERUP
    };

    CLOCK_AttachClk(kFRO12M_to_SYS_PLL);        /*!< Set sys pll clock source*/
    CLOCK_SetPLLFreq(&pllSetup);                     /*!< Configure PLL to the desired value */


    /*!< Set up dividers */
    CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false);                  /*!< Reset divider counter and set divider to value 1 */

    /*!< Set up clock selectors - Attach clocks to the peripheries */
    CLOCK_AttachClk(kSYS_PLL_to_MAIN_CLK);                  /*!< Switch MAIN_CLK to SYS_PLL */
    SYSCON->MAINCLKSELA = ((SYSCON->MAINCLKSELA & ~SYSCON_MAINCLKSELA_SEL_MASK) | SYSCON_MAINCLKSELA_SEL(3U)); /*!< Switch MAINCLKSELA to FRO_HF even it is not used for MAINCLKSELB */
    /* Set SystemCoreClock variable. */
    SystemCoreClock = 180000000;
}

I hope this helps,

Have a great day,
Soledad

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

0 Kudos

969 Views
johannzimmerman
Contributor II

Thank you very much for the help. Can confirm that your function works, the MCU switches to 180MHZ.

0 Kudos