[En-Nut-Discussion] Watchdog/Idle thread issues again

Bernd Walter enut at cicely.de
Wed Dec 7 16:16:49 CET 2005


On Wed, Dec 07, 2005 at 10:55:44AM +0100, Ulrich Hertlein wrote:
> What's the way out here? I can't just use the hardware watchdog since
> its max. timeout is ~2s which is not enough for the network stack.
 
I use the hardware watchdog to get a 30s timeout.
You can always increase it with a software counter.
 
static volatile uint32_t wd_toc;
 
SIGNAL(SIG_OVERFLOW2)
{
        if (wd_toc != 0) {
                wd_toc--;
                wdt_reset();
        }
}
 
Then setup timer2.
Now you can set wd_toc to a given timeout value whenever you feel
your system happy.
If your system won't reinit wd_toc the interrupt routine won't reset
the hardware watchdog and the system reboots a short time later.
If the interrupt routine won't run the system will reboot within a
short time.
 
You can even add additional softtimers for different subsystems, and
reset the hardware watchdog only if all values are non-zero.
That way you can have different alive checks with different timeouts
for each subsystem.
 
-- 
B.Walter                   BWCT                http://www.bwct.de
bernd at bwct.de                                  info at bwct.de




More information about the En-Nut-Discussion mailing list