Author Topic: Kinetis demo: needs single stepping to start  (Read 7043 times)

Offline Predielis

  • Newbie
  • *
  • Posts: 16
    • View Profile
Kinetis demo: needs single stepping to start
« on: April 19, 2011, 08:46:36 AM »
Hello, I'm using CW 10.1 on Vista.
The only way for me to start the demo app is to single step until line 4064 in kinetis.c
  INIT_WATCHDOG_DISABLE();
Then I can run the app normally.
If It runs from the beginning it halts and resets to the first line.
Toggling a breakpoint before the INIT_WATCHDOG_DISABLE line and running from the start does not work, it resets.
It is probably something related to the watchdog.
I'm still trying to master CW, so bear with me.

The demo runs normally, but the "generate 8 meg" dynamic page crashes the app.

Thank you for this fine product.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Kinetis demo: needs single stepping to start
« Reply #1 on: April 20, 2011, 09:41:12 PM »
Hi

Check out the watchdog discussion in the appendix of the following document: http://www.utasker.com/docs/KINETIS/uTaskerV1.4_Kinetis_demo.pdf
It may give some information that explains the case - note that the watchdog needs to be disabled within a certain number of clock cycles otherwise debugging won't work.

I checked the 8 Meg download in the simulator and it worked normally. Therefore I suspect that it may be the watchdog firing during the transfer on the HW. This doesn't happen with other chips but maybe the Ethernet task needs to yield more during the process with the Kinetis - when I next get the chance I'll check this out and see what needs to be done (there are a couple of yielding strategies which can be enable if needed).

Regards

Mark

Offline Predielis

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Kinetis demo: needs single stepping to start
« Reply #2 on: April 21, 2011, 05:03:14 PM »
I somehow solved my problem copying the two lines
 UNLOCK_WDOG();                                                   // open a windows to write to watchdog
             
WDOG_STCTRLH = (WDOG_STCTRLH_STNDBYEN | WDOG_STCTRLH_WAITEN | WDOG_STCTRLH_STOPEN | WDOG_STCTRLH_ALLOWUPDATE | WDOG_STCTRLH_CLKSRC); // disable watchdog
 
At the top of the main() function.

Don't know why it works. Remember that the watchdog didn't kick in when I was slow, just the opposite of what is reasonable.

More details next week.

Regards.