Recovering from loss of external reference clock (LOCS0 = 1)

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

Recovering from loss of external reference clock (LOCS0 = 1)

Jump to solution
1,600 Views
rampsr
Contributor III

I am using the Kinetis MKL05 and and will have a 32.768KHz crystal oscillator connected. I will start in FEI mode for the internal reference clock (because I cannot wait 400 ms for startup) and will poll the OSCINIT0 bit for the external oscillator. Once initialized I hand over the clock from the internal to the external reference.

Now this product will be in extreme environments and will be running up to about 85°C - 90°C.

In the event that I have a loss of OSC0 reference clock for my crystal oscillator, I need to recover gracefully.

I see that I can set the LOCRE0 (Loss of Clock Reset Enabled) to either

0 - Interrupt request is generated on a loss of OSC0 external reference clock.

or

1 - Generate a reset request on a loss of OSC0 external reference clock.

If an interrupt is generated, can I revert back to my internal reference clock gracefully? Or will the device have to perform some sort of reset regardless?

Labels (1)
0 Kudos
Reply
1 Solution
1,201 Views
isaacavila
NXP Employee
NXP Employee

Hi Rampsr,

You can revert back to select internal reference clock without any problem. Just be careful select internal reference for FLL and set CME to zero (due no external reference clock is used anymore) and set it to 1 if you change then to external reference again.

I have tested it with TWR-K60D100M and it works well. You can make your test using your MKL05 (I could not test with FRDM-KL05 because there is no way to disconnect OSC0 clock), by adding a jumper into EXTAL pin to enable/disable clock signal and corroborate that MKL05 behaves as expected.

I hope this can help you,

Best Regards,

Isaac

----------------------------------------------------------------------------------------------------------------------------------------

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

----------------------------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
3 Replies
1,202 Views
isaacavila
NXP Employee
NXP Employee

Hi Rampsr,

You can revert back to select internal reference clock without any problem. Just be careful select internal reference for FLL and set CME to zero (due no external reference clock is used anymore) and set it to 1 if you change then to external reference again.

I have tested it with TWR-K60D100M and it works well. You can make your test using your MKL05 (I could not test with FRDM-KL05 because there is no way to disconnect OSC0 clock), by adding a jumper into EXTAL pin to enable/disable clock signal and corroborate that MKL05 behaves as expected.

I hope this can help you,

Best Regards,

Isaac

----------------------------------------------------------------------------------------------------------------------------------------

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

----------------------------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
1,201 Views
rampsr
Contributor III

Thank you Isaac!

An additional question:

I've checked both Code Warrior (10.3 at least) and Kinestis Design Studio and both of them for the MKL05 do not have an option in Processor Expert to choose "Interrupt" during loss of clock. You can only choose to RESET when you enable "Clock Monitor". I am unfamiliar on how to manually set up an interrupt. What all is involved in setting up an interrupt for this occasion of a loss of clock?

Thanks

0 Kudos
Reply
1,201 Views
isaacavila
NXP Employee
NXP Employee

Hello Rampsr,

When I tested this feature in TWR-K60D100M i enabled this interrupt manually. It is neccessary to enable this interrupt in MCG module, as well as NVIC. You can check this post where I talk about setting an interrupt (It was based on PIT module on KE06 chip, but basically it is the same on your board).

FRDM KE06Z: How to access Interrupt service program?

I also attach used program for any addtional reference.

If you still have doubts, please let me know it.

Best Regards,

Isaac

0 Kudos
Reply