Clock Initialization Stuck when checking MCG_S_IREFST_VAL

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

Clock Initialization Stuck when checking MCG_S_IREFST_VAL

Jump to solution
1,103 Views
testbed
Contributor III

Hello,

I have setup the clock configuration as shown below for the KW41Z MCU. Clock is configured to use the FEE Mode

pastedImage_3.png

During bootup the code gets stuck in the CLOCK_SetFeeMode function

pastedImage_4.png

The reason being the highlighted code below

pastedImage_5.png

I have another similar board (both boards are custom design) on which this does not happen with the same clock settings.

I have gone through the errata related to this issue observed in the past and it is mentioned that commenting this code will have no side effects. I therefore commented out the highlighted code above and everything worked fine.

What i would like to know is what could be the reason the code is not working on other boards and not this one ?

Would it be OK to implement a time out as shown below without any side effects ?

pastedImage_8.png

Regards

- TestBed

0 Kudos
1 Solution
922 Views
mjbcswitzerland
Specialist V

Hi

If the code hangs waiting for the external source to be switched to it means that the external source is not valid (probably not present). See the following for a general overview: http://www.utasker.com/kinetis/MCG.html

If you then remove the code that waits for the switch to take place so that it can continue it will presumably means that the MCG is still being referenced to the internal 32kHz IRC and so everything will operate - but you will have a less accurate and less stable clock than you would have from the external source.

If the same code works on a different board (a different design?) I would check the crystal and its loading capacitors since it may not be starting in one case. Beware that the gain mode  set in the oscillator depends on the HW and it won't always start if it doesn't match. If possible, check the oscillation with a scope and simple try changing the gain mode to the other setting if it doesn't start up. It may also be that you have a HW problem on one of teh boards so just need to ensure the crystal is correctly connected.

Regards

Mark


uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)
Kinetis: http://www.utasker.com/kinetis.html

uTasker - for more performance and faster, cheaper product development




View solution in original post

2 Replies
923 Views
mjbcswitzerland
Specialist V

Hi

If the code hangs waiting for the external source to be switched to it means that the external source is not valid (probably not present). See the following for a general overview: http://www.utasker.com/kinetis/MCG.html

If you then remove the code that waits for the switch to take place so that it can continue it will presumably means that the MCG is still being referenced to the internal 32kHz IRC and so everything will operate - but you will have a less accurate and less stable clock than you would have from the external source.

If the same code works on a different board (a different design?) I would check the crystal and its loading capacitors since it may not be starting in one case. Beware that the gain mode  set in the oscillator depends on the HW and it won't always start if it doesn't match. If possible, check the oscillation with a scope and simple try changing the gain mode to the other setting if it doesn't start up. It may also be that you have a HW problem on one of teh boards so just need to ensure the crystal is correctly connected.

Regards

Mark


uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)
Kinetis: http://www.utasker.com/kinetis.html

uTasker - for more performance and faster, cheaper product development




922 Views
testbed
Contributor III

Thanks for the information Mark. It turned out to be a hardware issue...

0 Kudos