KSDK 2.0 internal clock configuration on MKL25Z

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

KSDK 2.0 internal clock configuration on MKL25Z

Jump to solution
843 Views
gustavsl
Contributor III

I'm getting started with KSDK 2.0 and I'm having some troubling configuring a custom board using Kinetis KL25Z and no external crystal.

I want to run my application with the clock given by the internal oscillator. When I used Processor Expert, I could set it up using FEI mode and set the bus clock to 20.84MHz and the system clock to 41,68MHz.

I see there's a BootToFEIMode() function in fsl_clock.h, but none of the demo apps use this configuration.

How would I have to set up clock_config.h to achieve this?

 

Thanks,

 

Gustavo.

Labels (1)
0 Kudos
1 Solution
678 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

The default mode for MCG is FEI mode, in the mode,

DMX32: 0

DRST_DRS: 00

 the FLL output clock is from 20MHz to 25MHz.

If you need that the FLL output 40~50MHz, you can set the DRST_DRS=01. Because the mode is the same, it is okay for you  to just change the DRST_DRS as 01.

Hope it can help you.

BR

Xiangjun Rong

View solution in original post

3 Replies
679 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

The default mode for MCG is FEI mode, in the mode,

DMX32: 0

DRST_DRS: 00

 the FLL output clock is from 20MHz to 25MHz.

If you need that the FLL output 40~50MHz, you can set the DRST_DRS=01. Because the mode is the same, it is okay for you  to just change the DRST_DRS as 01.

Hope it can help you.

BR

Xiangjun Rong

678 Views
gustavsl
Contributor III

Using the code above apparently worked.

The function CLOCK_GetBusClkFreq() returns 41943040, which is the bus frequency I was intending to achieve.

Thank you.

0 Kudos
678 Views
gustavsl
Contributor III

Hi, thank you for your response.

Would this BOARD_BootClockRUN() function work to initialize the clock that way or do I need to initialize anything else?

void BOARD_BootClockRUN(void) {

    const sim_clock_config_t simConfig = {
        .pllFllSel = 1U,        /* PLLFLLSEL select PLL. */
        .er32kSrc = 0U,         /* ERCLK32K selection, use LPO. */
        .clkdiv1 = 0x10010000U, /* SIM_CLKDIV1. */
    };

    CLOCK_SetSimSafeDivs();

    CLOCK_BootToFeiMode(kMCG_Dmx32Default,kMCG_DrsLow,NULL);
    CLOCK_SetInternalRefClkConfig(kMCG_IrclkEnable, kMCG_IrcSlow, 0);
    CLOCK_SetSimConfig(&simConfig);
}

Thank you,

Gustavo.

0 Kudos