Watchdog reset, Cortex M4, KSDK, MQX

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

Watchdog reset, Cortex M4, KSDK, MQX

839 Views
_ZZ_
Contributor II

Hello everyone,

Does anybody know what would be the best approach to track down he watchdog reset reasons?

I have an application which run on a Kinetis Cortex M4 (K20  MCU). I am using KSDK MQX for my application as well. I have not used the watchdog component of the MQX OS at all and I have written it in bare metal code. I have tested my watch dog functionality in terms of timing and other bits and pieces. works fine. So, I doubt there is anything wrong with the watchdog itself. it resets the unit because somewhere my code get stock (most probably will end up to the idle task of the MQX OS). so, my question is how could we find out where the code get stock. the resets happens at random intervals and it is not a fixed period in terms of time. it application runs for 24 hours, it might see about 2 to 3 resets done by the watchdog.

Many thanks for any help in advance, 

0 Kudos
2 Replies

579 Views
mjbcswitzerland
Specialist V

Roosbeh

Method 1 - use the watchdog's interrupt to save the context to an unused area of RAM (and maybe some stack values).
When it happens you can use this information to track down what the processor was doing when the watchdog fired.

Method 2 - don't use the watchdog but instead use a free HW timer to do the same watchdog function (same delay, re-trigger it at the same location) but set a break-point in its interrupt routine.
If it breaks it means that the watchdog "would have fired" at this point in time but you now have the debugger to analyse what happens when the timer interrupt routine returns.

Method 3 (if method 2 doesn't work) - disable the watchdog and see whether it is a program crash (such as a hard fault) that throws the processor into an endless hard fault interrupt (for example).

Regards

Mark

http://www.utasker.com/kinetis.html
http://www.utasker.com/kinetis/FRDM-K20D50M.html
http://www.utasker.com/kinetis/TWR-K20D50M.html
http://www.utasker.com/kinetis/TWR-K20D72M.html
http://www.utasker.com/kinetis/TEENSY_3.1.html
http://www.utasker.com/kinetis/tinyK20.html

579 Views
_ZZ_
Contributor II

Thanks for your reply Mark,  I am very keen on the first method and stack anslysis. Will give the timer method a go as well. 

0 Kudos