Main Site Documentation

WATCHDOG Do not take care of ResetCounter()


#1

Hi All,

Another strange affait with WatchDog…

I implemented the code given in the beginner guide, and to make a test, I comment the folowwing instruction :

 //Watchdog.ResetCounter();

If I well understand how the Watchdog run, it would normally reboot the device after my 5 seconds timeout, but does nothing like this !

My program continue running in any case… Is there any mistake or trick I did not understood ?


#2

What does your program do? Are you sure it didn’t reset?


#3

Well,

I have a control that deals with showing the current time/hour to the chipworkx user interface. In the Initialize method, i build the several control items, initiate a thread that will refresh the time/hour each second, and start it…



private void InitializeComponents()
{
..
            // Refresh timer each 1 seconds
            dispatcherTimer = new DispatcherTimer(this.Dispatcher);
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1);
            dispatcherTimer.Start();

...
            GHIElectronics.NETMF.Hardware.LowLevel.Watchdog.Enable(5000);
....
}


Then, on each second, it launch the refresh, and also reset the watchdog counter



void dispatcherTimer_Tick(object sender, EventArgs e)
{
           lock (timerlockObj)
           {
            //
            // Date time
            //
            currentDateTime.TextContent = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");

            //
            // WatchDog reset
            //
            Watchdog.ResetCounter();
           }
}


All of this works fine, but however I comment or not the ResetCounter, it has no effect…


#4

Another thing strange…

When I reboot my Chipworkx device (to enter in debug mode for example), an error is thrown on the Enable instruction, as if the Watchdog wasn’t correctly reset on bootup…

the only two ways to avoid this problem is :

  • Reboot with a power shutdown (but not possible to enter in debug mode then…),
  • Put the Enable instruction in a try catch, and do not manager the catch (but how to ensure in this case the watchdog is effectly enabled or not…).

No instruction makes us know the Watchdog state before enabling, and input a disable before enable causes the same trouble. Of course I’m talking about GHI implementation of Watchdog, not the one from Microsoft !


#5

Please refer to the API reference for details and provide a very small program that demonstrate the issue.


#6

#7

Hi All,

I’ll try a very simple case next day, just to check and get back to you with further information…

Regarding to your last post, I effectively know about that key point, but my problem is not really there…


#8

You have mentioned it as “another thing strange” in you previous post

[quote]Another thing strange…

When I reboot my Chipworkx device (to enter in debug mode for example), an error is thrown on the Enable instruction, as if the Watchdog wasn’t correctly reset on bootup…[/quote]

Anyways, having a simple case will help to troubleshoot the issue. Thank you.