AnsweredAssumed Answered

KL03 core clock and timer clock clock from External oscillator.

Question asked by Andrew Barnes on Sep 12, 2016
Latest reply on Jul 31, 2017 by Beau Rogers

I'm new to the KL03 family but have used micro controllers from TI for years.  I'm evaluating the KL03 and I want to the core clock and timer clock to be sourced from a MHz external oscillator.  I understand that the clock needs to be fed to the EXTAL pin but I'm a little lost on the controller setup to use it for the core and time ( I'll be using the timer in compare OUT mode).

 

I have Kinetis Design Studio installed and I have SDK 2.0 project.  Could someone help me with the details on configuring the KL03?  Most of my issue is not knowing how to use the SDK.  I've tried the following without success.

 

void _ext_clk_init(void)
{

 


    const mcglite_config_t mcgliteConfig = {
        .outSrc = kMCGLITE_ClkSrcExt,
        .irclkEnableMode = kMCGLITE_IrclkEnable,
        .ircs = kMCGLITE_ClkSrcExt,
        .fcrdiv = kMCGLITE_LircDivBy1,
        .lircDiv2 = kMCGLITE_LircDivBy1,
        .hircEnableInNotHircMode = false,
    };

 

    const sim_clock_config_t simConfig =
    {
#if (defined(FSL_FEATURE_SIM_OPT_HAS_OSC32K_SELECTION) && FSL_FEATURE_SIM_OPT_HAS_OSC32K_SELECTION)
        .er32kSrc = 0U, /* SIM_SOPT1[OSC32KSEL]. */
#endif
        .clkdiv1 = 0x00010000U, /* SIM_CLKDIV1. */
    };

 

    CLOCK_SetSimSafeDivs();

 

    CLOCK_SetMcgliteConfig(&mcgliteConfig);

 

    CLOCK_SetSimConfig(&simConfig);

 

    // external clock  runs at  1.863MHz
    SystemCoreClock = 1863000U;

 

    return;
}

After calling the above function I toggle a LED on the FRDM-LK03Z eval board and the frequency of the LED toggle is the clock divided by 79 which leads me to believe I'm on the right track.

 

Thanks to all to replay and those who simply look.

Outcomes