I can't use Internal Reference 48MHz for MCG in FRDM-K64F

cancel
Showing results for 
Search instead for 
Did you mean: 

I can't use Internal Reference 48MHz for MCG in FRDM-K64F

Jump to solution
517 Views
alessiopaolucci
Contributor III

For use IRC48M like source of MCG I set:


MCG_C7_OSCSEL = 2

but when I go in fei2fbe or fei2fee transinction function, after updating the MCG register the MCG_S didn't update and the mcu rest blocked in the control of MCG_S register.

Help me! How can I use IRC48M like MCG source?

Tags (3)
1 Solution
107 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Alessio:

Please refer to application note AN4905, chapter 4 Changes to the crystal-less USB implementation. In K64 you have to enable the 48 MHz oscillator from the USB module before using it. To do this add the next code before the clock configuration starts:

// Enable the clock to the USB module

    SIM_SCGC4 |= SIM_SCGC4_USBOTG_MASK;

// Enable the IRC48M oscillator

    USB0_CLK_RECOVER_IRC_EN |= 2;

I hope this resolves your problem.


Regards!,
Jorge Gonzalez

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

View solution in original post

6 Replies
108 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Alessio:

Please refer to application note AN4905, chapter 4 Changes to the crystal-less USB implementation. In K64 you have to enable the 48 MHz oscillator from the USB module before using it. To do this add the next code before the clock configuration starts:

// Enable the clock to the USB module

    SIM_SCGC4 |= SIM_SCGC4_USBOTG_MASK;

// Enable the IRC48M oscillator

    USB0_CLK_RECOVER_IRC_EN |= 2;

I hope this resolves your problem.


Regards!,
Jorge Gonzalez

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

View solution in original post

107 Views
alessiopaolucci
Contributor III

Thanks Jorge!

In my MK64F12.h file wasn't present USB0_CLK_RECOVER_IRC_EN register, but I add it and now all works.

Best Regards!

Alessio Paolucci

0 Kudos
107 Views
mjbcswitzerland
Specialist V

Hi Jorge

According to the present user's manual the IRC48M is enabled whenever it is selected as external clock source.

However in practice with a K64 mask 1N83J it is indeed necessary to enable it in the USB module before it works.

There is no errata about this detail in 1N83J.

According to the application note AN4905 newer K64 are a little different and the IRC48M has been made more independent. The problem with early chips is that when there is a USB reset the IRC48M is disabled - if it is being used to generate the system clock the system will freeze when this happens.

My question is, how can one tell if the device is newer?

My FRDM-K64F has a 1N83J on it, where the errata is not mentioned but suffers from this problem.

Other production boards may have newer devices on them and so may be able to operation but how can one known and control this??

Regards

Mark

0 Kudos
107 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Mark:

As mentioned in the appnote, only K64, K63 and K24 1 MByte parts will have this problem. Newer parts such as KL27/KL43 should not suffer from this.

We are sorry if the manual is somehow misleading. Could you point me to the manual version and the chapter that had you confused?

Regards!

Jorge Gonzalez

0 Kudos
107 Views
mjbcswitzerland
Specialist V

Hello Jorge

>>Could you point me to the manual version and the chapter that had you confused?

Chapter 5.7.2 in user manual K64P144M120SF5RM Rev. 2. January 2014

pastedImage_0.png

The OR is not correct in devices with the issue since it is "only" enabled by USB.

This still looks to be the most up-to-date user's manual.

In fact I didn't expect to find any information about deviations here but rather in an errata - however the only errata is 1N83J, which doesn't mention this.

This means that the only source of the notice about deviation to the user's manual is in an application note, which is not particularly logical.

Regards

Mark

0 Kudos
107 Views
mjbcswitzerland
Specialist V

Hi All

Note that there is a practical dicussion of varous details of the MCG, along with possible pit-falls at http://www.utasker.com/kinetis/MCG.html

Regards

Mark

0 Kudos