Main Site Documentation

Problem using Watchdog timer


#1

I’m having a problem utilizing the watchdog timer.

I’ve enabled the GHI watchdog time, but purposely did not call the reset function to see if it would work but the ChipworkX never restarted. See code below I used to enable and set the watchdog timeout.


uint wdTimeout = 5000;

GHIElectronics.NETMF.Hardware.LowLevel.Watchdog.Enable(wdTimeout);

I then ran it in debug mode in Visual Studio and got the following error:

A first chance exception of type ‘System.InvalidOperationException’ occurred in GHIElectronics.NETMF.Hardware.dll
An unhandled exception of type ‘System.InvalidOperationException’ occurred in GHIElectronics.NETMF.Hardware.dll

If I then stop debugging and reset the device (without debugging), the program seems to start up fine.

However the watchdog timer never seems to have any effect.


#2

Remember once you enable watchdog, you can’t disable it anymore.

To test that it does work. Write a simple test that will blink a led once and enter infinite sleep. If watchdog is enabled you will have blinking led.


#3

How do you change the watchdog timeout then?


#4

I believe you can change the timeout but can’t disable it.


#5

Gus: There doesn’t appear to be anyway to set it other than with the enable function.

More importantly is that I purposely never call the ResetCounter function to see if it works, but the device never re-boots. Am I understanding it correctly? Once I’ve enabled it with a timeout of 5000 (5 sec) and never call the ResetCounter function the device should re-boot after about 5 seconds right?


#6

What I mean is that you can call enable again with different timeout.

Yes the device should reset in 5 seconds.


#7

From documentation:


#8

It definitely does not restart after 5 seconds which is the watchdog timeout.


#9

Hi All,

I had the same post few month ago, and steel waiting for an idea on what is going wrong…

My post :

“WATCHDOG DO NOT TAKE CARE OF RESETCOUNTER()”