Go Down

Topic: Unable to upload sketches to board (Read 638 times) previous topic - next topic


Jan 11, 2012, 05:16 am Last Edit: Jan 11, 2012, 05:32 am by AnguishedEnd Reason: 1
OS: Windows 7
Board: Mega 2560 R2
IDE: I've tried both versions, 0022 and 1.0

Problem: Today I was able to upload sketches just fine until I tried implementing a Watchdog timer. Since then I am unable to upload ANY program to the board. This includes the 'BareMinimum' sketch given in the examples which includes just a setup() and loop() nothing else and both methods are empty. The sketch compiles fine and it finds the board so the port is correct. What happens is that it hangs on the 'Uploading to I/O board'. Normally it takes just a few seconds, but now I can wait for minutes and nothing happens. Once I unplug the USB I get the below error message which I think is somewhat unrelated to my problem. I have tried clicking the reset button to no avail. Another thing to note is that the Pin 13 LED blinks really fast compared to before! Also knwo that I selected the correct board and comm port...

Code: [Select]
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail

The sketch I uploaded before everything went downhill:

Code: [Select]

#include <avr/wdt.h>

void setup() {
void loop() {
 * do other stuff

So what I think what is happening here is best described here: http://forum.jeelabs.net/node/449
Simply put the sketch cannot upload fast enough before the Arduino is reset since the watchdog timer kicks in. The last post is kind of unsettling: "If you'd accidentally use a watchdog timeout smaller than the bootloader delay, you'd have to use an ISP programmer to recover :-/ Nasty indeed...". Is this the case for the Arduino Mega 2560? I would think there is some sort of fail safe of something? Are there any solutions other than burning a new bootloader?

Any help/suggestions are appreciated. Thanks!


I've also tried pressing reset button when I see, ""Binary sketch size: nnn bytes..." and nothing happens.


Jan 12, 2012, 07:24 pm Last Edit: Jan 12, 2012, 07:33 pm by AnguishedEnd Reason: 1
Since no one has replied and I hate reading posts that describe a problem I may be having exactly but no answer to follow, here it is!

So I spent a lot of hours reading posts for a solution turns out burning a new bootloader is the only thing that will fix this problem! I did it with an STK500 board from school thanks to the help of my TA.

What you will need:

Option 1:

- An STK500 or any programmer really
- AVR Studio 4.0+
- Serial-USB converter cable if your using STK500

Option 2:

- A functioning Arduino (NOTE: You cannot use an UNO as ISP!)
- Arduino IDE 0022+


Option 1:

- Hook up STK500 to computer via USB-Serial converter cable and hook up the power to it

- Hook up the STK500 ISP 6 pins (http://www.atmel.com/dyn/resources/prod_documents/doc1925.pdf) to the Arduino ICSP 6 pins (http://arduino.cc/en/uploads/Main/arduino-mega2560-schematic.pdf). The Arduino should not be connected to anything other than ICSP pins.

- Open up AVR Studio. Click Tools->Program AVR->Connect. Platform will be STK500 or whatever programmer your using. Select port (if your unsure check Device Manager). Now a window should pop up. Go to the Main tab and select the chip you need to program (If your using Arduino Mega 2560 then it's ATMEGA2560 duh!). Then click 'Read Signature'. Next select 'Program' tab. In the 'Flash' section click browse to find HEX file. This hex file should be in your Arduino install folder under hardware->arduino->bootloaders. Browse for your proper bootloader. If your using Arduino MEGA 2560 its the folder 'stk500v2'. Your looking for 'stk500boot_v2_mega2560.hex'. Then click 'Program'. That's it!

Additional help: http://www.kkmulticopter.com/index.php?option=com_content&view=article&id=90:programming-the-ic-with-avr-studio-4&catid=50:programming-the-ic&Itemid=65

Option 2:

Sparkfun has a proper tutorial: http://www.sparkfun.com/tutorials/247
Also: http://arduino.cc/en/Tutorial/ArduinoISP


Go Up