TWR-K60F120M hangs on debug

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

TWR-K60F120M hangs on debug

744 Views
vanmalan
Contributor I

I have a new TWR-K60F12M rev C1.  I am trying to run any of the demos with the Eclipse CW ver 10.6.  I have tried the K60 gpio kinetis example project.  the RAM configured build.  the sample hangs in pll_init waiting for the lock...

  while (!(MCG_S & MCG_S_LOCK_MASK)){}; // Wait for LOCK bit to set

I see others having trouble with this in the past but the suggested solutions don't seem to match my board support code.  any suggestions?

0 Kudos
6 Replies

467 Views
DavidS
NXP Employee
NXP Employee

Hi Van,

Please read the following:

C:\Freescale\Freescale_MQX_4_1_0_GA\doc\MQX_Getting_Started.pdf
Page 57 has the TWR-K60F120M jumper configurations MQX expects for the MCU and TWR-SER cards.

I'm attaching a ZIP file that has pictures of my two cards as reference.

Please note most MQX applications are too big to run from SRAM only and need to be programmed to flash.

Regards,

David

0 Kudos

467 Views
vanmalan
Contributor I

David,

thanks for the response. the GPIO example is quite small and I got it to

go with some messing around. maybe you could verify my settings as I had

to manipulate the values used for MCG_C5 and MCG_C6 in order to get pll

lock and for the baud rate to be correct at 115200.

the original generated source in pll_init had

#if (defined(K60_CLK))

MCG_C5 = MCG_C5_PRDIV(0x18);

which expands to MCG_C5 = 0x18; I thought this strange since the manual

(K60P144M150SF3RM.pdf) shows bits 4 & 5 as read only. so this was really

MCG_C5 = 0; I changed to MCG_C5 = 5; and now the PLL is happy. the

effective baud rate was not good (through the USB cable) and so I looked

further and found

MCG_C6 = MCG_C6_PLLS_MASK | MCG_C6_VDIV(24); //VDIV = 24 (x48)

again, this expands to MCG_C6 = 0x40 | 24; this value seemed much to

large. so after some experimentation and my oscope, I set it to

MCG_C6 = MCG_C6_PLLS_MASK | 7;

now the PLL is happy and the effective baud rate is 115200 as it should be.

so, did I choose correctly? is it possible in the latest release that the

macros for MCG_C5_PRDIV and MCG_C6_VDIV have changed?

On Fri, Aug 1, 2014 at 6:50 AM, David E Seymour <

0 Kudos

467 Views
DavidS
NXP Employee
NXP Employee

Hi Van,

What code are you running?  I'm guessing not MQX.  Correct?

Regards,

David

0 Kudos

467 Views
vanmalan
Contributor I

I imported the sample application with CW from this folder...

C:\Freescale\CW MCU v10.6\MCU\CodeWarrior_Examples\Kinetis_Examples\k60\gpio

it is part of the evaluation development tools from Freescale.

On Fri, Aug 1, 2014 at 9:27 AM, David E Seymour <

0 Kudos

467 Views
DavidS
NXP Employee
NXP Employee

Hi Van,

That helps.  Thanks.

The example you are pointing to and using is only for the TWR-K60N512 and not TWR-K60F120 (or even the TWR-K60D100M).

The TWR-K60N512 is K60-100MHz Rev1.x silicon (oldest and not recommended for new designs).

The TWR-K60D100M is K60-100MHz Rev 2.x silicon (newest).

Your TWR-K60F120M is different silicon and 120MHz.  Therefore the clocking is different and the cause of your issues.

You can use CW10.6 to create a new bareboard K60F120M project.  But that gets messy as you need to configure clocks and more...

Or goto the TWR-K60F120M Product Page and click on the Downloads tab (Kinetis K60 120 MHz Tower System Module|Freescale) and search for following:

KINETIS_120MHZ_SC.zip code that has baremetal projects for you.  Note the SC CodeWarrior projects for this device are labeled "k60" which is confusing and might be thought to be for any and all k60 devices but is only for the K60-120MHz devices.

Or go to www.freescale.com/mqx and download the latest MQX4.1 which has RTOS support for the TWR-K60F120M.

Regards,

David

0 Kudos

467 Views
vanmalan
Contributor I

David, awesome advice. got the right project and all is good.

On Fri, Aug 1, 2014 at 10:03 AM, David E Seymour <

0 Kudos