Timeout error when i tried to upload a projetc IDE 1.8.3

Hi,

I tried to upload a project in Arduino Mega 2560 but I was unsucessful.

I have a Windows 10 Pro 64 bits notebook and a Linux Ubuntu 14.04 64 bits desktop.
Both has Arduino IDE 1.8.3.

When I uploaded few codes i was successful but medium size codes I was not.

I set "Preferences" to show compile and upload warnings and I copied the results below.
I cut no interesting lines/warnings.

Sucess :slight_smile:

@ Windows 10 Pro && Arduino 1.8.3

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.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM3 -b115200 -D -Uflash:w:C:\Users\ASFalcao\AppData\Local\Temp\arduino_build_307687/sketch_jul08a.ino.hex:i

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

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

Using Port : COM3
Using Programmer : wiring
Overriding Baud Rate : 115200
AVR Part : ATmega2560
....

Programmer Type : Wiring
Description : Wiring
Programmer Model: AVRISP
Hardware Version: 15
Firmware Version Master : 2.10
Vtarget : 0.0 V
SCK period : 0.1 us
....
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
....
avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\ASFalcao\AppData\Local\Temp\arduino_build_307687/sketch_jul08a.ino.hex"
avrdude: writing flash (5970 bytes):
....
Writing | ################################################## | 100% 0.98s
avrdude: 5970 bytes of flash written
avrdude: verifying flash memory against C:\Users\ASFalcao\AppData\Local\Temp\arduino_build_307687/sketch_jul08a.ino.hex:
....
avrdude: verifying ...
avrdude: 5970 bytes of flash verified
avrdude done. Thank you.

@ Ubuntu 14.04 && Arduino 1.8.3 64 bits

Sketch uses 11592 bytes (4%) of program storage space. Maximum is 253952 bytes.
Global variables use 1026 bytes (12%) of dynamic memory, leaving 7166 bytes for local variables. Maximum is 8192 bytes.
/home/afalcao/Downloads/arduino-1.8.3/hardware/tools/avr/bin/avrdude -C/home/afalcao/Downloads/arduino-1.8.3/hardware/tools/avr/etc/avrdude.conf -v -patmega2560 -cwiring -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/arduino_build_748469/ReadWrite.ino.hex:i
....
avrdude: Version 6.3, compiled on Jan 17 2017 at 11:00:16
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
....
System wide configuration file is "/home/afalcao/Downloads/arduino-1.8.3/hardware/tools/avr/etc/avrdude.conf"
An error occurred while uploading the sketch
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
....
Using Port : /dev/ttyACM0
Using Programmer : wiring
Overriding Baud Rate : 115200
AVR Part : ATmega2560
....
Programmer Type : Wiring
Description : Wiring
Programmer Model: AVRISP
....
avrdude: AVR device initialized and ready to accept instructions
....
Reading | ################################################## | 100% 0.01s
....
avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "/tmp/arduino_build_748469/ReadWrite.ino.hex"
avrdude: writing flash (11592 bytes):
....
Writing | ################################################## | 100% 1.88s

avrdude: 11592 bytes of flash written
avrdude: verifying flash memory against /tmp/arduino_build_748469/ReadWrite.ino.hex:
...
avrdude: 11592 bytes of flash verified
avrdude done. Thank you.

Unsuccessful :frowning:

@ Windows 10 Pro && Arduino 1.8.3

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.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM3 -b115200 -D -Uflash:w:C:\Users\ASFalcao\AppData\Local\Temp\arduino_build_572457/Heater-Monitor-v01.ino.hex:i
....
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM3
Using Programmer : wiring
Overriding Baud Rate : 115200
AVR Part : ATmega2560
....
Programmer Type : Wiring
Description : Wiring
Programmer Model: AVRISP
....
avrdude: AVR device initialized and ready to accept instructions
.....
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\ASFalcao\AppData\Local\Temp\arduino_build_572457/Heater-Monitor-v01.ino.hex"
avrdude: writing flash (22130 bytes):
....
Writing | #################################################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

| 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

@ Ubuntu 14.04 && Arduino 1.8.3 64 bits

There was the same error in a Linux desktop.

My you help me?

Does your code contain any strings with three exclamation points in it (eg, "!!!" )?

Old versions of the mega2560 bootloader have a bug that causes them to enter a monitor mode when they see three exclamation points in a row. This bug was fixed years ago, but many mega2560 clones still ship with the old buggy bootloader. You can fix it for good by connecting it to an ISP programmer and doing burn bootloader (see the many, MANY tutorials for details on this), and you can work around it in the short term by avoiding any string constants with three consecutive exclamation points in them.

Copied code with speech marks from some web sites occasionally also cause a similar error.
Can be difficult to spot too.

The code don contain "!!!" string or sepech marks.

Hi, finally I upload my project.
I followed some hints: I use the blue cable of XDRduino board, I review and shrink the code and timeout error goes on.

I don´t know exactly what action solve the problem.