External Crystal failure detection in MKE04

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

External Crystal failure detection in MKE04

798 Views
sameehashirish_
Contributor I

Hi,

   I am using MKE04Z64VLH4 in an application. The controller clock is derived from external crystal of 16 MHz and stepped up through FLL at 40 MHz. Is there any way to detect the external crystal failure so that the controller can be switched to internal clock and then again switched back to external crystal when it becomes normal during run time.

 

 

Thanks and best regards,

Sameeha

Labels (1)
Tags (1)
0 Kudos
5 Replies

621 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Sameeha,

FLL module's input clock frequency can only be 31k~39k. If you use a 16M crystal, even RDIV set to /128, the FLL input clock is 125k, well above FLL's capability. Please see reference manual 20.4.1.2.

If you want to know the status of FLL, please check the ICS_S.LOLS bit.

Regards,

Jing

0 Kudos

621 Views
sameehashirish_
Contributor I

Hi Jing,

Thanks for reply but my question is, is it possible to switch controller to internal clock during run time in case of external crystal failure or not?  

While using 16M crystal RDIV set to /512 which gives FLL input clock 31.25 KHz so its within the range.

 

Thanks and best regards

Sameeha 

0 Kudos

621 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

if in FBE or FEE modes and external crystal fail, for example, stop suddenly,  you have no chance to switch to internal clock. You must set ICS_C4[CME], the clock monitor will reset the system.

If the situation is not so worse, FLL is detected from lock to unlock, an interrupt can be trig. Then you can switch clock. Details please see the 20.4.7.1.

Regards,

Jing

0 Kudos

621 Views
sameehashirish_
Contributor I

Hi Jing,

        Can you please tell me the method to switch clock, if you can provide sample code that will be very helpful.

Thanks and best regards

Sameeha

0 Kudos

621 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

I made a demo base on rtc example. But I couldn't generate a loss of lock condition. So, this is only for your reference.

Regards,

Jing

0 Kudos