AnsweredAssumed Answered

Starting processor, FEI to FBE with 32 kHz RTC

Question asked by fangsbones on Nov 17, 2015
Latest reply on Nov 23, 2015 by Jorge_Gonzalez

It seems this should be a very simple task, but I'm not having any luck. I have reviewed all documentation and simplified the code below to align as close as possible to the specified steps for MK61FN1M0VMJ15. Upon power up I am simply trying to switch from FEI to FBE with an external 32 kHz crystal connected to EXTAL32/XTAL32. However, the transition to external source never happens. Please help!

 

// Get RTC 32 kHz oscillator up and running
POWER_UP(6, SIM_SCGC6_RTC); // Power up RTC block by applying clock to RTC
RTC_CR = (unsigned long) (RTC_CR_SC8P | RTC_CR_SC4P); // Set 12 pF capacitors
RTC_CR |= (unsigned long) (RTC_CR_OSCE); // enable oscillator
iClockCounter = 0;
while (iClockCounter < (CLOCK_SOURCE_STABLE_COUNT << 4)) {

// Wait oscillator startup time to allow clock to stabilize

iClockCounter += 1;

}
RTC_CR |= (unsigned long) (RTC_CR_CLKO); // Enable clock output to other peripherals
// Go from FEI to FBE @ 32 kHz RTC
MCG_C2 = (MCG_C2_RANGE_32K_40K); // Setup low range, low power mode (when bypassed)
MCG_C7 = MCG_C7_OSCSEL_32K; // Select 32 kHz RTC oscillator for OSCSELCLK

MCG_C1 = (MCG_C1_CLKS_EXTERN_CLK | MCG_C1_FRDIV_RANGE0_1 );  // Setup no division

// We always make it this far

while (MCG_S & MCG_S_IREFST) {

// loop until the FLL source is no longer the internal reference clock

}

// We never make it this far

Outcomes