Author Topic: TWR-K60F120M  (Read 9628 times)

intern

  • Guest
TWR-K60F120M
« on: November 15, 2012, 01:41:29 PM »
Hi

I am trying to run uTasker on a Kinetis, but when i run it it stops at static void irq_hard_fault(void).
I have looked for a solution in this forum but no luck.

If i step thought it to
Code: [Select]
    while (1) {
        uTaskerSchedule();                                               // schedule uTasker
    }
and then run it from there nothing is wrong and i can communicate with the board with rs323.

i am debugging in CW 10..
I have made no changes to the code beside configured it to the right board..



Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: TWR-K60F120M
« Reply #1 on: November 15, 2012, 02:15:50 PM »
Hi

What happens if you don't have the debugger connected and let the board start normally?

A hard fault means that there has been an access to non-existant memory (or similar). Since you can step through code to a certain point and then run there may be some debugger behaviour that is causing it.

If you hit the hard fault you shoudl be able to step out of the handling routine (maybe best in disassembler mode since not all debuggers are good at this) and see which line it returns to. The line before it is probably the line that caused the exception to be triggered (check the code in disassembly format to see which address pointers are being used for access and you may be able to work out why it is doing this - check to see whether the address is a peripheral register address).

Also be careful that the correct target has been set (there are different ones for K40 and K60, with and without boot loaders).

Regards

Mark

intern

  • Guest
Re: TWR-K60F120M
« Reply #2 on: November 15, 2012, 03:19:26 PM »
Hi

The target I use is K60FN1M0 so that is okay..

If I try to step from the interrupt i get "No Source available for "0x00000000 (0X00000000)()""

i don't know how to disconnected the debugger because it is the power source..

If i step though it with 'step into' the program is just jumping around in kinetis.c. It starts in main and goes down to fnInitHW. In fnInitHW is called _LowLevelInit(), and in there it jump around
Code: [Select]
    INIT_WATCHDOG_DISABLE();
    if (!WATCHDOG_DISABLE()) {                                           // if the watchdog disable input is not active
        ACTIVATE_WATCHDOG();                                             // allow user configuration of internal watchdog timer
    }
    else {
    UNLOCK_WDOG();                                                   // open a window to write to watchdog
        WDOG_STCTRLH = (WDOG_STCTRLH_STNDBYEN | WDOG_STCTRLH_WAITEN | WDOG_STCTRLH_STOPEN | WDOG_STCTRLH_ALLOWUPDATE | WDOG_STCTRLH_CLKSRC); // disable watchdog
    }
and after that it starts all over again..

intern

  • Guest
Re: TWR-K60F120M
« Reply #3 on: November 15, 2012, 03:54:20 PM »
Do i need to change anything other then in #ifdef _KINETIS change to #define KINETIS_K60?

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: TWR-K60F120M
« Reply #4 on: November 15, 2012, 06:21:39 PM »
Hi

This sounds as though it may in fact be the watchdog - see the watchdog section in http://www.utasker.com/docs/KINETIS/uTaskerV1.4_Kinetis_demo.pdf

Try putting a break point just after the watchdog configuration and let the debugger run after you have connected. You may find that it can run to it but can't step to it. This is typical behaviour due to the watchog design.

If you can program to flash you should be able to power the board via USB on the backplane, rather than the processor board.

Regards

Mark

intern

  • Guest
Re: TWR-K60F120M
« Reply #5 on: November 16, 2012, 11:12:36 AM »
Hi

So i tried to choose the other k60 in config.h and now the code runs a bit but is getting stuck in
Code: [Select]
      while ((MCG_S & MCG_S_LOCK) == 0) {                                  // loop until PLL locks
Do you have any idea what is wrong here..

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: TWR-K60F120M
« Reply #6 on: November 16, 2012, 03:31:28 PM »
Hi

Again I recommend putting a break point after such code.

Some chips/debuggers have difficulty stepping through PLL initialisation routines but, if you let it run through it, it is OK.

Regards

Mark

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: TWR-K60F120M
« Reply #7 on: March 11, 2013, 03:02:43 PM »
Hi

If you use disassemble mode the debugger may be able to exit from the intrerupt and they you can see where the problem is.
Unfortunately not all debuggers behave the same - some can and some can't do this (I don't know why though).

Such problems are often due to peripherals being accessed which have not been powered up. Check that when you use new peripherals you also power them up before accessing any registers.

Regards

Mark