Starting processor, FEI to FBE with 32 kHz RTC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Starting processor, FEI to FBE with 32 kHz RTC

442 Views
fangsbones
Contributor I

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

Labels (1)
0 Kudos
1 Reply

335 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello A R:

I am Jorge Gonzalez, the support person behind your Service Request.

As mentioned, I think the issue is because of enabling the RTC_CR[CLKO] bit. This bit must be cleared so the RTC clock is available and the FLL oscillator can use it as external reference.

Let me know if the issue remains.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos