Pages: [1]   Go Down
Author Topic: use Watchdog to restart / reset  (Read 824 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 2
Posts: 48
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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!
Logged

Essex, UK
Offline Offline
Full Member
***
Karma: 4
Posts: 150
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Home of the Nokia QVGA TFT LCD hacks: http://andybrown.me.uk

0
Offline Offline
Newbie
*
Karma: 2
Posts: 48
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: