Arduino Forum

Using Arduino => Installation & Troubleshooting => Topic started by: pkrakow on Dec 14, 2011, 07:32 am

Title: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: pkrakow on Dec 14, 2011, 07:32 am
I recently started prototyping a new system with a Mega 2560.  This is my 4th arduino system, and my 1st one using a Mega.

I have a simple program that I have successfully loaded on the Mega (it toggles some digital pins and sends some serial messages).  Something's changed, and now I can't upload new images to the board.  When I try to upload, I get the following error messages:


------------------------------------------------------------------------------------------------
Binary sketch size: 4560 bytes (of a 258048 byte maximum)
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_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_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_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_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_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_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x10
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

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_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_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_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_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_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x11
avrdude: stk500v2_disable(): failed to leave programming mode
------------------------------------------------------------------------------------------------

I'm trying to track down the source of the problem.  Here's what I know:

1) The Green "on" light is on when the board is powered up.
2) The "L" light flashes when I power up the board (indicating that the bootloader is present).
3) The code that I loaded on the board still runs (I can see the digital pins toggling).
4) I have the arduino IDE pointing to the correct COM port and setup for the Mega board
5) I have tried two different PCs
6) I have disconnected all of the external circuits that were attached to the Mega

Does anyone have any debug ideas?  I have a scope, so I can capture an image of the serial lines during upload if that would help.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: johnwasser on Dec 14, 2011, 04:02 pm
When you try to upload a sketch do the Receive and/or Transmit lights on the Arduino blink?  If not you may not be getting serial communication.  Try a loopback test (connect D0 to D1 and see if stuff you type in Serial Monitor comes back as it should).
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: pkrakow on Dec 15, 2011, 04:14 am
The RX light flashes once when I try to upload or send a message for loop-back testing.  When I have a jumper between TX0 and RX0 and send a message through the serial monitor, I don't see any loop-back results and I don't see the TX light flash.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: pkrakow on Dec 18, 2011, 06:29 am
I figured out what's causing the problem.  The TX signal isn't making it to the ATMEGA8U2-MU that translates serial to USB.  The TX pin on the ATMEGA2560-16AU is working, and signals from that pin make it all the way to the ATMEGA2560-16AU side of the RN4A resistor next to the ATMEGA8U2-MU, but the signal doesn't make it to the ATMEGA8U2-MU side of the resistor.  It looks like the ATMEGA8U2-MU is messing up the signal.

Anyone else had problems with the ATMEGA8U2-MU?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: smeezekitty on Dec 18, 2011, 10:28 pm
Either the resistor is bad (unlikely), the 8U2 is bad (very bad) or the firmware is corrupt.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: massivesound on Dec 23, 2011, 09:34 pm
I'm having the exact same problem.  I wrote and updated code for a day, then moved the arduino to another computer, and I get the same errors.  The original code still executes, I just can't upload new code to the board.  Is there a way to reinstall the firmware?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: johnwasser on Dec 24, 2011, 04:04 am
Google "Arduino DFU":

http://arduino.cc/en/Hacking/DFUProgramming8U2
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: massivesound on Dec 24, 2011, 04:27 pm
I fixed the problem I was having by getting the newest build of the Arduino software and reinstalling the driver from the Arduino folder.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: michael635 on Dec 26, 2011, 03:46 am
I have the same issue with the Mega2560R3 board.

I have WinXP SP3 on a ThinkPad T-40.  I have tried on a different machine with the same errors.

I tried the 'press the reset button' just after hitting the upload.  Four tries and Blink finally uploaded.

Blink is running, but I wanted t play and changed the timing pause statements, but have not been able to upload.

I have tried the other ISP with no result.

My Com port shows Arduino Mega 2560 R3 (COM6) and the driver is usbser.sys Microsoft Corp 5.1.2600.5512(xpsp.080413-2108)

USB\VID_2341&PID_0042\64934333135351418100

I have selected the correct board and compost, and have used the AVRISP mkII

The RX light blinks once in a while.

Thoughts to help me get this running?



Ideas
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: michael635 on Dec 26, 2011, 04:29 am
Also, the loop-back test worked fine.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: michael635 on Dec 26, 2011, 02:19 pm
I have continued to troubleshoot, using any information from the forums.

It appears that I can upload more reliably if I press the reset just as soon as I can after the Binary Sketch Size message appears.

This seems kludgey, but at least I can upload.

I see posts about auto reset, etc.  should (in a perfect world) this be working with an auto reset?

Thanks
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: michael635 on Dec 26, 2011, 08:25 pm
HMM, it gets weirder and weirder.   

I down loaded arduino-0023, made no changes to the port or hardware or preferences file and it works perfectly.

So, I renamed the avr directory in  ...\arduino-1.0\hardware\tools and then copied the avr directory from ...\arduino-0023\hardware\tools directory into the ...\arduino-1.0\hardware\tools directory, and it works fine.

Conclusion, the issue is with the new version of avrdude.


Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: phear_sc on Dec 31, 2011, 01:05 pm
The timeout error is a known issue.

Google it.

Anyone have a verified and working fix? I've had my Arduino for about 4 hours and just got hit with this (and I'm not using any !!! in my code, which was allegedly the cause of the issue). This has been going on for months now and I gotta be honest - I'm pretty frustrated that the (presumably bootloader) issue still seems to be unfixed.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: jklz67 on Jan 17, 2012, 03:47 am
Thanks for the help.  I have been struggling with this same problem and it seems many have as well.  I downloaded the arduino 0023 software and I got the same results as you, so I copied and renamed as you suggested and the problem is fixed.  So far so good.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: aefields on Jan 17, 2012, 05:27 am
I was having this problem too.  Luckily I hadn't erased my old 0022 program.  Going back to that fixed the problem.  I really ought to remember: "Never update a program that works!"
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: jessejay356 on Jan 19, 2012, 07:54 am
A lot of people seem to be having problems with the new version, including me.  *sigh*  Hopefully they figure it out..
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: jessejay356 on Jan 19, 2012, 05:26 pm
Guys.   I used the avrdude.exe and avrdude.conf file from 022 and it worked fine for me.  There seems to be a bug in avrdude 5.11 that is causing some of these issues. 
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: jessejay356 on Jan 20, 2012, 04:49 am
I believe I have found a fix.  But I had to compile an new avrdude.exe.  Here is a patch for avrdude-5.11.1/stk500v2.c

73c73
< #define SERIAL_TIMEOUT 2
---
> #define SERIAL_TIMEOUT 5
76c76
< #define RETRIES 5
---
> #define RETRIES 33
1317a1318,1325
>
>   printf("trying this reset stuff now..\n");
>   usleep(50*1000);
>
>   serial_set_dtr_rts(&pgm->fd, 1);
>   usleep(50*1000);
>   serial_set_dtr_rts(&pgm->fd, 0);
>   usleep(50*1000);

Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: ahmadzein on Jan 20, 2012, 10:59 pm
where did you find this file ?? do i just add these?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: jessejay356 on Jan 27, 2012, 09:13 am
AVRDUDE 5.11.1 can be found at http://download.savannah.gnu.org/releases/avrdude/

I provided a patch that can be applied to the file I mentioned.  But you need to apply the patch and recompile avrdude for it to work.   But my upload success rate went from 40% to 100%.   The code now matches more closely the way the old version worked.  It's a pain.  The arduino people should recognize there is a problem, and fix it.

JesseJay
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Scott216 on Mar 23, 2012, 04:36 am
I have the same problem.  I have a new Mega R3.  I tried both Arduino 0022 and 1.0 on my Mac OSX 10.6.8.  Sometime my sketch will upload fine, but most of the time it times out.  Doing some Google searches, I found this seems to be a known problem, but I'm not sure how to fix it.  I've seen some talk about avrdude, but I don't know anything about fixing, compiling and uploading a boot loader.  Since this problem seems to be kind of old and my hardware and software are new, I'm surprised this problem still exists.  What should I do?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Mubase on Mar 23, 2012, 12:29 pm
Moi aussi. But I can upload with Parallels PC emulator running Windows XP on my MAC but not my actual MAC.


Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: deajan on Apr 12, 2012, 01:16 pm
Having tested alot with this problem, i found this:

Whenever i have string in my sketch which has threee marksigns in a string (eg: "!!!"), my sketch will make the Mega2560 timeout when uploading ("huh?..bootloader>" hex code message followed after multiple retries by avrdude: stk500v2_ReceiveMessage(): timeout ).
Using Windows 2008 R2 Server (think Win7 64 will do the same), Arduino IDE 1.0 & Arduino Mega2560 compatible.

Here's a sample sketch to reproduce the error:
Code: [Select]

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

void loop()
{
 Serial.println("!!!");
}



Hopefully this will help.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Lauszus on Apr 14, 2012, 03:52 am
#deajan
Thanks, that solved the problem for me.
I'm running Mac OS X 10.7.3, Arduino IDE 1.0 & Arduino Mega ADK r1.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: AndersDejenfelt on Apr 14, 2012, 04:54 pm
Thanks to Michael635 for showing that replacing the AVR directory from rev-0023 solves the problem. It solved mine!
Anders
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: bibre on Apr 15, 2012, 01:38 am
@aefields

Quote
I was having this problem too.  Luckily I hadn't erased my old 0022 program.  Going back to that fixed the problem.  I really ought to remember: "Never update a program that works!"

Very true! ;)

I had the same problem and just fixed it by doing that exactly. Now, it works fine. Thank you! 8)

I also renamed all of my sketches from *.ino to *.pde.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: fredrickojackson on Apr 17, 2012, 04:05 am
would anybody care to speculate why I am unable to upload a sketch which produces an object of approximately 36k when I can upload an object of 34k? I have been working with windows XP and arduino 1.0 for several weeks now and today my the object grew to just over 36k. Now I cannot upload it. I can upload the program when I'm using Linux with arduino-1.0 (downloaded from the git repository over 2 months ago) but none of the windows boxes will upload it. We are using Windows XP and Windows 2003 server with no luck... HELP!? please.
Thanks
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: johnwasser on Apr 17, 2012, 07:18 pm
It would really help if you said what the error was rather than the vague phrase "unable to upload".

Did you add a string that contains three or more '!' in a row?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: fredrickojackson on Apr 17, 2012, 09:47 pm
sorry for not being more explicit. The upload just hangs, no error messages, no output, it just never finishes. If I use my Debian Linux machine, it works fine. If I reduce the size of the sketch, it works fine. But my sketch of 36742 bytes wont upload. As I watch the lights on the Mega, it looks curiously as if the Mega is being reset right in the middle of the upload.
THANKS FOR ANY HELP!
Fred
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: johnpilgrim on Apr 27, 2012, 11:13 pm
Is there a solution to these sketch upload timeout errors yet?
My older Mega works fine, as do all my other FTDI based 'duinos, but the Mega R3 is useless to me right now. Meh!
Arduino 1.0 on MacOS 10.6.8
Maybe dumb question: is the Mega R3 programmable with a FTDI USB cable?
John
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: chuatc on May 05, 2012, 03:58 am
I was having the same issue.

But end up I realized that I have place the reset switch A_RST_M at the wrong position.
Correcting the switch position and my Arduino is now working well.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: DROBNJAK on Jun 04, 2012, 09:18 pm
I just joined in to say that I have this same problem. This ruined at least three weekends for me. Instead of working on new projects, I am banging my head into the wall, trying everything to resolve this.

I have Mega 2560, R2l, on Win XP SP3. It constantly either hangs with timeout, or sometimes it tells me that COM port is taken by another application. I always either get timeout or port locked by other applicaiton.

So many Mega 2560 owners are having problems with this, that developers should definitely check this one out.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: xvjeko on Jun 15, 2012, 06:09 pm

I just joined in to say that I have this same problem. This ruined at least three weekends for me. Instead of working on new projects, I am banging my head into the wall, trying everything to resolve this.

I have Mega 2560, R2l, on Win XP SP3. It constantly either hangs with timeout, or sometimes it tells me that COM port is taken by another application. I always either get timeout or port locked by other applicaiton.

So many Mega 2560 owners are having problems with this, that developers should definitely check this one out.


I tottaly agree. But I can't expect support because my sparkfun mega isn't "official"...
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: mellis on Jun 17, 2012, 02:00 am
For those of you having trouble, can you try changing "stk500v2" to "wiring" for the Mega 2560 in your boards.txt file (in the hardware/arduino sub-directory of your Arduino application directory)?  That should tell avrdude to do an auto-reset of the board before the upload (in addition to the one done by the IDE itself), which might help.

See: http://code.google.com/p/arduino/issues/detail?id=806 (http://code.google.com/p/arduino/issues/detail?id=806) for more information and updates.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Josephiah on Jun 17, 2012, 06:13 pm
Just wanted to add my voice to the chorus on this issue.  I'm using a Mega 2560 R2 with Arduino 1.0.1 running on Mac OSX 10.6.8.  Changing "stk500v2" to "wiring" has made no discernible difference.

As a few users on this thread and others have found, it has been a sudden behaviour change where I can't think of anything I've changed...

EDIT:  to add a couple more details:
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: xvjeko on Jun 17, 2012, 06:17 pm

Just wanted to add my voice to the chorus on this issue.  I'm using a Mega 2560 R2 with Arduino 1.0.1 running on Mac OSX 10.6.8.  Changing "stk500v2" to "wiring" has made no discernible difference.

As a few users on this thread and others have found, it has been a sudden behaviour change where I can't think of anything I've changed...

+1
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: mellis on Jun 17, 2012, 07:41 pm
It sounds like there may be different things going on here, since some of you are seeing different symptoms / behaviors. 

Josephiah and DROBNJAK, can you post the verbose output of an upload attempt?  Have you tried a different USB cable?  Are you going through a USB hub (if so, try connecting the board straight to the computer)?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: xvjeko on Jun 17, 2012, 09:21 pm
if it helps, it doesn't work for me neither.
Tried 2 pc-s and 2 cables. It all worked before (sometimes i didnt saw progress bar so i had to reconnect mega and it worked)
but now i am stuck at 95% progress bar, and smtimes my L is on for the whole time, and sometimes not... cheers
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Josephiah on Jun 17, 2012, 11:16 pm

Josephiah and DROBNJAK, can you post the verbose output of an upload attempt?  Have you tried a different USB cable?  Are you going through a USB hub (if so, try connecting the board straight to the computer)?


Hi Mellis, thanks for your help.  Changing USB cable doesn't seem to make a difference, and it's plugged into the same USB port on my mac as it always has been.  The results also appear to be the same whether I have the mega on its own with nothing else plugged in, or with a shield attached (I'm currently using it for a monome-like project).

Sometimes I get this:

Code: [Select]
Binary sketch size: 1,624 bytes (of a 258,048 byte maximum)
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cwiring -P/dev/tty.usbmodem-chr-001 -b115200 -D -Uflash:w:/var/folders/Vd/VdFeGvFZG4Gc-qfuGxx6pE+++TI/-Tmp-/build893675159181048838.tmp/Blink.cpp.hex:i

avrdude: Version 5.11, compiled on Sep  2 2011 at 18:52:52
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2009 Joerg Wunsch

        System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
        User configuration file is "/Users/Jo/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : /dev/tty.usbmodem-chr-001
        Using Programmer              : wiring
        Overriding Baud Rate          : 115200
avrdude: wiring_open(): releasing DTR/RTS
avrdude: wiring_open(): asserting DTR/RTS
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv: . [1b]
avrdude: Recv: . [0e]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv: . [1b]
avrdude: Recv: . [0e]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv: . [1b]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: Recv: . [1b]
avrdude: Recv: . [0e]
avrdude: Recv: . [01]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

avrdude done.  Thank you.

Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Josephiah on Jun 17, 2012, 11:16 pm
And sometimes this:

Code: [Select]
Binary sketch size: 1,624 bytes (of a 258,048 byte maximum)
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cwiring -P/dev/tty.usbmodem-chr-001 -b115200 -D -Uflash:w:/var/folders/Vd/VdFeGvFZG4Gc-qfuGxx6pE+++TI/-Tmp-/build893675159181048838.tmp/Blink.cpp.hex:i

avrdude: Version 5.11, compiled on Sep  2 2011 at 18:52:52
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2009 Joerg Wunsch

        System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
        User configuration file is "/Users/Jo/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : /dev/tty.usbmodem-chr-001
        Using Programmer              : wiring
        Overriding Baud Rate          : 115200
avrdude: wiring_open(): releasing DTR/RTS
avrdude: wiring_open(): asserting DTR/RTS
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv: . [1b]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [0b]
avrdude: Recv: . [0e]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [08]
avrdude: Recv: A [41]
avrdude: Recv: V [56]
avrdude: Recv: R [52]
avrdude: Recv: I [49]
avrdude: Recv: S [53]
avrdude: Recv: P [50]
avrdude: Recv: _ [5f]
avrdude: Recv: 2 [32]
avrdude: Recv: t [74]
avrdude: stk500v2_getsync(): found AVRISP programmer
        AVR Part                      : ATMEGA2560
        Chip Erase delay              : 9000 us
        PAGEL                         : PD7
        BS2                           : PA0
        RESET disposition             : dedicated
        RETRY pulse                   : SCK
        serial program mode           : yes
        parallel program mode         : yes
        Timeout                       : 200
        StabDelay                     : 100
        CmdexeDelay                   : 25
        SyncLoops                     : 32
        ByteDelay                     : 0
        PollIndex                     : 3
        PollValue                     : 0x53
        Memory Detail                 :

                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

        Programmer Type : Wiring
        Description     : Wiring
        Programmer Model: AVRISP
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86]
avrdude: Recv: . [1b]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [02] . [00] . [01] . [0e] . [01] . [17]
avrdude: ser_recv(): read error: Device not configured


(that last line from me unplugging the board.)

Cheers,
Jo
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: dieselboris on Jun 18, 2012, 01:34 pm

Anyone have a verified and working fix? I've had my Arduino for about 4 hours and just got hit with this (and I'm not using any !!! in my code, which was allegedly the cause of the issue). This has been going on for months now and I gotta be honest - I'm pretty frustrated that the (presumably bootloader) issue still seems to be unfixed.


I did put a string containing "!!!!!!!!" in my code. Deleted it but no luck, same timeout error. Uploaded the Blink example (think this resetted the memory or something) and uploaded my original code again and it works again.

weird? or not?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Maarten12 on Jun 18, 2012, 04:59 pm
I am having the same problem when trying to upload my program. Every time I try to upload it says 'time out' or 'time out communicating with programmer'. I have been reading through all the advices you guys gave, but I'm not that experienced with adjusting the code of the Arduino software, so I have no idea what to do.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: aleffe on Jun 18, 2012, 08:48 pm
I have to report my findings with Arduino Mega 2560. I struggled hours with these
"avrdude: stk500v2_ReceiveMessage(): timeout", "avrdude: ser_recv(): read error: Device not configured"
error messages that started haunt me just when I was adding some new data to my program.

First I though that I had too much data (although I had only 18Kb). Removing the new data solved the issue. Then I started to look deeper in to the issue. Finally I managed to track this down to very weird root cause:

When ever a sequence of "0x21, 0x21, 0x21" is added to PROGMEM and this variable is referenced like:
const unsigned char bug[3] PROGMEM = {0x21,0x21,0x21};
pgm_read_byte(&bug[0]);
Uploading fails!!

If I change one of those 0x21s to something else, everything works like a charm again. This has to be some sequence that causes Arduino somehow to get stuck... Just unbelievable but true.

My setup is:
Arduino 1.0.1
Arduino Mega 2560 (ok it is from DE...)
AVRISP mkII (same happens with AVR ISP)
Mac OS 10.6.8

So if you have weird upload problems, just check your code for this sequence...
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Maarten12 on Jun 18, 2012, 08:51 pm
I am using Mac OS 10.6.8 too, but where can I change the program of the arduino software? On my windows pc I can find the boards.txt file, but in my mac I can't find it and I don't know how to change it.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Louis Davis on Jun 18, 2012, 11:08 pm
aleffe,
This is a known issue and is being addressed in a future 2560 bootloader. See here for details:
http://code.google.com/p/arduino/issues/detail?id=392 (http://code.google.com/p/arduino/issues/detail?id=392)
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: mellis on Jun 19, 2012, 09:47 pm
Josephiah: it looks like the communication is flakey for some reason, maybe the power is cutting in and out (or there's a short appearing and disappearing).  Is it possible the board was damaged somehow (either physically or with too much current / voltage)?  Do you see the same behavior with nothing connected to the board?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Josephiah on Jun 20, 2012, 10:37 pm
Hi Mellis, thanks for your reply.

You're right about the communication - doing the loop-back test gives intermittent results, giving back some characters typed in, but by no means all.  Certainly no visible damage, and I'm not aware of having done anything which might have zapped the wrong pin (though I guess anything's possible!)

Do you have any other suggestions for things I can try, or is it time to buy another Mega?  Seems a shame given that the rest of the board appears to be functioning okay.

Cheers,
Jo

(Another possible symptom:  with just the board plugged in on its own, the TX light is now staying lit solidly except for when trying to load something, which is a bit weird.  In normal operation of my setup I expect TX to flicker in response to inputs on A0-A7, and otherwise to remain off.  Grounding the analog inputs makes TX go off.  So there's some kind of unwanted interaction happening in there somewhere.  *Sigh*)
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: paravion on Jun 27, 2012, 09:59 am
I receive this same error, but only if I plug an Ethernet shield onto my Mega 2560.

Ie. if I just test out the basic blink example, it uploads and works correctly. If I then unplug the device, add on the Ethernet shield, plug back in, and attempt to upload the same blink sketch, I receive this avrdude errors.

I'm new to Arduino... Are these issues in any way related to everyone else's?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: xvjeko on Jul 20, 2012, 07:32 pm
Any news about this topic or we are just spent 30 € on a official arduino not working boards ?!
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: chrishjones on Jul 20, 2012, 08:57 pm
I had this problem with a custom 2560 based 8u2 board I have. I was going through a USB hub. Connected directly to the USB port and the problem resolved itself. Doesn't apply to everyone, but definitely try it.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: raxz on Jul 21, 2012, 11:14 pm
I have the same problem. Uploading a program via USB gives me timeout error on Mega2560.
I found one workaround for this.
When I burn bootloader with ISP programmer, I can upload sketch via USB only 1 time. When uploading second time, I get timeout. Then I take my ISP programmer and burn Mega2560 new bootloader. Then I can upload sketch once again.
Fu**ing annoying.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: smeezekitty on Jul 22, 2012, 04:04 am


(Another possible symptom:  with just the board plugged in on its own, the TX light is now staying lit solidly except for when trying to load something, which is a bit weird.  In normal operation of my setup I expect TX to flicker in response to inputs on A0-A7, and otherwise to remain off.  Grounding the analog inputs makes TX go off.  So there's some kind of unwanted interaction happening in there somewhere.  *Sigh*)

Unpredictable results are normal when reading from floating pins.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Shields_Arduino on Jul 22, 2012, 04:06 am
Same problem, here. Went to a friend's place and successfully demoed the Uno and then tried the Mega. Nothing. The L13 led flashed slowly around once a second but never saw the TX or RX lights flash. Tried repeatedly and double checked the COM port.

We purchased the Mega R3 from RS components for $60 recently and it appears genuine with the white screen printing on the back.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: xvjeko on Jul 22, 2012, 06:50 pm

Same problem, here. Went to a friend's place and successfully demoed the Uno and then tried the Mega. Nothing. The L13 led flashed slowly around once a second but never saw the TX or RX lights flash. Tried repeatedly and double checked the COM port.

We purchased the Mega R3 from RS components for $60 recently and it appears genuine with the white screen printing on the back.


I think that the developers think we have cheap copies...
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: xvjeko on Jul 23, 2012, 01:37 pm
After a couple hours of trying to "brick" my board by uploading and disconnecting when uploading, disconnecting the board randomly, or just flashing it bunch of times i couldn't "brick" it again. Then i took my board and i was sending some data using putty (while TX connected to RX). Then i looked on the led pins TX and RX and they both flashed together. It was a sign that my board was ok.
Next step was to tuch the components. I first touched the mega2560 chip softly. My tx pin stopped flashing ! but the RX was still flashing. It was a sign that something shorted out... Then i tried to use the FIX that i mentioned above, and the board unbricked. Next step was to throw the board on a table from 2-3 cm height.. The board again bricked, and i was able to fix it again using the FIX i mentined.... That leaves me to think that something on our mega2560-s is making a short when under pressure... I will give it a closer inspection as soon i get the magnifier.  :smiley-eek:

SUMMARY: If your board "bricks" when putting a pressure on it, only your serial communication will be faulty, but you will still be able to use the program flashed on the board itself. I am looking if someone can confirm what i've found out...
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Shields_Arduino on Jul 23, 2012, 01:56 pm
I forgot to mention that we also tried the boards.txt fix - changing the protocol to wiring and this did not help. We even restarted the Arduino IDE several time with the wiring protocol line but still no action.

xvjeko - this is very interesting and we are all waiting for David Mellis to throw some light on this. What you have described sounds like one of two things - bad soldering or incorrect fuses in either the 2560 or the USB chip. Since all the boards were tested at the factory, something must have happened since. Bad soldering can cause this -talking about intermittent open circuits caused by a poor solder mix or not enough paste. Remember that solder paste must always be kept in a fridge when not being used. The other option of having fuses not set correctly can also cause intermittent operation - such as the brown out enable not turned on. A third scenario is faulty Atmel chips which is a small possibility -luckily Atmel is very open about Erratas do these can be easily checked.

Anyway, sounds like a lot of Arduino users have the same problem, so a workaround would be nice.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: raxz on Jul 24, 2012, 07:15 pm
Problem with Mega2560 is huge. There are very many people with the same problem. Is there any official opinion yet?
I'd really like to use my Mega2560 normally.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: automagp68 on Aug 30, 2012, 05:22 am

Problem with Mega2560 is huge. There are very many people with the same problem. Is there any official opinion yet?
I'd really like to use my Mega2560 normally.


Awesome, im so glad i got rid of my uno for a mega!

Way to go Arduino, now i cant do anything.

Same issue here. same on mac/ubuntu/and win 7

I was warned not to get a mega and now i see why
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: xvjeko on Sep 14, 2012, 11:40 pm


Problem with Mega2560 is huge. There are very many people with the same problem. Is there any official opinion yet?
I'd really like to use my Mega2560 normally.


Awesome, im so glad i got rid of my uno for a mega!

Way to go Arduino, now i cant do anything.

Same issue here. same on mac/ubuntu/and win 7

I was warned not to get a mega and now i see why

sad
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Shields_Arduino on Sep 16, 2012, 03:37 am
OK, picked up the Mega2560 from my friend last night, and tested it out on the Lenovo Win7 32bit desktop and HP Win7 64bit laptop, and it works fine on both. The only variation from the Uno is the driver takes a long time to load (2-3 minutes - OK maybe not that long in the big scheme) and opening the serial monitor takes a while to reset the Mega - maybe 5 seconds. The Mega works well on our LED and LCD shield and takes only slightly longer to load.

So the issue looks like a Dell issue. Maybe if anyone has a dead Mega2560, please report the make, model, operating system, and any other details which are show when you right click on My Computer and select Properties.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: xvjeko on Oct 17, 2012, 08:58 pm

OK, picked up the Mega2560 from my friend last night, and tested it out on the Lenovo Win7 32bit desktop and HP Win7 64bit laptop, and it works fine on both. The only variation from the Uno is the driver takes a long time to load (2-3 minutes - OK maybe not that long in the big scheme) and opening the serial monitor takes a while to reset the Mega - maybe 5 seconds. The Mega works well on our LED and LCD shield and takes only slightly longer to load.

So the issue looks like a Dell issue. Maybe if anyone has a dead Mega2560, please report the make, model, operating system, and any other details which are show when you right click on My Computer and select Properties.


i tossed my mega into junk (i only scalvaged some connectors...), if i will ever need a high end dev. platform, i will go for psoc, mbed, el.imp, chipkit or raspberry...  ]:D ]:D ]:D
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: shibbs on Nov 06, 2012, 01:55 am
Hey All,
   I had a similar issue when I was trying to use an Uno as a boot loader, and I think the trick is that the chip is getting reset part way into the upload. The reasons this seems plausible are :
A - someone mentioned it looked like his board had reset
B - after a half-assed attempt at uploading, my board just starts up the old code (i.e. looks like it reset)
C - It seems correlated to length of code, and I have no issue uploading the blink code, ever.
   Anywho, the hardware solution to this software problem is to toss a BFC (10uF or so, I used an electrolytic) between the Reset pin and ground. What this does is it stops the device from getting reset by little transients that I believe are associated with the serial printing stuff.
   Hope this works for Y'all, in the end I got it working with Arduino 023 and a 49K program.

EDIT: This worked great briefly but now it has gone back to it's old ways of not working.
   -Shibbs
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: xvjeko on Nov 06, 2012, 11:20 pm

Hey All,
   I had a similar issue when I was trying to use an Uno as a boot loader, and I think the trick is that the chip is getting reset part way into the upload. The reasons this seems plausible are :
A - someone mentioned it looked like his board had reset
B - after a half-assed attempt at uploading, my board just starts up the old code (i.e. looks like it reset)
C - It seems correlated to length of code, and I have no issue uploading the blink code, ever.
   Anywho, the hardware solution to this software problem is to toss a BFC (10uF or so, I used an electrolytic) between the Reset pin and ground. What this does is it stops the device from getting reset by little transients that I believe are associated with the serial printing stuff.
   Hope this works for Y'all, in the end I got it working with Arduino 023 and a 49K program.

EDIT: This worked great briefly but now it has gone back to it's old ways of not working.
   -Shibbs


Salvage usable components and throw the rest away...
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: DigitalJohnson on Nov 15, 2012, 06:04 pm
I'm having the same problem as Ragnar. Burn a new bootloader, upload one sketch. Then can't upload again (just hangs). Burn bootloader, upload one sketch... Has anyone found the problem or a fix. I'm using Mega2560 R1 and IDE1.0.2 on Windows 7 x64.

DJ
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Gentoo-Thomas on Mar 18, 2013, 09:31 pm
In reply to http://arduino.cc/forum/index.php/topic,83079.msg659993.html#msg659993 (http://arduino.cc/forum/index.php/topic,83079.msg659993.html#msg659993)

For the software patch of avrdude (stk500v2.c, patch for gentoo attached) it is necessary to take/leave the protocol "stk500v2" to take effect of patched program.

Wise versa for the protocol "wiring" got to work it is necessary to connect the "RESET-EN" pads on the board.


Good luck, Thomas
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: irisiobhan on Mar 24, 2013, 09:24 pm
I had this error, the solution was simple. from the tools menu, select the correct serial port. If that doesn't work, try putting the usb into the same port you used during installation of the arduino software. ;)
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: edugodoy on Apr 13, 2013, 07:58 pm
I've got this issue today after change my sketch to print three exclamation characters in sequence to the serial port:

Code: [Select]

Serial.println("!!!");


I'm using Mega 256 with a Ethernet shield however this happens in any sketch, even Blink.ino.
It looks like to me that this is a kind of reserved word for the compiler or for the firmware.
Anyways I've just removed one exclamation character and it is working fine now.
Title: Re: Upload Timeout Error on Mega 2560 - 1.0.5
Post by: sigi on Jun 01, 2013, 05:57 pm
Hey thanks for the hint!
Running exactly into the same mess with MEGA, Arduino 1.0.5 on OSX..
Did some prints with "!!!" too.

B.T.W: I ported some code snippets from a LEONARDO, there it runs flawlessly.....
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: raacampbell on Jul 18, 2013, 05:37 pm

I've got this issue today after change my sketch to print three exclamation characters in sequence to the serial port:

Code: [Select]

Serial.println("!!!");


I'm using Mega 256 with a Ethernet shield however this happens in any sketch, even Blink.ino.
It looks like to me that this is a kind of reserved word for the compiler or for the firmware.
Anyways I've just removed one exclamation character and it is working fine now.



Yes! Me too! I had a println with some text that ended with three exclamation marks. Since attempting to upload that I have lost the ability to upload to the board. It just times out. I have removed the exclamation marks but it still wasn't working. I then unplugged the Mega, removed it's external power (I'm using a USB shield). Then tried to upload. It worked again. Weird. But at least problem is solved.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Kbezanson on Dec 14, 2013, 10:54 pm
Mac OSx FIX!!!!

ok so I was really pissed off with this whole thing so I just started messing around with the menus and clicking things.

From what I can remember...

1. Open a random example sketch
2.  Toggle the the Input Library to "Wire" if you havent already by going to the sketch drop down menu
3.  Toggle the board from Uno and then toggle it back to Mega (not sure why or if it helps,  just do it)
4. Toggle the usb port (I just picked something random)
5. *Toggle the Programmer from AVRISP mkII to AVRISP
6. Upload the new sketch and it should run.

My original program that it was stuck on was a basic analog read of a potentiometer voltage and to switch on an LED for greater than 400 threshold then displaying the threshold on Serial Display. Initially it worked fine...then I started to update the code with more statements. I attempted to upload my new version of code and thats when it happened..timeout. SO I'm not sure if that process will work for you guys but it seemed to clear my old code and reset the MEGA and is working fine so far...yet i havent tried any complicated code yet
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: bad_crc on Dec 31, 2013, 06:41 am

For what it's worth I've struggled with this issue on my R3 mega 2560 for about a day earlier in the week.  My problems was using the RX0 ( digital pin 0 on the board ) as part of my circuit when other pins could have easily been used.  This was ( I believe ) interfering with the serial communication w/ the host that occurs during programming.  I've since moved the function I had tied to that pin to another output and have had no issues since.

It may seem obvious but it wasn't at the time :)   Hope this helps.

thanks
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: 1studio1 on Jan 29, 2014, 10:44 pm
Same problem here as well.
avrdude: stk500v2_ReceiveMessage(): timeout

I can't work out what fix actually worked from the pages of this post, but it seems odd so many of us are have the same issue and for so long. After the compile I notice that the Rx/Tx light periodically blink so think it is, as some have said a hardware coms issue with the board not responding back on the USB port.

IDE 1.0.5 (reinstalled fresh copy - made no difference) running on Windows Seven - this started about a week ago and before then everything worked every time. I would also point out that it is holding the USB com port open even when disconnecting the mega and does it with no other items (shields in place) connected. and no changes to the sketch that used to upload apart from a spelling mistake. (Statues to Status on LCD output when shield is connected)

All very strange. 
Steve
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: rodolf0 on Jan 31, 2014, 02:34 am
Hey I got the same problem, I tried to load different codes and some of them made it,

but by now I get to upload a code, but then this message appears, even though load is complete:

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

Don't have any idea of how to fix it, please help
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: namell91 on Mar 04, 2014, 07:21 pm
Make sure you don't have another device hooked up on the TX0/RX0 pins (e.g. UART or Serial bridge).  I had the hang up until I disconnected the serial bridge each time I programmed, then everything seemed to be okay.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: gregoriogallery on Mar 17, 2014, 02:57 pm
Hi folks, for what it's worth, I don't get the message on the first load after powerup. On the second load I get this message.  When I power/down - power/up, no message.  Even with the message the blink example works.  Pete gregorio
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: KostasF on Mar 20, 2014, 09:51 pm
Hello everyone i am new member at this open mind and open source community i use SainSmart (atmega2560) for my thesis about a field controller .....
I have the same error !!!( I took 3 days of my life )

1) I try to dfu-program my atmega16u2 ( 8 bit Avr controller ) witch Arduino Mega and i think also Uno R3 use for USB but nothing

2) I follow this schema  for  making an AVR ISP to re-burn bootloader  but also nothing for my upload ,i take timeout.error()
https://scontent-b-cdg.xx.fbcdn.net/hphotos-frc3/t1.0-9/1947727_10203357193275789_1149508726_n.jpg

3) The only solution is to reborn my old AMD 3200+ and use the Parallel Port for boot-loader , install Linux Mint  over this PC ( Mate better for it's 512mb ram ) follow this instructions
http://arduino.cc/en/Hacking/ParallelProgrammer#.UytVHXWSxBt
open Arduino IDE as Super User select my board and parallel port as programmer and after 2 minutes voila new boot-loader over my Atmega ....
Re plugin and everything work's great
A pc with SainSmart photo
https://scontent-a-cdg.xx.fbcdn.net/hphotos-prn2/t31.0-8/1979906_10203379149664685_2038118978_o.jpg

PS:
1) i know my problem is the boot-loader because of a segmentation fault error from my Java Desktop Application  for  my controller
2)In this solution of Parallel Programmer you have to use an external power of your Arduino ( over the AC or over USB )
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: wittgenstein on Mar 27, 2014, 12:18 pm
I doubt this is much help, but:
My sketch was uploading just fine and then suddenly started timing out. I removed the 3.3v jumper lead to my accelerometer and it started working fine again. I have read that someone else solved the problem by removing the 5v jumper. I don't know what would cause that. I've examined my soldering for short circuits etc., but it all looks OK to me.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: kishigo on Apr 16, 2014, 10:34 pm
Maybe this will help.
I was having this exact same problem of timing out.  It was consistent and interminable and irritating.
Here is what I did to fix it.
Change from using the USB to power the 2650 to a separate power supply.  I noticed in the documentation for the Arduino's there is a comment that if you use the USB +5V and the power is not clean or varies, the board will be unstable.  On a hunch, I went and dug out a 12V 3.3A separate power supply and connected it.  The timeout issue immediately disappeared.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: kishigo on Apr 16, 2014, 10:45 pm
Well, maybe power supply won't help.  Now it's back to timeout.  Strange.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: kishigo on Apr 16, 2014, 11:06 pm
Once again working reliably.  On my linux PC, it seems to matter that the USB is on USB bus 1.  I used the lsusb command to figure out which usb bus the cable was on.  I've seen weirdness with usb ports before.  The ones on the back seem to behave better.
A friend of mine who is a hw wizard explains that the usb ports on the back of the pc usually are more reliable because they are directly off the board while the ones in front require internal wiring to the motherboard.
Title: Re: problemas con el atmega 16u2 en Mega 2560
Post by: gatoet601 on May 10, 2014, 08:27 pm
hola soy de peru
tengo el problema de que cuando trato de cargar un programa desde la plataforma de programacion se demora en cargar y luego sale este mensaje:
Binary sketch size: 4560 bytes (of a 258048 byte maximum)
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout

bueno tengo windows 8 como sistema operativo sospecho que este bloqueo de alguna forma el arduino mega 2560 R3
¿como puedo solucionar este problema? help (agradesco des ya vuestra respuesta).
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: ioanbsu on May 15, 2014, 02:01 am
Here is what happens to me.
I have several computers and I have timeout only on my mac book pro latest generation.
On my hp with win 8 seems the upload process goes correctly.

Any idea why it may not work on mac only and work on win 8?

p.s. I don't remember I installed any drivers on win8 at all, which kin-da weird to me.... i think I read somewhere drivers installation is required.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: ioanbsu on May 15, 2014, 03:05 am
Ok, solution that was posted here worked for me:
http://forum.arduino.cc/index.php?topic=198539.0
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: whitesmoker on May 15, 2014, 09:16 am
Hello !

I solved a problem so.
1. It is necessary to press the RESET button on Arduino and to hold it.
2. To press -> in the program and after completion of compilation to release the button.
Loading happens without problems.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: tonysnark on Sep 02, 2014, 11:00 pm
After reading this thread I found my own solution to this problem!

I was using a USB hub on my display to upload to my Arduino Mega. I tried to plug it directly into the front USB bus on my computer, and it worked!

no idea why...
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: anvoice on Sep 21, 2014, 11:07 pm
Hello,

I started having this issue too all of a sudden with my rather new atmega 2560: it worked flawlessly for about a month, then this.

Edit: I successfully flashed the bootloader. Visibly, a difference is that now the orange "L" LED blinks instead of staying lit. However, the timeout error still persists and I can't upload a single sketch... Any ideas? Ready to climb a wall here.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Maheshchiramure on Oct 28, 2014, 07:36 pm
I am using "Arduino Mega 2560" and am also facing the same problem. Post "#10" works for me "sometimes" but still isn't the "Proper" solution. Post "#11" is not working for me at all. Isn't there a scientific solution to deal with this problem ?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: nickgammon on Oct 28, 2014, 11:13 pm
@Maheshchiramur: Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Stick to : http://forum.arduino.cc/index.php?topic=275448.0 (http://forum.arduino.cc/index.php?topic=275448.0)

Don't just piggy-back your question onto the end of lots of other threads.

- Moderator
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: schuimpge on Nov 18, 2014, 08:27 am
Time-Out problem here also..

Name is Luc, first post here..

Noticed that once connected, my AtMege2560 has no problem with the first Sketch Upload.
But the second one starts  giving problems.

After trying a couple of times, I've found that  unplugging the USB-cable (power from iMac USB port) allows me to upload a sketch without any problem.
So for now, just unplug USB-cable before I upload....

Hope this benefits some more people.

Regards,
Luc
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: mrmaniacal on Nov 18, 2014, 03:43 pm
tonysnark's answer worked for me, looks like the USB hub wasn't providing clean enough power, plugging directly into the computer fixed the issue.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: flyeye on Jan 10, 2015, 03:18 pm
I have with the same problem with Mega2560. I have 3 pieces. Suddenly, I`ve got the same:
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout

on 2 of them.
As it was the the problem was in '!!!' in the scketch!

The problem exists about 3 years already and still have not fixed.

Interesting that is appears on 2 of 3 my Mega 24560. The boards are same, was bought during last few monthes.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: asincos on Jan 15, 2015, 12:21 am
I have the same problem. In my case it only occurs in GNU/Linux, whereas in Windows everything works fine. It also worked fine before in GNU/Linux. I don't know why this suddenly started to happen.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: virtual1 on Jan 17, 2015, 10:57 pm
Lucky me!  I'm working on a fairly large project (9 peripherals) and my megas have started succcumbing to this bug.   I'm an experienced programmer, and a bit manic about incremental backups, so I usually test frequently and zip my source every time I get something else working.

Last night it started.  avrdude: stk500v2_ReceiveMessage(): timeout    after adding some code.  I noticed that after the failed upload, the mega was double-flashing at me.  I suspect that means "corrupt program, upload it again".  Trying the upload again, I notice the process looks normal for the first 1/2 of the time, the usual blinks, followed by the steady fast flashing of the upload.  But then led13 just STOPS flashing.  And a few sec later I get that error.

Unfortunately, when I try to upload again.. upload ANYTHING, it fails in the same manner.  Looks to work for the first 1/2 of the time, then fails.  On any short sketch I pull up, it doesn't matter.

I have to pull the USB cable from the mega for a sec to power cycle it.  Plugging it back in again, it's back to doubletapping LED13, but I can upload to it again.  Any other sketch is fine.  But then I try to upload my big project again, and it's back to doubletapping LED13.

One of the sketches I was testing with at this point dumps a ton of hardware information as well as a bit of EEPROM, and I noticed this at the start of this mega's EEPROM.  I don't know if it put it there when it got stuck, or if I just never wrote anything to EEPROM on this mega before. (I have quite a few here)  Usually EEPROMs come from the factory as all FF's.

Code: [Select]

Flash Dump $100 bytes from $0 to $FF
$0000:  41 72 64 75 69 6E 6F 20  65 78 70 6C 6F 72 65 72  20 73 74 6B 35 30 30 56  32 20 62 79 20 4D 4C 53    Arduino explorer stk500V2 by MLS
$0020:  00 42 6F 6F 74 6C 6F 61  64 65 72 3E 00 48 75 68  3F 00 43 6F 6D 70 69 6C  65 64 20 6F 6E 20 20 3D    .Bootloader>.Huh?.Compiled on  =
$0040:  20 00 43 50 55 20 54 79  70 65 20 20 20 20 20 3D  20 00 5F 5F 41 56 52 5F  41 52 43 48 5F 5F 20 3D     .CPU Type     = .__AVR_ARCH__ =
$0060:  20 00 41 56 52 20 4C 69  62 43 20 56 65 72 20 3D  20 00 47 43 43 20 56 65  72 73 69 6F 6E 20 20 3D     .AVR LibC Ver = .GCC Version  =
$0080:  20 00 43 50 55 20 73 69  67 6E 61 74 75 72 65 3D  20 00 4C 6F 77 20 66 75  73 65 20 20 20 20 20 3D     .CPU signature= .Low fuse     =
$00A0:  20 00 48 69 67 68 20 66  75 73 65 20 20 20 20 3D  20 00 45 78 74 20 66 75  73 65 20 20 20 20 20 3D     .High fuse    = .Ext fuse     =
$00C0:  20 00 4C 6F 63 6B 20 66  75 73 65 20 20 20 20 3D  20 00 53 65 70 20 20 39  20 32 30 31 30 00 31 2E     .Lock fuse    = .Sep  9 2010.1.
$00E0:  36 2E 37 00 34 2E 33 2E  33 00 56 23 20 20 20 41  44 44 52 20 20 20 6F 70  20 63 6F 64 65 20 20 20    6.7.4.3.3.V#   ADDR   op code  


A bit of googling shows people using "!!!" have been having this problem for the past several years.  If the version infomation in that EEPROM is accurate, I probably should get my bootloader updated.  I've never done that before.  I did find several places that dance around the issue, and one or two that actually provide a bit of a walkthrough on the process.  I'd like to know how long that process takes.  I recall at least once in the past someone saying buring a bootloader on an arduino can take an hour or more.  I have a number of them to update.  I'd rather a workaround for the time being.

Anyway back to my problem.  Since I had only changed a very small focused bit of code and figured something had to be wrong with it, I started trimming back.  I found that changing the ORDER of a few Serial.print commands fixed it.  This took me quite awhile to find, even though I had a small area to look through.  Anyone that's been through the process of whittling down a sketch to find a hard lock bug knows how this goes.  Slow.  Having to physically unplug the arduino ever time?  even MORE slow.

More googling.  "Remove !!! from your serial prints!"   Ok.  That's nice.  But I don't HAVE any of that.  More googling.  OK here's the HEX file.  Checked it.  I cannot find any occurrance of "!!!".  I was hoping to be able to identify a bad HEX file before uploading it.  All this plugging and unplugging of USB cables is getting hard on my gear while I troubleshoot.  I'd like to know if a HEX file is bad beforehand.  Earlier in the thread someone said there were different symptoms showing.  I'd agree this does look like a class of problems rather than one specific bug.  My lack of !!! in my code suggests I have a variation on the problem.

I assume that something else I am doing in the programming is causing "!!!" or its ilk to be generated in the sketch and causing the upload to be interrupted, or perhaps the verification step that I believe occurs after the upload.  But I can't find $21 21 21 anywhere in my HEX file.

This bug is repeatable on three bare mega2560s

Does anyone have any new information on this problem?  I was able to "hack" my way around the bug last night, but it's come up again today and I have a much wider front to search this time.  I guess all I can do is get out the knife and start carving until I narrow down the cause, or more specifically, find a place I can make any change to the code to shift whatever it is into some other form that doesn't confuse the bootloader.

little bit of an update:  the last one I got around by changing a Serial.println("") to Serial.println()
THIS time I commented out Serial.print("M"); and it uploads now.   So terribly frustrating having computers using $RANDOM to figure out if they're going to work today.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Heider on Jan 28, 2015, 09:09 pm
Hi All,

After some testing here is what I found (or at least what I am experiencing)... and what I did to resolve this...

You would get the (Timeout) error when there is a condition in your code that causes the loop() function not to finish (the loop goes into a loop from within) and not come back to the main control, where the serial is waiting.

Inside my loop() function , if I tell the function to either:

1) (do... while()...) and this does not come out, or,
2) There a serial device is causing the loop() to re-read back on itself i.e. indefinitely calling itself back, then:

The loop() function will not come out, and you would get this error.

Try to disable all your code from the loop() function, upload, you should not see the error (should work), try then to un-remark chunks of the your until you get to the culprit bit.

I hope this helps.

Kind Regards
Heider Sati
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: ARDMega2560 on Mar 10, 2015, 09:47 am
Hi everybody, I'm Spanish, my English isn't very good but I will try to explain my problem.

My Arduino Mega 2560 doesn't work fine because that:

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout

I try with 4 PC (Linux and Windows), with 2 wires and with 2 Arduino Mega 2560

I did all I see in this forum, and impossible, always the same "timeout" I can't do more that I see and I don't want to buy other Arduino again because i have two and bouth doesn't work

Help me, please!
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: nickgammon on Mar 10, 2015, 08:39 pm
Quote
I'd like to know how long that process takes.  I recall at least once in the past someone saying buring a bootloader on an arduino can take an hour or more.  I have a number of them to update.  I'd rather a workaround for the time being.
If you have a spare Uno or Mega lying around, and a few hookup wires, you can reprogram the bootloader in a second or two.

http://www.gammon.com.au/bootloader (http://www.gammon.com.au/bootloader)

My timing there is one second for the Uno, three seconds for the Mega.

Having said that, I have been having problems with my Mega recently, particularly on Ubuntu, for reasons that are not obvious.

Quote
I try with 4 PC (Linux and Windows), with 2 wires and with 2 Arduino Mega 2560
What sketch are you uploading? Can you post it please? Inside code tags.

Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: nickgammon on Mar 11, 2015, 01:10 am
Having said that, I have been having problems with my Mega recently, particularly on Ubuntu, for reasons that are not obvious.
It seems my Mega had old firmware on the Atmega8U2 (USB) chip. I replaced that - with considerable effort - and it seems to work better now.

See: http://arduino.cc/en/Hacking/DFUProgramming8U2 (http://arduino.cc/en/Hacking/DFUProgramming8U2)
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: ARDMega2560 on Mar 23, 2015, 02:07 pm
I'm uploading Blink but I tried with personal sketch:

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}






AND THAT IS THE RESULT:

Tamaño binario del Sketch: 1.542 bytes (de un máximo de 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
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_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_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_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_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x13
avrdude: stk500v2_paged_write: write command failed
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: ChilliTronix on Mar 23, 2015, 11:49 pm
Could I suggest that you read the troubleshooting thread at the top of the forum and then if you still have issues post a new thread?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Terakon on Apr 04, 2015, 02:04 am
Hi,

I am totaly arduino newbie with some mega2560 boardclone and the same issue "avrdude: stk500v2_ReceiveMessage(): timeout". when try upload sketch (IDE 1.6.3) via USB-com port (CH340g onboard)

I have USBasp programmer too, but upload via programmer get stuck mega with both power- and L- led on. (ide write no error mesage - upload is done)  Reset doesnot help.

I found one solid way how to upload new sketch.

1. Connect USBasp and write bootloader (every time befor upload new sketch).
2. Disconect USBasp and connect USB from PC (Win7) to board. (edit - USBasp can stay connected)
3. Upload sketch (IDE 1.6.3) via USB/(com port)

Sketch is runing - so USBasp programmer and board is fine (echo test is ok too).

I have no idea why it works this way, can anybody explain?  Still looking for more elegant solution for uploading sketch.

(Sorry for my english - have a nice day)
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: perkinsb1024 on Apr 10, 2015, 03:50 am
This can also be caused by user error, if you select ATmega2560 when your board is actually an ATmega1280, as was the case for me.  :-[
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Terakon on Apr 10, 2015, 09:47 am
ATMEGA2560 16AU 0731 is printed on chip - can it be 1280 ?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: nickgammon on Apr 10, 2015, 11:27 am
ATMEGA2560 16AU 0731 is printed on chip - can it be 1280 ?
Where did you buy it? Is 1280 laser-printed onto the chip, and 2560 written on top in crayon?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: proto-pic on Apr 10, 2015, 12:20 pm
He He - Nick been buying on eBay again. . . .  :smiley-lol:
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Terakon on Apr 10, 2015, 02:40 pm


Where did you buy it? Is 1280 laser-printed onto the chip, and 2560 written on top in crayon?
its from ebay - i know and write its clone - print on chip looks like this one
http://www.tinyosshop.com/image/cache/data/component/Microcontroller/MEGA2560-1-600x600.jpg

Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: camilozk on May 16, 2015, 01:32 pm
I am having the same problem with my mega 2560

It says:

-----------------------------------------------------------------------------------------------------------
Arduino: 1.6.4 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Sketch uses 6,916 bytes (2%) of program storage space. Maximum is 253,952 bytes.

Global variables use 468 bytes (5%) of dynamic memory, leaving 7,724 bytes for local variables. Maximum is 8,192 bytes.

avrdude: ser_open(): can't open device "\\.\COM8": Access is denied.
avrdude: ser_drain(): read error: The handle is invalid.

Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
-----------------------------------------------------------------------------------------------------------

or it remains uploading forever...


I checked the firmware info and I have rev 0001. Arduino website says that there is no need to update the firmware if you have rev 0001.

I also replaced the avr folder of my IDE 1.6.4 with the avr folder of 0023. Also nothing...


I am out of ideas!
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: fhpa on Jun 23, 2015, 12:50 am
Hi everybody,

i often had the same problem: ...timeout...

By chance I found in one of my programs a line where I can switch the error on or off...

I show you a small part of my program. (The whole program has more than 2000 lines)

Please look to the comment-lines:

void parameter_holen(){
  Serial.println(server);
  if (client.connect(server,80)){ // Verbindung zum Server aufbauen
    Serial.println("Parameter vom Server holen...");
    http_request("parameter");
    parameter_auslesen();
  }else{

    // If i uncomment the following line, i can't upload the program due to the timeout-error
   
    //Serial.println("Parameter holen: Keine Serververbindung gefunden...");

    resetFunc();
  } 
}


I think the timeout-error has also to be seen in combination with the rest of the program.

For me it is a very strange behavior of the IDE.

Good luck for all of you seeing the timeout error!
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: davidutn on Jun 29, 2015, 07:55 pm
A mi me pasaba igual y no sabia la razón... la cosa era que en alguna parte del código tenia una línea de este tipo...

      Serial.println("ENVIAR LLAMADA DE EMERGENCIA...!!!");

"LA SOLUCIÓN" fue quitar los símbolos de exclamación y listo...

      Serial.println("ENVIAR LLAMADA DE EMERGENCIA..");

PRUEBEN ESTO Y ESPERO LES HAYA AYUDADO EN SOLUCIONAR SU PROBLEMA.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: tg1929 on Aug 07, 2015, 01:22 pm
I had the same problem with my Ethermega 2560. I could not upload under windows 8.1. I also tested on Linux and had the same problem.
I remembered the last change I made to the working board was to break the RST-EN link which prevents the board resetting when the serial link is established. This was causing unwanted resets in my application.
I reconnected the link and my sketches now upload correctly.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: eleff on Sep 23, 2015, 08:16 pm
Does anyone know how to test if the 8U2 is the culprit?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: ardn00bo on Oct 26, 2015, 12:53 am
I have the same issue as Ragnar.

Ragnar did you solve this?

Nick Gammon,

Setup
------
OS = Mac El Capitan 10.11 + CH341 driver for Mega 2560 clone
Arduino IDE = 1.6.6 10/14/15 4:07 build
ISP = SparkFun Redboard
Mega 2650 = Chinese Clone 16AU 1446*
Bootloader Sketches = http://www.gammon.com.au/bootloader

Steps
------
1. Prepare RedSpark Redboard as an ISP to program a Mega 2560 Chinese clone
2. Run Nick Gammon's Atmega Board Programmer (Github 10/22/15 pull) to program bootloader onto 2560. I downloaded the GitHub code on 0ct 22, 2015.
3. Arduino IDE upload sketch to the 2560 ONCE.   Sketch runs on board.

In order re-upload a sketch without a time out, I must run 1-3 again. It's independent of the contents of the sketch (it can be the default empty setup() loop() routines).

This is painful.

Is something getting clobbered in the bootloader (ie lock bits) when the sketch is uploaded?

What info can I provide to help debug this?

Related
---------
See following:
[Topic: Bootloader only works once? ] http://forum.arduino.cc/index.php?topic=49277.0

Message #17

Gene Buckle Says

-U lock:w:3F:m to the avrdude command line before the flash write and
-U lock:w:0F:m to the avrdude command line after the flash write cures the problem.


Other
------
* Reading other posts - this may also affect official Arduino Mega 2560's, but I can get my official board serial port to be detected under Mac OS 10.11 El Capitan. See [Topic: El Capitan - Arduino IDE serial port problems] https://forum.arduino.cc/index.php?topic=351999.15
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: nickgammon on Oct 26, 2015, 09:08 pm
Quote
In order re-upload a sketch without a time out, I must run 1-3 again. It's independent of the contents of the sketch (it can be the default empty setup() loop() routines).
Optiboot on the 328 does not alter the lock bits at all, as I discovered. Possibly the Mega bootloader does, I haven't looked at the source of it. If it does it would (probably) be doing what is in the boards.txt file. Judging by my copy in IDE 1.6.5 it would look like this:

Code: [Select]
mega.bootloader.tool=avrdude
mega.bootloader.low_fuses=0xFF
mega.bootloader.unlock_bits=0x3F
mega.bootloader.lock_bits=0x0F


I think we need to confirm whether or not the lock bits are being changed. Use my board programmer (which you already know how to use) to observe the lock bits (without changing anything) immediately after reprogramming the bootloader.

Then upload a sketch. Then find what the new lock bits are. Please post this information here (copy and paste). You should see something like this:

Code: [Select]
Atmega chip programmer.
Written by Nick Gammon.
Version 1.35
Compiled on Oct 27 2015 at 07:04:41 with Arduino IDE 10605.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x98 0x01
Processor = ATmega2560
Flash memory size = 262144 bytes.
LFuse = 0xFF
HFuse = 0xD8
EFuse = 0xFD
Lock byte = 0xEF
Clock calibration = 0x5D
Bootloader address = 0x3E000
Bootloader length = 7474 bytes.


Now you can disconnect without programming (if you want). In the middle there is the lock byte (0xEF in my case). Or just verify:

Code: [Select]
Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...  V
Verifying ...
No errors found.
Done.
Programming mode off.
Type 'C' when ready to continue with another chip ...


Using that bootloader I have been using my Mega repeatedly yesterday. No problems at all.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: ardn00bo on Oct 28, 2015, 05:16 am
Hi Nick,

I want to try what you suggest, however, after many times of uploading the boot loader with a redboard , and switching power to the mega to upload a sketch, I introduce an issue.

Now the mega 2560 does't show any serial output (the USB serial driver is detected by my mac), and your board programmer says


Atmega chip programmer.
Written by Nick Gammon.
Version 1.35
Compiled on Oct 25 2015 at 15:55:45 with Arduino IDE 10606.
Attempting to enter ICSP programming mode ......................................................
Failed to enter programming mode. Double-check wiring!
Type 'C' when ready to continue with another chip ...


Despite the wiring to be the same.

What can I do to troubleshoot? MCU killed?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: shooking on Nov 03, 2015, 08:51 pm
Hi Nick

Firstly, thanks for your bootloader program for 2560. Not sure on rules for posting other URLs - so I wont.

I replied on another post - in my case I have a cheap Chinese 340g / 2560 system. Essentially, most folks come to this conclusion:

1 - flash your bootloader (http://www.gammon.com.au/forum/?id=11635)
2 - load any sketch - only once
3 - attempt to anything else results in sync timeout ... goto 1.

My suspicion was the bootloader we being overwritten. At first I thought I had proved this with the aid of your verification code

take original board -> verify bootloader -> FAIL
attempt to load sketch -> FAIL
Use 1280 to upload your bootloader -> verify bootloader -> works
attempt to load sketch -> WORKS!

But then verify bootloader -> OK ??? So why you not load?

If I go back to my 1,2,3 sequence I can get to step 2.

That is - maybe the bootloader isn't being overwritten.

On other posts folks complain about DTR line (?) - they need to add a 100uF cap to it to help drop voltage? Apparently if one does not have the official design, the pseudo clones are not resetting properly, and so one cannot get them into sync.

I am hoping to trial this idea - once I can workout where to make the mod on my boards.

My guess is the 1,2,3 sequence would have to somehow avoid some other DTR related issue - but how.

Anyhow, really appreciate your bootloader and other excellent articles you publish on the net.

 
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: giantkiller on Nov 03, 2015, 09:02 pm
Back the truck up here.
You stated 'Not Sure What Changed'
As of when?
The current layers of computer OS, Java version, and IDE are at fault.
I will fore tell that you will see alot of mysteries pop up amongst users that are working on code at this versioning window.

The 2 camps are users that have 3d printers already working and those that are pushing code.
The code group is going to show alot of different errors in the coming days. They are the ones working with in their platform layer that needs compiles, uploading and run test. This layer is most susceptible to a lot of changes across the internal layers I mentioned previously.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: 18turbo on Nov 11, 2015, 09:56 am
Yo lo he solucionado cambiando el cable USB, así de simple.

Tenía uno de impresora -que era bastante largo-. Cambié el cable USB por otro que tenía -un poco más corto- y ¡voilà!

Ahora me vuelve a funcionar todo bien.

Yo no sé si será una solución real, pero a mí me funcionó y vuelvo a tener mi clon de Arduino Mega funcionando.

Quería postearlo por si a alguien puede servirle.



--- ENGLISH -----

I had the same problem. After reading very much and not solution...


... change the USB cable...


.... and WORKS FINE!!!!!!!!!!!


I don't know why, but now my chinese Arduino Mega works...
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: jmanatee on Nov 16, 2015, 11:55 pm
--- ENGLISH -----

I had the same problem. After reading very much and not solution...


... change the USB cable...


.... and WORKS FINE!!!!!!!!!!!


I don't know why, but now my chinese Arduino Mega works...

Worked for me too
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: sundberg84 on Dec 13, 2015, 05:30 pm
Hi!

I have the same issue, tried Win7 and WinXP computer, different usb cables but same result:

1 - flash your bootloader (http://www.gammon.com.au/forum/?id=11635)
2 - load any sketch - only once
3 - attempt to anything else results in sync timeout ... goto 1.

Did anyone came to a sollution with this problem?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: dataino on Dec 16, 2015, 05:44 pm
Me to the same problem !!!


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:

And a the end   REMOVE ->>>> "!!!"



ERROR NO UPLOAD
Code: [Select]
Serial.print( F("[ !!! NOT FINDED !!!]") );

GOOD UPLOAD
Code: [Select]
Serial.print( F("[ NOT FINDED ]") );
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: nickgammon on Dec 16, 2015, 09:58 pm
http://www.gammon.com.au/tips#trap27 (http://www.gammon.com.au/tips#trap27)
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: dataino on Dec 18, 2015, 02:29 am
I'll try to update the bootloader if it is not too complicated
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: nickgammon on Dec 18, 2015, 03:16 am
http://www.gammon.com.au/bootloader (http://www.gammon.com.au/bootloader)
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: riccardop on Dec 27, 2015, 11:47 pm
Hi guys!
I had the same problem with a mega256
In my code i wrote a function to send via udp packet a string containing "!!!" and all stopped working.
Removing !!! from the string i fixed the problem!
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: DaveJJ on Jan 02, 2016, 11:35 am
Thanks for the rescue.  I too have been having this problem after a small edit to the program and assumed it was related to the watchdog functions I was using.  However, I had added a literal string printing to the serial post ending with !!!.  Removal of the exclamation marks solved the problem.

It's a bit bizarre but I always thought that, aside from escape characters, the contents of a literal string were basically ignored.

Thnx again.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: mkulikow on Jan 06, 2016, 03:39 pm
I think I have a completely bricked Mega...

Loopback passes...

DFU programmed just in case...

Cannot use Arduino as ISP using an UNO

Cannot use Nick Gammon board identified or programmer, error is "Cannot enter programming mode"...

Trying to use avrdude manually using the fuses in this thread as well as the bootloader from the Arduino install, nothing...

Time to throw it out?


c:\Program Files (x86)\Arduino\hardware\tools\avr\bin>avrdude -p atmega2560 -c stk500 -P com12 -e -Ulock:w:0xEF:m -Uefuse:w:0xFD:m -Uhfuse:w:0xd8:m -Ulfuse:w:0xff:m -U flash:w:stk500boot_v2_mega2560.hex -C ../etc/avrdude.conf
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: 3alexander3 on Feb 28, 2016, 03:04 pm
Guys!

It's been 5 years and this problem is still actual.
I'm zero in programming, so I use maxuino to do my projects!
Was just trying to upload the standard firmata on my arduino atmega 2560.
The usual mistake:
avrdude: stk500v2_ReceiveMessage(): timeout   
keeps coming out.

I read the whole thread and tried to do anything I had a decent understanding about: like installing different firmware (0023 ecc).

But the mistake stays.

I see here really experienced people.
Is there anybody, that could help me on this one?

Thank you a lot!!

Alexander
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: yampilop on Mar 18, 2016, 01:18 am
I had the same problem, and searching I found that:
https://stackoverflow.com/questions/19645441/avrdude-stk500v2-receivemessage-timeout/29135050#29135050?newreg=0314d331f90e4d158569f0b63cd75695 (https://stackoverflow.com/questions/19645441/avrdude-stk500v2-receivemessage-timeout/29135050#29135050?newreg=0314d331f90e4d158569f0b63cd75695)

In one comment it says:
Quote
Another possible reason for this error for the Mega 2560 is if your code has three exclamation marks in a row. Perhaps in a recently added string.

3 bang marks in a row causes the Mega 2560 bootloader to go into Monitor mode from which it can not finish programming.

"!!!" <--- breaks Mega 2560 bootloader.

To fix, unplug the Arduino USB to reset the COM port and then recompile with only two exclamation points or with spaces between or whatever. Then reconnect the Arduino and program as usual.

Yes, this bit me yesterday and today I tracked down the culprit. Here is a link with more information: http://forum.arduino.cc/index.php?topic=132595.0
So in my code were strings with "!!!". I deleted them and now the program uploads with no problems.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: naten_baptista on May 08, 2016, 01:32 pm
I am experiencing this with a UNO board.
Serial Comm is working fine to the UNO.
Upload to another MEGA board is fine so i assume its not my PC thats a problem.
But upload to the UNO board gives me this timeout problem.
Could it be possible that the boards programmer itself is faulty?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: wileec on May 22, 2016, 04:10 am

I noticed that some of you had a similar scenario that I experienced where it seemed like no posted solution online helped the problem. I managed to unbrick the mega 2560 by a few steps and two sources that I will provide credit to.

I followed Nick Gammon's guide to flashing both the ATmega 2560 and the 16u2 chips using an Uno through the arduino IDE. Follow his instructions here:

http://www.gammon.com.au/bootloader
and the source codes are provided on his git page. His programmer can be saved into your sketchbooks

After flashing the 16u2, the USB will be unrecognizable. This is mentioned on Nick Gammon's section about the 16u2. As I was flashing off of Windows 8.1 I instead used Atmel Flip as my dfu programmer http://www.atmel.com/tools/FLIP.aspx.

 The "L" led on the mega should be flashing if you're in dfu mode. Disconnect the wires to the Uno if it is. Next I recommend following this youtube video on how to use Flip with the 16u2.

https://www.youtube.com/watch?v=fSXZMVdO5Sg

When selecting the hex file to load locate the arduino folder on your C drive (for windows) then go to /hardware/arduino/avr/firmwares/atmegaxxu2/arduino-usbserial and select the Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex file.

Before I did this I flashed the combined file and turns out the address was out of range.

Unplug and plug in the mega after and a new com port should appear in your device manager/IDE
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: niranjan_t on Jun 14, 2016, 09:47 am
hello guys...

i started my own arduino for my project..

after the assembly of entire board, i successfully uploaded the firmware to both atmega16u2 using atmel's FLIP software and atmega2560 as guide from gammon's forum http://www.gammon.com.au/bootloader...

when i tried to upload blink code to my board it shows timout error...


Sketch uses 1,554 bytes (0%) of program storage space. Maximum is 253,952 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 8,183 bytes for local variables. Maximum is 8,192 bytes.
C:\Program Files\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM16 -b115200 -D -Uflash:w:C:\DOCUME~1\Krishna\LOCALS~1\Temp\build08e4957f02c018eb579e11ddc64f9701.tmp/Blink.ino.hex:i

avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM16
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
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 done.  Thank you.



can anyone help me in solving this problem weather it is hardware or software side
........

firmware for atmega16u2 is "arduino_dfuserial.hex"

Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: JoaoLopesF on Jul 02, 2016, 06:24 pm
Hi,

Thanks yampilop

I remove !!! and WORKS :)

Regards

Joao
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: takide on Jul 05, 2016, 04:55 pm
I was having the same issue for a couple days on a custom PCB with an ATMEGA2560 chip on it. After trying many different things, re-installing the FTDI drivers fixed the problem for me.

I think that when I started using those cheap Chinese Arduinos, the ones with the CH430 USB to serial converter IC, the drivers for the CH430 conflicted with the drivers for the FTDI chip. Also, upgrading my OS could have caused the FTDI drivers to stop working as well, though I am not sure.

I hope this works for you guys!
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: cristi_m on Sep 18, 2016, 04:26 am
In my case, the solution for "avrdude: stk500v2_ReceiveMessage(): timeout " error was to remove any connectors plugged in the digital pins 0 and 1 (I had an Arduino Mega 2560 shielded with RAMPS 1.4 and a servo connected to D1). These pins are reserved for Tx/Rx and having any device connected to them will mess the normal communication between PC and the board. I wish you good luck!
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: gopa_97 on Sep 27, 2016, 04:04 pm
If your RX ,TX of arduino is connected to any circuit,,uplaoding will be failed,,cause it needs RX,TX pin for uploading programme,so First remove the RX,TX connection,uplaod the code ,then connect again to your as usual circuit
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: vipinmishra on Sep 28, 2016, 01:05 pm
I recently started prototyping a new system with a Mega 2560.  This is my 4th arduino system, and my 1st one using a Mega.

I have a simple program that I have successfully loaded on the Mega (it toggles some digital pins and sends some serial messages).  Something's changed, and now I can't upload new images to the board.  When I try to upload, I get the following error messages:


------------------------------------------------------------------------------------------------
Binary sketch size: 4560 bytes (of a 258048 byte maximum)
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_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_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_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_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_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_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x10
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

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_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_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_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_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_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x11
avrdude: stk500v2_disable(): failed to leave programming mode
------------------------------------------------------------------------------------------------

I'm trying to track down the source of the problem.  Here's what I know:

1) The Green "on" light is on when the board is powered up.
2) The "L" light flashes when I power up the board (indicating that the bootloader is present).
3) The code that I loaded on the board still runs (I can see the digital pins toggling).
4) I have the arduino IDE pointing to the correct COM port and setup for the Mega board
5) I have tried two different PCs
6) I have disconnected all of the external circuits that were attached to the Mega

Does anyone have any debug ideas?  I have a scope, so I can capture an image of the serial lines during upload if that would help.
Hi,


I am also getting the same error but till now unable to fix it.I have arduino mega2560 board which is showing the same error as mentioned abobe.

I have tried the Resetting while compiling and tried to dump the arduino usb serial code also and tried even stk500boot_V2_mega2560.hex.


But it is showing in device manager for the Board detection but unable to dump the code.While dumping it is showing me the same error.


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 somebody please help regarding this it will be great as i have spend almost 1 week on this issue but still no success

Regards,
Vipin

Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: ThreeDMD on Oct 10, 2016, 11:13 pm
Hi,


I am also getting the same error but till now unable to fix it.I have arduino mega2560 board which is showing the same error as mentioned abobe.

I have tried the Resetting while compiling and tried to dump the arduino usb serial code also and tried even stk500boot_V2_mega2560.hex.


But it is showing in device manager for the Board detection but unable to dump the code.While dumping it is showing me the same error.


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 somebody please help regarding this it will be great as i have spend almost 1 week on this issue but still no success

Regards,
Vipin


I just started working on this similiar problem today and am trying to figure it out. Looking through this thread would be a good place to start.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: akatchi on Oct 16, 2016, 10:27 am
I'm experiencing the same issue with the timeout error for my Arduino Mega on a MacBook. And no it's not in the '!!!' because I don't have that. The Arduino Uno is still working but the Arduino Mega isn't. I'm looking for an answer for so long now! Please someone help :(!
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Elchickeno on Dec 01, 2016, 12:26 am
I am getting the same error when i try to upload something to my Arduino mega 2560 rev3 + EMW3162 WiFi Shield. When i disconnect the shield it works fine ? Did someone heave solution for this ?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: InfernoST on Dec 09, 2016, 04:50 pm
I had the same problem, and searching I found that:
https://stackoverflow.com/questions/19645441/avrdude-stk500v2-receivemessage-timeout/29135050#29135050?newreg=0314d331f90e4d158569f0b63cd75695 (https://stackoverflow.com/questions/19645441/avrdude-stk500v2-receivemessage-timeout/29135050#29135050?newreg=0314d331f90e4d158569f0b63cd75695)

In one comment it says:
So in my code were strings with "!!!". I deleted them and now the program uploads with no problems.
The above was exactly the problem in my Sketch, changed it as outlined and it downloaded just fine.

Thanks for the help
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: musicalsaw on Dec 21, 2016, 01:31 am
What worked for me...
I had this error time after time.
Finally, I unplugged one of the 3 devices I had plugged into the USB ports on my laptop and moved the Arduino USB cable to this vacant port.
Worked! - I have no idea whether this was coincidence or not.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: tommie93 on Dec 23, 2016, 04:20 pm
When i disconnect the shield it works fine ?
Hey Elchickeno,

I don't know, you tell me.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Elitism on Dec 29, 2016, 02:49 pm
I've been having this problem too

I figured out it was because of an (addhandler) within some code i wrote using visual studio, Since the system has absorbed the port handler and is constantly using it and didn't close, i resorted to closing down the process that was abusing the handler (GTAV) yes, I'm a game modder....

Anyway, If you have any programs that are auto booting from windows which take over the comport with handlers, you should close the process down, Reconnect the board after 5 seconds, It will work perfectl

(Not related to the problem above)
(just a tutorial on how to reflash the firmware on the sainsmart mega2560):
If you've burned another hex file to your sainsmart 2560 Make sure you have atmel flip to burn the bootloader of your specific chip, You will need to use Genuino-usbserial-atmega16u2-Mega2560-R3.hex if you're using a sainsmart 2560 (which is what i use) the firmware hex is inside the arduino firmware folders, Just do a search for it and you're good to go.

1. Short the two top most pins near the usb socket of your board to enter DFU
  + Before you can use atmel flip to flash the bootloader, you need to install the dfu drivers for your board
  - To do this follow these instructions
  - After entering DFU, go to device manager and update the drivers for your [libusb-win32 devices]
     + To do this look for the file usb in Flip 3.4.7 folder and click next, This will install the dfu driver
2. Select your chip AT90USB82
3. Open the port (USB CABLE BUTTON)
4. Click the red book with the arrow pointing towards it
5. Find Genuino-usbserial-atmega16u2-Mega2560-R3.hex
6. Press the reset button on the board (YOU MUST DO THIS)
7. click run
8. (WHEN THE PROCESS HAS FINISHED CLICK [start application]
9. RESET THE BOARD AGAIN WITH THE ON BOARD RESET SWITCH (YOU MUST DO THIS)
10. UNPLUG THE ARDUINO
11. REPLUG IT BACK IN

SUCCESS!
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: jascf on Apr 09, 2017, 05:54 pm
I was having this problem too in one of my 2 arduino mega boards and only with a program that is > 1000 lines of code.

The work around I found was to let the source coding uploading while grab a cup of coffe...

It seams that after some time, lets say 5 minutes, the code ends up uploaded.

I hope that this work around works for you too.

Thanks.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: ballscrewbob on Apr 10, 2017, 02:13 am
@ jascf

Problems like that tend to be associated with an antivirus program or similar.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: ASFALCAO on Jul 08, 2017, 06:24 pm
I have a Dell notebook with Windows 10 Pro 64 bits and Arduino 1.8.3.

When I upload a simple code (17 lines) the task finish successful, as seem below:


Arduino: 1.8.3 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
.......
Sketch uses 5970 bytes (2%) of program storage space. Maximum is 253952 bytes.
Global variables use 873 bytes (10%) of dynamic memory, leaving 7319 bytes for local variables. Maximum is 8192 bytes.
......
Writing | ################################################## | 100% 0.98s
......
Reading | ################################################## | 100% 0.77s
....
avrdude: verifying ...
avrdude: 5970 bytes of flash verified
avrdude done.  Thank you.

When I upload a medium size code (190 lines) the task get lot of time and finish unsuccessful:

Arduino: 1.8.3 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
........
Sketch uses 22130 bytes (8%) of program storage space. Maximum is 253952 bytes.
Global variables use 1564 bytes (19%) of dynamic memory, leaving 6628 bytes for local variables. Maximum is 8192 bytes.
.........
Writing | #################################################avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
......
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x13
avrdude: stk500v2_paged_write: write command failed
# | 100% 214.64s
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
An error occurred while uploading the sketch

May someone have a hint how cam I solve this issue?
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: MubarakAli on Oct 25, 2017, 08:37 pm
I had this problem and I solved it, Solution is so simple if you have another Arduino. I change the board from tool>board then programmed another Arduino, then I came again to my required mega Arduino and it worked.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: BaSingSe on Nov 10, 2017, 05:22 pm
Hello,

i had the same problem and i searched everywhere for a solution and couldn't find one.
I tried flashing different bootloaders to the Atmega2560 and different firmwares to the Atmega16u2 with no luck.

So i decided to do some measuring and found out that the resistor value of TX0 RX0 was about 170 Ohm and the Resistor Value of another working Arduino Mega2560 was about 0,9 Mega Ohm.

So i had the suspicion that the USART0 is dead and thought about using the USART1 instead.

For that i needed a to recompile the bootloader changing the USART0 to USART1, after that i flashed the Arduino Mega2560 with ISP Programmer using the ArduinoISP Sktech.

I attached the official Arduino Bootloader the the Atmega2560 with the only change of USART0 to USART1.

After that i removed the resistor array with the 4x 1K Ohm and replaced it with 4x single resitor
then soldered the 2x 1K Ohm for the LEDs back on the board.
The other 2x 1K Ohm only on the side of the Atmega16u2 and with cables to the TX1 RX1 pins of the Atmega2560.

Now i got my Arduino mega working and everything is fine besides the USART0 pins which i don't use so much and the Atmega2560 has 3 other USART communication ports.

You should keep in mind though to use the Serial1 function instead of Serial.

I hope i could help someone who has had the same problem.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: JosefN on Jan 31, 2018, 07:52 pm
I had the same problem.

avrdude: stk500v2_ReceiveMessage(): timeout

I spend a lot of time to solve the problem. Now i have a solution. I changed the usb-cable and it works. No timeout... no more problems.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: eskuvofoto on Mar 14, 2018, 04:45 pm
Thank you for your help and information.
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: Luke21206 on May 26, 2018, 02:24 am
I have had this same problem too and I can t figure out how to fix it!
Code: [Select]
#include <LiquidCrystal.h>
#include <Keypad.h>
int opt1 = '+';
int opt2 = '+';
int find = 0;
int answer = 0;
char num[3];
int clear = 0;
int currentlength = 0;
int optlength = 0;
byte divide [8]={
  0b00100,
  0b00100,
  0b00000,
  0b11111,
  0b11111,
  0b00000,
  0b00100,
  0b00100,
};
const byte ROWS = 4;
const byte COLS = 4;

char Keys[ROWS][COLS] = {
  {'1', '2', '3', '+'},
  {'4', '5', '6', '-'},
  {'7', '8', '9', 'x'},
  {'*', '0', '=', 1}
};

byte rowPins[ROWS] = {5, A5, A4, A2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {A1, A0, A3, A6};

Keypad keypad = Keypad(makeKeymap(Keys), rowPins, colPins, ROWS, COLS);

LiquidCrystal lcd(7,9,10,11,12,13); // the pins we use on the LCD
int P = 8;


void setup() {
digitalWrite(6, HIGH);
  pinMode(6, OUTPUT);
lcd.createChar(1, divide);
lcd.begin(16, 2);
lcd.print("Type an equation");
lcd.setCursor(0,1);
lcd.cursor();
  while(find==0){
 
  while((optlength == 0)&&(currentlength == 0)&&(find == 0)){
  char key = keypad.getKey();
 
    key == NO_KEY;
   
    if (key != NO_KEY){
      if ((key != '+')&&(key != '-')&&(key != 'x')&&(key != 1)&&(key != '=')){
     
      if(key == '*'){
        digitalWrite(6, LOW);
       
      }
       
      if (key != '*'){
      lcd.print(key);
      num[0] = key;
      currentlength++;   
      }

  }
    }
    }
  while((currentlength == 1)&&(optlength == 0)&&(find == 0)){
  char optkey = keypad.getKey();
  optkey == NO_KEY;
   if ((optkey != NO_KEY)&&(optlength == 0)&&(currentlength == 1)){
     if ((optkey == '+')||(optkey == '-')||(optkey == 'x')||
     (optkey == 1)||(optkey == '=')||(optkey == '*')){
       
       if(optkey == '*'){
       digitalWrite(6, LOW);
       }
       if(optkey == '='){
        lcd.print(optkey);
       
        find++;
       }
       
       if((optkey != '=')&&(optkey != '*')){
       lcd.print(optkey);
       opt1 = optkey;
       optlength++;
       }
     }
     }
  }
 
while((currentlength==1)&&(optlength==1)&&(find == 0)){
  char key2 = keypad.getKey();
 
    key2 == NO_KEY;
   
    if ((key2 != NO_KEY)&&(currentlength == 1)){
      if ((key2 != '+')&&(key2 != '-')&&(key2 != 'x')&&(key2 != 1)&&(key2 != '='))
      {
        if (key2 == '*'){
          digitalWrite(6, LOW);
        }
      if (key2 != '*'){
      lcd.print(key2);
      num[1] = key2;
      currentlength++;   
      }

  }
    }
    }
while((currentlength == 2)&&(optlength == 1)&&(find == 0)){
  char optkey2 = keypad.getKey();
  optkey2 == NO_KEY;
   if ((optkey2 != NO_KEY)&&(optlength == 1)&&(currentlength == 2)){
     if ((optkey2 == '+')||(optkey2 == '-')||(optkey2 == 'x')||(optkey2 == 1)||
     (optkey2 == '*')||(optkey2 == '=')){
    if(optkey2 == '*'){
       digitalWrite(6, LOW);
       }
       if(optkey2 == '='){
        lcd.print(optkey2);
        find++;
       }
       
       if((optkey2 != '=')&&(optkey2 != '*')){
       lcd.print(optkey2);
       opt2 = optkey2;
       optlength++;
       }
     }
     }
  }
    while((currentlength==2)&&(optlength==2)&&(find == 0)){
  char key3 = keypad.getKey();
 
    key3 == NO_KEY;
   
    if ((key3 != NO_KEY)&&(currentlength == 2)){
      if ((key3 != '+')&&(key3 != '-')&&(key3 != 'x')&&(key3 != 1)&&(key3 != '=')){
      if (key3 == '*'){
      digitalWrite(6, LOW);
      if (key3 != '*'){
      lcd.print(key3);
      num[2] = key3;
      currentlength++;   
      }

  }
    }
    }
    }
    while((currentlength==3)&&(optlength==2)&&(find == 0)){
      char findkey = keypad.getKey();
 
    findkey == NO_KEY;
   
    if(findkey != NO_KEY){
      if((findkey == '=')||(findkey == '*')){
        if (findkey == '*'){
          digitalWrite(6, LOW);
        }
        if(findkey == '='){
          find++;
        }
      }
     
    }
     
    }
}
}

void loop(){

}

 My arduino can upload different code, but not this one, so I can't figure out what the problem is
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: vscelwan on Jul 09, 2018, 04:41 am
If you have timeout issue pls ensure the crystal used on board is 16Mhz.

change
mega.menu.cpu.atmega2560.upload.protocol=wiring
To:
mega.menu.cpu.atmega2560.upload.protocol=stk500v2

I have this problem after change crystal value and change parameters above problem solve.

Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: joaoamaro on Jul 30, 2018, 11:45 am
I was having this issue with Arduino Uno. The fix is pretty embarrassing: Tools -> Board (change it to "Arduino/Genuino Uno").

For some reason I had Board  "Arduino/Genuino Mega or Mega 2560" defined  :smiley-roll:
Title: Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed
Post by: m4rten on Sep 10, 2018, 11:49 pm
Hi folks !!

i just added a 330µF capacitor to 5V and GND and after that it works fine !! also with 2 extension cables!

hope that helps others!

kind regards