Pages: [1]   Go Down
Author Topic: WDT question on new Arduino Mega2560  (Read 2882 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Helo,

I can't get the wdt to work. It looks like when it's detect a wdt interval exceeded, it keeps on ressetting and the arduino hangs.

here my simple test program:


#include <avr/wdt.h>

void setup(void)
{
   Serial.begin(57600);    // start serial port
//  wdt_disable();
  wdt_enable(WDTO_8S);   // set the wdt on 8 sec
}

void loop(void)
{
    wdt_reset(); // reset the wdt
Serial.println("delays 5000");
 delay(5000);
 wdt_reset(); // reset the wdt
 Serial.println("delays 7000");
 delay(7000);
  wdt_reset(); // reset the wdt
  Serial.println("delays 10000");
 delay(10000);
   Serial.println("delays 15000");
 delay(15000);
}

oUTPUT IN SERIAL:
delays 5000
delays 7000
delays 10000

Of course I already read a lot with the WDT problems. But as I have a very recent Arduino (oct 2010), I suppose the bootloader problem for the wdt is solved already.

Please advice,
Jeroen
« Last Edit: November 15, 2010, 02:02:48 pm by jm_wsb » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No one experience with this ??

It seems to me a basic question. Experts ??
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

noone to help ??
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13074
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Helo,
Hello.

Quote
It looks like when it's detect a wdt interval exceeded, it keeps on ressetting and the arduino hangs.

Output in Serial Monitor:
delays 5000
delays 7000
delays 10000
Are you saying that nothing else is displayed in Serial Monitor?  That the last message is "delays 10000"?  You wait for 15 seconds after the "delays 10000" message and nothing else is displayed?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Indeed,

As soon as the within the WDT interval (ie. 8 sec) no wdt_reset() is executed, the WDT is fired. The first delay > 8 sec is the one of 10 sec (10000 millis)
But the arduino will do nothing anymore.

Please advice,
Jeroen.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13074
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


When the watchdog resets the board, does the bootloader run?  It's my understanding that the bootloader flashes an LED while it runs.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

After the 10000 output in serial, 8-9 sec after, the LED13 on the board keeps on flashing.
So yes, the bootloader is running and the led keeps endless flahing.

Best regards,
Jeroen.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13074
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


The problem is that the watchdog timer continues to run even after a timeout / reset occurs.  Ideally, the bootloader would "pet the dog".  The next best solution would be for the bootloader to turn off the watchdog.  I thought the latest bootloader (Optiboot) jumped immediately to the Sketch if the reset was because of a watchdog timeout but that does not appear to be the case.

So, the watchdog continues running after the first reset.  The bootloader takes long enough to run that another watchdog timeout occurs.  The board resets again.

Unfortunately, your options are: 1. Modify the bootloader; 2. Ask the bootloader author to modify it; 3. Do without a bootloader; 4. Don't use the watchdog to reset the board.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, thanks,

I will try to flash the bootloader

Jeroen
Logged

Pages: [1]   Go Up
Jump to: