I suppose you have downloaded and installed SDK2.0 based on K66.
Pls refer to the example:
C:\Freescale\SDK2.0_TWR-K65\boards\twrk65f180m\demo_apps\lwip\lwip_tcpecho\freertos
You can see the code in clcok_config.c
assume you use 50Mhz clock source hooked to EXTAL0 pin rather than a 16mhz crystal hooked on EXTAL0/XTAL0 pins as TWR-K65 board, you can modify it as:
Original:
/* Configuration for HSRUN mode. Core clock = 180MHz. */
const clock_config_t g_defaultClockConfigHsrun = {
.mcgConfig =
{
.mcgMode = kMCG_ModePEE, /* Work in PEE mode. */
.irclkEnableMode = kMCG_IrclkEnable, /* MCGIRCLK enable. */
.ircs = kMCG_IrcSlow, /* Select IRC32k. */
.fcrdiv = 0U, /* FCRDIV is 0. */
.frdiv = 4U,
.drs = kMCG_DrsLow, /* Low frequency range */
.dmx32 = kMCG_Dmx32Default, /* DCO has a default range of 25% */
.oscsel = kMCG_OscselOsc, /* Select OSC */
.pll0Config =
{
.enableMode = 0U, .prdiv = 0x01U, .vdiv = 0x1DU,
},
.pllcs = kMCG_PllClkSelPll0,
},
.simConfig =
{
.pllFllSel = 1U, /* PLLFLLSEL select PLL. */
.pllFllDiv = 0U, /* PLLFLLSEL clock divider divisor */
.pllFllFrac = 0U, /* PLLFLLSEL clock divider fraction */
.er32kSrc = 2U, /* ERCLK32K selection, use RTC. */
.clkdiv1 = 0x02260000U, /* SIM_CLKDIV1. */
},
.oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,
.capLoad = 0,
.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 = 180000000U, /* Core clock frequency */
};
Modification by Rong:
/* Configuration for HSRUN mode. Core clock = 180MHz. */
const clock_config_t g_defaultClockConfigHsrun = {
.mcgConfig =
{
.mcgMode = kMCG_ModePEE, /* Work in PEE mode. */
.irclkEnableMode = kMCG_IrclkEnable, /* MCGIRCLK enable. */
.ircs = kMCG_IrcSlow, /* Select IRC32k. */
.fcrdiv = 0U, /* FCRDIV is 0. */
.frdiv = 4U,
.drs = kMCG_DrsLow, /* Low frequency range */
.dmx32 = kMCG_Dmx32Default, /* DCO has a default range of 25% */
.oscsel = kMCG_OscselOsc, /* Select OSC */
.pll0Config =
{
.enableMode = 0U, .prdiv = 0x04U, .vdiv = 0x14U, ///Modified by Rong:{50MHz/(4+1)} * 36, the VCO will output 360mhz, MCGPLLCLK is //360Mhz/2=180MHz
},
.pllcs = kMCG_PllClkSelPll0,
},
.simConfig =
{
.pllFllSel = 1U, /* PLLFLLSEL select PLL. */
.pllFllDiv = 0U, /* PLLFLLSEL clock divider divisor */
.pllFllFrac = 0U, /* PLLFLLSEL clock divider fraction */
.er32kSrc = 2U, /* ERCLK32K selection, use RTC. */
.clkdiv1 = 0x02260000U, /* SIM_CLKDIV1. */
},
.oscConfig = {.freq = 50000000; //50mHz //BOARD_XTAL0_CLK_HZ, Modified by Rong
.capLoad = 0,
.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 = 180000000U, /* Core clock frequency */
};
I do not test it, you can have a try.
Hope it can help you.
BR
Xiangjun Rong