avrdude timeout on mega 2560

Hey

Because of my project increased in size I needed a bigger board. I have now a Arduino MEGA 2560 that I borrowed from the electronics lab at my school. Everything have been running fine until now on my Arduino UNO, but now I can't even upload the basic "Blink" included in the IDE to the MEGA (haven't succeeded uploading a single time yet).

Here's what it tells me:

Binary sketch size: 31,732 bytes (of a 258,048 byte maximum)
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x11
avrdude: stk500v2_disable(): failed to leave programming mode
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout

No blinks on the TX/RX leds either :frowning:

I've spend quite some time now to search the internet for a solution to this problem, and it seems like nobody has a concrete solution since 2010? Maybe I'm just a retard in googling? I really don't believe that :confused:

I've tried to change the line "mega2560.upload.protocol=wiring" in boards.txt to "mega2560.upload.protocol=stk500v2" like some suggests. It didn't work.

I've tried to select other programmers from the tools menu in the IDE with no luck.

I've checked that the MEGA is connected, and that the right board is selected in Tools->Boards.

There's no "!!!" in the sketch, which some people report is a problem.

I'm using OSX 10.9 mavericks, and Arduino IDE 1.0.5.

Seems like my fast way of getting more RAM for my program is doomed - maybe i should go with I2C chips instead :expressionless:

Hope somebody have something to share :smiley:

Best, pakken!

Just after writing this post I got it working?

I'm not sure completely what happened, because it ended up being the same setup as my starting point. Anyways I'll just explain what I did:

Went to boards.txt and changed the "mega2560.upload.protocol=wiring" to "mega2560.upload.protocol=arduino" (because I saw that was the case in the UNO - try and win)

The board didn't upload, but now with a different message - the usual one when it's not connected or busy.

Then I went into the boards.txt and changed it back...

Binary sketch size: 31,732 bytes (of a 258,048 byte maximum)

Period.

Maybe you have the same problem as me. Inspect the HEX file in the TEMP folder and look for 212121 or 2121

http://forum.arduino.cc//index.php?topic=196897

I have the same issue and this happen everytime your sketch is greater than 30.000bytes.
It's pretty sure a bug of the bootloader stk500v2.

Is there anywhere an updated version of the bootloader?!?
Please fix this bug as soon as possible.

Dimensione del file binario dello sketch: 30.030 bytes (su un massimo di 258.048 bytes)
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

If I comment or cut a few lines of code just to drop below 30.000 bytes, the upload gives not more problems! :wink:

This number is not random: probably this happens because the bootloader for Mega2560 was derived from that one for Arduino Uno that has the limit of 32kB of Flash (compared to 256kB instead of Arduino Mega now unfortunately NOT USABLE!)