Hi everyone, I have ported my application from EMX and 4.2SDK to G400 and 4.3 SDK recently.
Now we need to put our new board and product on the market and we need to enhance reliability of the platform.
On of the issue we need to solve is exception handling and watchdog behavior.
On G400 watchdog is really small compared to EMX and it can not been changed or disable. This is a problem for instruction that can take a big while (file copy for example).
How are you managing this? are you creating a thread that reset the watchdog? I have tried that but when exception occurs in the main thread, the watchdog thread seems to be still alive and the board does not reboot…
If you use a watchdog thread use a counter to see if the main thread is running.
Increment the counter each time through the main loop. In the watchdog thread, if the counter is greater than zero, reset the watchdog and set the counter back to zero.
Ok good, so obious or so genius that I didn’t thought about that… :wall:
Many Thanks Stevepx!
@ stevepx - The meta-watchdog solution. Classic.
I also have plans to implement a watchdog in my current G400 app but have been put off by the inability to turn off the watchdog when my app sleeps. I agree this sounds like an elegant solution from @ stevepx but I’m curious if anyone is aware of any down sides of a software watchdog like this compared to the built in hardware watchdog?
I finally have time to implement this solution.
Here’s the code I wrote:
static int counterWD = 0;
static Thread threadWD;
static void threadwatchdog()
if (counterWD != 0)
counterWD = 0;
public static void Main()
threadWD= new Thread(threadwatchdog);
//Some code here
Unfortunately, this does not work. For instance, if I insert a thread.sleep in the main loop of 5 second, the watchdog should fire and restarts the board. but this is not the case…
What I am missing?
I update the loader to the last version and it works now. I don’t believe that its related but anyway, it works and it is the most important thing.
I am still stuck with this situation especially when File.Coppy occurs on large files. Does anyone here have a solution? As watchdog can not be disabled? I do not have any clue on how to manage this?
To solve this issue I finally decide to perform file copy using FileStream.Read and FileStream.Write in a while loop that increments the WD counter. Now is there any test bench that shows file copy speed vs chunks size?