[En-Nut-Discussion] Problems with WatchDog using multithreads

Bernd Walter enut at cicely.de
Thu Apr 8 14:11:25 CEST 2010


On Thu, Apr 08, 2010 at 12:40:51PM +0200, Fernando Me Ga wrote:
> Hello,
> 
> I am trying to use WatchDog in my application but there is a problem
> when several thread use NutSleep. These threads get block and the
> WatchDog restart the system before the specified timeout. In the
> simple example below it is expected to each thread puts there message
> every 10 seconds but does not. They put there message only ones and
> soon after the system restart.

I never used NutWatchDog*, but unless it uses an internal softcounter
you can't have such high values, since hardware counter are way
to small for that.
I usually have a cyclic interrupt routine, which has a softcounter
for every subsystem and as long as non of them drops to 0 it
restarts the hardware counter.
This way I can also save a short marker about the subsystems failing.

> What is the problem?
> What could be happening?
> 
> Thanks a lot.
> 
> 
> THREAD(Thread, arg)
> {
>     for(;;) {
>         puts("Thread 1...");
>         NutSleep(10000);
>     }
> }
> 
> int main(void) {
>     /* ... */
>     NutWatchDogStart(120000, 0);
>     printf("\nWatchdog Started\n\n");
>     NutThreadCreate("td", Thread, 0, 256);
>     for (;;) {
>         NutWatchDogRestart();
>         printf("Watchdog restarted\n");
>         NutSleep(10000);
>     }
>     return 0;
> }
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion

-- 
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.



More information about the En-Nut-Discussion mailing list