请问KL27Z的时钟源和时钟频率怎么调整?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

请问KL27Z的时钟源和时钟频率怎么调整?

903 次查看
yanandren
Contributor II

大家好,

我想请问一下KL27ZM64板子的时钟频率在哪儿调整?

 

void BOARD_BootClockRUN(void)

{

    CLOCK_SetSimSafeDivs();

 

 

    CLOCK_SetMcgliteConfig(&g_defaultClockConfigRun.mcgliteConfig);

 

 

    CLOCK_SetSimConfig(&g_defaultClockConfigRun.simConfig);

 

 

    SystemCoreClock = g_defaultClockConfigRun.coreClock;

}

 

这几个接口缩写看不太懂,请问能否告知一下。

谢谢

 

承蒙关照

标签 (1)
0 项奖励
回复
3 回复数

770 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Yan,

Yes, the void BOARD_BootClockRUN(void) function set the MCGOUTCLK signal. As you know that the KL27 has neither PLL nor FLL, the clock source includes 48MHz HIRC, 2M or 8M LIRC, and external clock source.

In default, the 48mHz HIRC is used as core/system clock, if you use 8MHz LIRC, you can change the code in clock_config.c as:

const clock_config_t g_defaultClockConfigRun = {

    .mcgliteConfig =

        {

            .outSrc = kMCGLITE_ClkSrcHirc, //kMCGLITE_ClkSrcLirc if you use 8MHz LIRC //Rong wrote

            .irclkEnableMode = 0U,

            .ircs = kMCGLITE_Lirc8M,

            .fcrdiv = kMCGLITE_LircDivBy1,

            .lircDiv2 = kMCGLITE_LircDivBy1,

            .hircEnableInNotHircMode = true,

        },

    .simConfig =

        {

            .clkdiv1 = 0x00010000U, /* SIM_CLKDIV1. */

        },

    .oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,

                  .capLoad = 0U,

                  .workMode = kOSC_ModeOscLowPower,

                  .oscerConfig =

                      {

                          .enableMode = kOSC_ErClkEnable,

#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) && FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)

                          .erclkDiv = 0U,

#endif

                      }},

    .coreClock = 48000000U, /* Core clock frequency */

};

BR

XiangJun Rong

0 项奖励
回复

770 次查看
yanandren
Contributor II

Dear Rong,

Thank you.

Now i know the general of the clock setting for the KL27Z.

But there are some details for me to ask.

If i want to change the freq of my board,is that true for me to only change the .outSrc .

Should i change the     .coreClock or any other vals ?

0 项奖励
回复

770 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

If you want to use internal 8MHz as core/system clock, it is okay to use the struct.

Hope it can help you.

BR

Xiangjun Rong

/* Configuration for enter RUN mode. Core clock = 48000000Hz. */

const clock_config_t g_defaultClockConfigRun = {

    .mcgliteConfig =

        {

            .outSrc = kMCGLITE_ClkSrcLirc, //kMCGLITE_ClkSrcHirc,  ///Rong wrote

            .irclkEnableMode = 0U,

            .ircs = kMCGLITE_Lirc8M,

            .fcrdiv = kMCGLITE_LircDivBy1,

            .lircDiv2 = kMCGLITE_LircDivBy1,

            .hircEnableInNotHircMode = true,

        },

    .simConfig =

        {

            .clkdiv1 = 0x00010000U, /* SIM_CLKDIV1. */

        },

    .oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,

                  .capLoad = 0U,

                  .workMode = kOSC_ModeOscLowPower,

                  .oscerConfig =

                      {

                          .enableMode = kOSC_ErClkEnable,

#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) && FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)

                          .erclkDiv = 0U,

#endif

                      }},

    .coreClock = 8000000U, /* Core clock frequency */

};

0 项奖励
回复