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

Fernando Me Ga ferradi at gmail.com
Thu Apr 8 12:40:51 CEST 2010


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.

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;
}



More information about the En-Nut-Discussion mailing list