how to generate system clk in FRDMK64F w/o using ext osc.?

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

how to generate system clk in FRDMK64F w/o using ext osc.?

849 Views
deeptimoodliar
Contributor II

I have read many posts regarding generation of FRDMK64F system clock using IRC48M internal oscillator.

I have even tried out the suggestions given. Simplest being just changing the i/p clk of PLL to IRC48M

and modifying the PRDIV and VDIV accordingly (in file board.c of "hello_world") to generate 120MHz clock.

When this did not work, I also played around the USB related settings as mentioned in some posts.

But nothing seems to be working.  Could you Pl. guide me where I am going wrong.

Also, as per ref manual, using RTC osc with 32.768 KHz  crystal can also be used to generate system clock.

Could you provide me with demo code to do the same? What is the max clock freq. that can be achieved?

My final aim is to see whether the use of 50 MHz external oscillator can be eliminated . If yes how

and what will be the max. freq that can be achieved?

2 Replies

652 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Deepti Moodliar:

Both cases you mentioned are possible, using IRC48M as reference or RTC with a 32.768 kHz crystal.

- With IRC48M you can get a max system clock of 120 MHz.

- With the 32.768 kHz the maximum system clock would be 96 MHz.

Attached there are 2 KDS projects with KSDK v1.3 + Processor Expert. You should take a look to the macros generated in the header file system_MK64F12.h and how these are used to initialize clocks in the function SystemInit() from the source file system_MK64F12.c.

Project (1) configures a system clock of 120 MHz with the IRC48M as reference. According to appnote AN4905 for K64 it is required to enable the IRC48M, so I added the next code to SystemInit():

  /* Enable the IRC48M reference according to AN4905 */

  // Enable the clock to the USB module

      SIM_SCGC4 |= SIM_SCGC4_USBOTG_MASK;

  // Enable the IRC48M oscillator

      USB0_CLK_RECOVER_IRC_EN |= 2;

Project (2) uses the RTC with a 32.768 kHz crystal to set a system clock of 96 MHz.

I hope this helps. Let me know if any doubts.


Best regards!
Jorge Gonzalez

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

0 Kudos

652 Views
inderjitjutla
Contributor II

Hey, thanks for the files! I tried using the K64_IRC48 but processor expert gives me a warning:

DescriptionResourcePathLocationType
Warning: IRC48M will not work as MCG reference clock source due to chip limitation described in application note AN4905! (MCG external ref. clock source)K64_IRC48clockMan1/MCG external ref. clock sourceProcessor Expert Problem

Does this mean I actually can't use the IRC48 as the main system clock for the K64F? Your post seems to imply it's possible. I'm using the chip on the freedom board to test with.

0 Kudos