AnsweredAssumed Answered

Running the K64 from its RTC oscillator - does it work?

Question asked by Mark Butcher on May 1, 2015
Latest reply on Jan 19, 2018 by Priyank Bhatt

Hi All

 

I have been testing various clocking configurations and wanted to try using the 32.768kHz RTC oscillator as external input to the FLL and generate a 95.97MHz core clock.

In fact it looked quite simple to do but I didn't manage it because as soon as the FLL input was switched from the internal IRC to external clock the initialisation would hang waiting for the FLL input to be selected. Before selecting the input I have ensured that the RTC oscillator is running and set the external oscillator for it (MSG_C7 = 1) and FRDIV is 0 (/1) so that the FLL input is at the correct speed.
IREFS can be cleared in MSG_C1 but the status register still shows that the 32kHz IRC is being used.

 

Here is also the MCG diagram that I use to which I have added register controls so that it is easier to understand and check (showing the path that I would like to switch through)

 

 

Note: When testing the IRC48MCLK path I originally had a similar issue in that I was switching the MCGOUTCLK to it but the status register was showing that it was not being used. Only when I remembered that the IRC48M has to be enabled in the USB module first did the status register display that it had indeed been correctly set and so I am suspectig that the signal is not actually at the input (and the switch is not actually switching and the IRC is still being used). But I couldn't see what was missing and no amount of trying resulted in any success.

 

It was one of those rare instances that I decided to see how PE does it right since it obviously had me beat.

 

So I set up PE to do the same:

 

 

And I stepped though the code to get a lesson in how thing should be done....

 

And what hapens... it gets stuck as well as soon as it tries to switch the FLL input to the external RTC clock source

 

while((MCG_S & MCG_S_IREFST_MASK) != 0x00U) { /* Check that the source of the FLL reference clock is the external reference clock. */

}

It spins here forever...

 

So now I am wondering:

- does my chip have a broken track between the RTC input and the FLL input switch?
- Should the PE code work or has it never been tested?
- Is it actually possible to connect the RTC clock to the FLL input?

 

Anyone done it successfully??

 

Regards

 

Mark

Outcomes