K60 Clock Setup and USB Issues

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

K60 Clock Setup and USB Issues

Contributor V

I'm running an MK60FN1M0VLQ12 device from an 8MHz external crystal and so far, things have been working well.

I followed one of the examples from the Reference Manual (section to set up the MCG, SIM and OSC modules. The example shows moving from FEI mode through to PEE mode with a 16MHz crystal with an 128MHz MCGOUTCLK. Similar in fashion to my requirements, I made some tweaks to get my output to 120MHz from the 8MHz clock but everything else is the same.

I'm trying to get a USB CDC example up and running based on some code provided by IAR Systems which appears to work well on the K60 Tower System but when I attempt to port the code over to my device, I always get a "USB device not recognized" error within Windows. I'm assuming that it can only be clock related and that for some reason, the USB isn't getting the 48MHz from my 8MHz external reference (120MHz PLL).

I know for a fact that my CPU is running at 120MHz so I'm currently stumped for clues as to where to look next.

One thing I have noticed is that the Reference Manual states that when setting PRDIV0, to divide down the external reference clock, the resulting frequency for the PLL must be in the range of 8-16MHz. I'm using a PRDIV0 of 1 (divide by 2) and a VDIV0 of 14 (multiply by 30) to give my 120MHz however this would mean that after the PRDIV0, the PLL would be only 4MHz, outside of the range.

Can anyone offer any suggestions as to what I could try?

This isn't an MQX project.

Thanks in advance,


Labels (1)
3 Replies

Contributor II


You need 48MHz to operate USB correctly but there are multiple ways to get this 48Mhz clock.

I think you will be using the internal PLL output to clock the USB module so you need to modify SIM_CLKDIV2 register on the SIM (system integration module) to divide the PLL output to get 48Mhz for the USB.

If you have 120MHz on your PLL output you have to divide 120/5=24 and multiply it by 24x2=48 then you will have 48Mhz on the USB module

Contributor V

Thanks for both your replies. In the end, I decided to use PLL1 to generate the 48MHz clock. Initially the USB device would still come up as device not recognised but foolishly, I had the wrong USB divisor set as I'm mistakenly used the USBDIV_MASK mask rather than USBDIV(n) macro.

All is working now from PLL1.

Thanks again for your suggestions.

0 Kudos

Contributor IV

Similar problems at this end - tinkering wirh MCG, OSC and SIM got a working arrangement eventually.

If you have access to the FB_CLK pin, set up a flexbus clock to run at the same speed as the USB source clock.  Checks the PLL.

Check the errata in case you have an eary k60, which had trouble with the crystal oscillator.

Download and run Processor Expert to get clock configuration code - which should work properly.

Add some capacitance into OSC_ resgiesters to get a symmetrical crystal waveform