Watchdog timer bricked my ethermega (Solved)

Combining the power of the ATmega2560 MCU with onboard Ethernet, a microSD card slot, an efficient switchmode power supply, and a small prototyping area. [Product page]
Post Reply
jens
Posts:2
Joined:Fri Aug 03, 2012 4:01 am
Watchdog timer bricked my ethermega (Solved)

Post by jens » Fri Aug 03, 2012 4:29 am

As most people know the Mega 2560 standard boot loader from sparkfun etc. does not support watchdog timer unless you put a modified boot loader on them (They do support it but they get bricked if it tries to reset), to recover from this you simply flash a new boot loader on the board.
Today I stumbled upon the EtherMega board and liked it allot, because it has SD and Ethernet out of the box, and I noticed this "Reset management chip." on freetronics.com

To test it I ran this code

Code: Select all

#include <avr/wdt.h>

void setup(void) {
  Serial.begin(9600);
  Serial.println("Booted");
  wdt_enable(WDTO_2S);
  
}

void loop(void) {
delay(1000);
Serial.println("loop");
wdt_reset();
delay(3000);
}
And now I got a "bricked" EtherMega, So I would like to flash a new bootloader onto it but the settings are different from the Sparkfun Mega 2560 can any one help me please ?

------------------My current bat file for flashing sparkfuns mega-----------------------
avrdude -P COM5 -b 19200 -c avrisp -p atmega2560 -v -e -U efuse:w:0xFD:m -U hfuse:w:0xD8:m -U lfuse:w:0xFF:m

avrdude -P COM5 -b 19200 -c avrisp -p atmega2560 -v -e -U flash:w:stk500boot_v2_mega2560.hex -U lock:w:0x0F:m

This did not work since the device ID is different, I tried forcing it with the -F option (let's hope I did not totally brick it)
I do have a uno I use for avrisp.

So the question is how do I unbrick my ether mega and where do I get a boot loader that supports watchdog timer for it ?
Thank you beforehand for helping
Last edited by jens on Mon Aug 06, 2012 3:19 am, edited 1 time in total.

dBc
Posts:7
Joined:Sun May 20, 2012 10:46 pm

Re: Watchdog timer bricked my ethermega

Post by dBc » Sun Aug 05, 2012 8:05 am

I've read about bootloaders needing to be compatible with the watchdog before and put off enabling it because I didn't fully understand the problem. Hopefully someone here might know the answer....

Your call to:

wdt_enable(WDTO_2S);

only enables the watchdog timer until the next power cycle right?

So if a powercycle doesn't fix your problem, is the problem that the current bootloader jumps immediately to your code (which then re-enables the watchdog timer) before you can get a chance to re-flash it with some code that doesn't?

I wonder if some speedy combination of power-cycle followed by DTR pulse would get you out of that loop? I'm not game to try it myself ;-)

jens
Posts:2
Joined:Fri Aug 03, 2012 4:01 am

Re: Watchdog timer bricked my ethermega

Post by jens » Mon Aug 06, 2012 3:19 am

Thank you all for your advice.
I found a bootloader for the Mega 2560 with watchdog timer added in here: (Comment 29) https://code.google.com/p/arduino/issue ... rt=&id=181

Here is the bat file I use together with an arduino uno setup for ISP.

Code: Select all

avrdude -P COM5 -b 19200 -c avrisp -p atmega2560 -v -e -U efuse:w:0xFD:m -U hfuse:w:0xFF:m -U lfuse:w:0xFF:m
avrdude -P COM5 -b 19200 -c avrisp -p atmega2560 -v -e -U flash:w:stk500boot_v2_mega2560.hex -U lock:w:0x3F:m
I don't think the fuses are correct but it works :) even with some of the errors avrdude gives back.

Here is the wireing and general info on using an Arduino uno as an isp
https://www.sparkfun.com/tutorials/247

Again thank you all

Post Reply