11 years, 6 months ago.

KL25Z Watchdog

I would like to use the Watchdog timer which I believe is available in the KL25Z but I can't find any documentation, could anyone point me in the right direction?

I don't want to do anything fancy, just a basic re-start if the main loop fails. The program I have loops every 5mS so I can kick/feed the dog relatively often and I'm not desperate about a re-start immediately so even 1sec+ delay would be no problem.

Please be gentle with me I'm a newbie to MBED and C/C++

2 Answers

9 years ago.

Hi,

I found same problem and fixed it by overloading SystemInit()

Take a look to: https://developer.mbed.org/users/Manel_Marin/code/KL25Z_WATCHDOG_USBSERIAL/

Accepted Answer
11 years, 6 months ago.

KL25Z documentation: http://cache.freescale.com/files/32bit/doc/ref_manual/KL25P80M48SF0RM.pdf (imo mbed people should add that to the hardware page). (page 215 and also later on something)

Register names in mbed environment: https://mbed.org/users/mbed_official/code/mbed-Freescale/file/3a8b2b3870fb/cmsis/KL25Z/MKL25Z4.h

That means the relevant registers are addressed as:

SIM->SRVCOP = ...

and

SIM->COPC =...

(Freescale can really learn something from NXP regarding user manuals).

if I send 0x0c to COPC which I interpret to equate to COPT = 0x11 COPCLKS = 0x0 and COPW = 0x0 the watchdog does not seem to be enabled, I have a simple test program that goes into an infinite loop after feeding the dog a few times. Any ideas ?

posted by David Bottrill 21 May 2013

A quick check makes me think that should work, that clock source should always be enabled. But I don't have an KL25 so I can't try for myself.

posted by Erik - 22 May 2013

Would someone, such as Simon, post an example of using the KL25z watchdog timer that mortals could use, like the example Simon posted for the LP1768 here <http://mbed.org/users/simon/code/WatchdogExample/>? Thanks.

posted by Yale E. Goldman 22 May 2013

I've had a more experienced friend look at this and like me he's unable to use the watchdog timer. Given the KL25z documentation states the watchdog COPC register can only be written once post reset it seems possible the compiler is disabling the watchdog during CPU initialisation hence the problem. Could anyone involved in the compiler customisation for the KL25z comment?

posted by David Bottrill 31 May 2013