Paul McInnes

How to stop a runaway watchdog

Discussion created by Paul McInnes on Jun 26, 2012
Latest reply on Jul 20, 2012 by Luis Casado

Hi All,

I've just taken delivery of a couple of TWR_S08DC_PT60 boards (MC9S08PT60) and managed to brick one of them already.


I first loaded the demo app that they shipped with - the TWR_S08DC_PT60_LAB, which worked just fine. Then I created a new CW project and put together a very simple interrupt based tick timer using code that I've used many times before on an S08 device plus some setup code from the lab demo. Now the device is inaccessible, it resets about every 30 mS. The problem is that the OSBDM connection is not working either - I suspect that the reset signal is also resetting the OSBDM chip.

I believe the problem is the watchdog, even though it's supposed to be disabled.

The lab code uses a macro to unlock the watchdog so that it can be disabled. The macro consists of assembly code and is triggering a syntax error in CW, however the error does not propagate beyond the source editor and does not stop it compiling. Whether the error is bogus or not I can't tell, it could be a red herring. The lab code appears to work fine using the same macro.
I am however resetting the watchdog in my run loop (even though it should be disabled), but I'm not bracketing that with disable/enable interrupt calls. Perhaps after 30 mS or so, my tick ISR collides with the watchdog reset process and causes it to fail, thereby triggering the device reset.

My main concern here is to find out just what went wrong so that I don't continue to destroy hardware. But fixing it would also be great.

So, my questions are:
1: Would a failed reset of the watchdog cause it to reset the device even when the watchdog is disabled? (the datasheet says only that the watchdog enable bit inhibits the WD counter)
2: Could the reset from the device be resetting the OSBDM chip, thereby causing the link to the PC to fail? The reset_in line to the OSBDM chip goes to a port pin.
3: Does this all sound plausible? what else could be going on here?
4: If my various assumptions are correct, is there any way to recover this, apart from replacing the chip?

I'm happy to post the code if that would be usefull.

Regarding the OSBDM: I successfully reflashed the OSBDM chip using the PE Micro tools, but now CW claims the firmware is out of date (so it can at least read the chip) but fails when it attempts to reflash it.

If any body has any insights, I would be very gratefull.

 

Thanks

Paul M

Outcomes