Go Down

Topic: use Watchdog to restart / reset (Read 889 times) previous topic - next topic

hole

Hi,

I have a well working Arduino application. "Well working" means that it runs and runs and runs. No lock up and other annoyances, runtime greater some weeks without problems.

As designed it writes data into a (serial attached) tracking device, so I see power outages etc. by writting out messages during setup().

I thought about adding a watchdog to catch the situation that are not handled... My idea was to do a reset and write something into the log file if timer expires.

After reading some forum entries about the watchdog I'm quite sure that I don't understand the watchdog function.

My code looks like that:

Code: [Select]

void setup() {
 wdt_enable(WDTO_8S);
 wdt_reset();

 pinMode(ledPin, OUTPUT);
 addtask(blinker);
}

void loop() {
 taskswitcher();
 delay(10000);

 wdt_reset();
}


(task manager is a simple sheduler, blinker should blink like in blink-demo)

At runtime I see it wait and then the led starts to blink really fast.

Any help to enlight me? Thanks!

Andy Brown

The standard bootloader does not support the watchdog functions. The necessary support code exists, it's just not compiled in by default (why?). You could quite easily burn your own bootloader with watchdog support if you have an ISP.
Home of the Nokia QVGA TFT LCD hacks: http://andybrown.me.uk

hole

This means: no way to implement my idea without bootloader change?

Go Up