Please help! watchdog ruined my mega2560 board

Hi all,

I had my Mega 2560 replaced and bought another one, so I have 2 boards to start
development. My first project is to replace a PIC uController on a refrigerator because it
is unstable (it resets after a few days).

I tried the 2 boards and they worked fine. Until I tested the watchdog on one board.

Here is the code:

void setup () {
   wdt_enable(WDT0_2S);
   Serial.begin (9600);
}

void loop () {
   wtd_reset ();
   Serial.println (millis());
   delay(500);
}

Now the board is unusable. It resets every 15ms. Googling I find this is a nasty bug.

Without watchdog, Arduino is unusable for real world applications, like my refrigerator.

Now my problem is how to rescue the bricked board. I opened the ArduinoISP and burned
it into my good board. I did the cabling as suggested on the program:

Programmer -> Target board (the 2 are arduino 2560)
50 -> 50
51 -> 51
52 -> 52
53 -> 53

It will not work. Gives me a programmer is not responding error. I also tried to connecr pin 53 on the
programmer board to reset on the target board.

I used Tools -> Programmer -> Arduino as ISP
Then I went to Tools -> Burn Bootloader.

I am using Arduino 1.0.1

This is really frustrating. Please help. I do not have another Atmel programmer available.
Please help me understand what am I doing wrong.

Also, will the bootloader included in version 1.0.1 be watchdog friendly?

I was thinking about connecting:

Host -> Target (ICSP port)
50 -> 1
51 -> 4
52 -> 3
53 -> 5
+5V -> 2
GND -> 6

Will this work?

Documentation on the arduino site is for uno and decimilla... it is so frustrating...

Thank you

Did you put a 100nF Capacitor Between +5V and RESET pin on the working Arduino Mega 2560 to disable auto reset?

Have you tried power cycling the non-working Arduino and then IMMEDIATELY trying to upload a new sketch?

That was it! Thank you! I needed the 100nF cap on the host board and pin 53 from the host to reset.

Can you please point me to a bootloader for the Mega 2560 that is watchdog friendly?

Thanks again!

Referenced from here: Desert Home: Arduino Mega2560 - Wrapping up the Bootloader Problem

It worked like a charm. Thank you very much. I noticed it is smaller.

I wonder why hasn't the bug been fixed over time, as it seems that the bootloader is quite old.

Hey guys,

I successfully re-programmed the bootloader for my Mega2560 using an Arduino Uno: http://www.gammon.com.au/forum/?id=11635. However, when the watchdog timer kicks in on my Mega2560, the Mega2560 still locks up, and is not able to reboot. Is the 100nf capacitor still required with the new V2 bootloader? Any other suggestion?

Many thanks,
George

daytrader152:
Hey guys,

I successfully re-programmed the bootloader for my Mega2560 using an Arduino Uno: http://www.gammon.com.au/forum/?id=11635. However, when the watchdog timer kicks in on my Mega2560, the Mega2560 still locks up, and is not able to reboot. Is the 100nf capacitor still required with the new V2 bootloader? Any other suggestion?

Many thanks,
George

Download and burn this Arduino-stk500v2-bootloader/goodHexFiles at master · arduino/Arduino-stk500v2-bootloader · GitHub

It works fine in mega2560 with WDT. It does not need the 100nF cap to boot.

That cap was needed as in my case I built an atmel programmer with another mega2560 and the problem was that when trying to burn the bootloader, when the the program started, it opened the serial port... but then the mega2560 that acted as the programmer did the reset (without the cap) and the burning would fail. After the cap, the programmer would not reset and the programming was successful.

Hope this helps

pastito:

daytrader152:
Hey guys,

I successfully re-programmed the bootloader for my Mega2560 using an Arduino Uno: http://www.gammon.com.au/forum/?id=11635. However, when the watchdog timer kicks in on my Mega2560, the Mega2560 still locks up, and is not able to reboot. Is the 100nf capacitor still required with the new V2 bootloader? Any other suggestion?

Many thanks,
George

If WTDON=0, the reset is not able to reboot?
Download and burn this Arduino-stk500v2-bootloader/goodHexFiles at master · arduino/Arduino-stk500v2-bootloader · GitHub

It works fine in mega2560 with WDT. It does not need the 100nF cap to boot.

That cap was needed as in my case I built an atmel programmer with another mega2560 and the problem was that when trying to burn the bootloader, when the the program started, it opened the serial port... but then the mega2560 that acted as the programmer did the reset (without the cap) and the burning would fail. After the cap, the programmer would not reset and the programming was successful.

Hope this helps

On 20 November 2012 I changed the sketch mentioned to support a watchdog-friendly bootloader for the 2560:

The sketch from my site, or Github, should work now.