I have 16MHz external crystal for K22.
I am using KSDK v2.1.
I've configured the clock to run in FEE:
void BootClockRUN_FEE(void)
{
const sim_clock_config_t simConfig = {
.pllFllSel = 0U, .er32kSrc = 3U, .clkdiv1 = 0x01340000U,
};
CLOCK_SetSimSafeDivs();
BOARD_InitOsc0();
CLOCK_BootToFeeMode(kMCG_OscselOsc, 4U, kMCG_Dmx32Default, kMCG_DrsMidHigh, BOARD_FllStableDelay);
CLOCK_SetInternalRefClkConfig(kMCG_IrclkEnable, kMCG_IrcSlow, 0U);
CLOCK_SetSimConfig(&simConfig);
SystemCoreClock = 80000000U;
}
After initializing the Clock management, I try to use PTC3 pin to scope the output of the flash clock to verify the SystemCoreClock is correct.
#define SIM_SCGC5_REG(base) ((base)->SCGC5)
#define SIM_SOPT2_REG(base) ((base)->SOPT2)
#define PORT_PCR_REG(base,index) ((base)->PCR[index])
#define SIM_SOPT2 SIM_SOPT2_REG(SIM)
#define SIM_SCGC5 SIM_SCGC5_REG(SIM)
#define PORTC_PCR3 PORT_PCR_REG(PORTC,3)
#define PORTC_PCR4 PORT_PCR_REG(PORTC,4)
SIM_SCGC5|=0x800;
PORTC_PCR3&=~(0x700);
PORTC_PCR3|=5<<8;
SIM_SOPT2|=2<<5;
I am expecting 16Mhz out for PTC3. Nothing is coming out.
Any ideas on where I went wrong?