Mega Based Prototype: stk500v2_ReceiveMessage(): timeout

Hello everyone,

I'm working on prototyping a board based on the Arduino Mega using the Eagle files taken directly from the arduino website. Unfortunately, the pins needed to perform the Loop Back Test are no longer present.

To program the m16u2 I've used my USBasp at the ICSP at the m16u2 and this command in the command prompt on Windows:

avrdude -p atmega16u2 -P usb -c usbasp -U flash:w:Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex:i -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m -F

This appears to be uploaded successfully.

I then fire up the IDE, connect the USBasp to the ICSP at the 2560, change the programmer to USBasp, then hit burn bootloader. Again, this appears to be successful.

When I connect the board using the usb connector, my computer recognizes that I have an Arduino Mega device connected on both of my computers (Com 19 on my Windows PC, usbmodem14201 on my Mac).

The board info says

  • BN: Arduino Mega or Mega 2560
  • VID: 0x2341
  • PID: 0x0042

Additionally:

The "ON" light is always constant.
The "L" light, however, blinks for two beats then is off for one. That is, until I connect it via USB and try to upload a sketch through the IDE. It then becomes constant until I press the reset button and reverts back to the 2:1 blinking.
The "RX" light blinks every time a timeout message is received in the IDE.
The "TX" light never blinks.

The message I receive in the IDE while trying to upload a sketch is as follows:

Arduino: 1.8.12 (Mac OS X), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"...


avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Users/XXXX/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
         User configuration file is "/Users/XXXX/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbmodem14201
         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.

An error occurred while uploading the sketch

If anyone has a suggestion to a possible fix, that would be amazing. Thank you.

I'm facing the exact same issue and it is misery since last three days.

I'm trying to flash code onto an ATMEGA 2560 bare chip using an Arduino Uno.

I've uploaded the boot loader from Nick Gammon's page (https://www.gammon.com.au/forum/?id=11633).
Here's the output

02:16:38.782 -> Atmega chip programmer.
02:16:38.782 -> Written by Nick Gammon.
02:16:38.782 -> Version 1.38
02:16:38.782 -> Compiled on Sep 13 2020 at 02:16:19 with Arduino IDE 10813.
02:16:38.782 -> Attempting to enter ICSP programming mode ...
02:16:38.914 -> Entered programming mode OK.
02:16:38.914 -> Signature = 0x1E 0x98 0x01 
02:16:38.914 -> Processor = ATmega2560
02:16:38.914 -> Flash memory size = 262144 bytes.
02:16:38.914 -> LFuse = 0xFF 
02:16:38.914 -> HFuse = 0xD8 
02:16:38.914 -> EFuse = 0xFD 
02:16:38.978 -> Lock byte = 0xFF 
02:16:38.978 -> Clock calibration = 0x8A 
02:16:38.978 -> Bootloader address = 0x3E000
02:16:38.978 -> Bootloader length = 7474 bytes.
02:16:38.978 -> Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...

When I try to upload a simple blink program, I get the timeout error as mentioned by kairos007.

I doubted the hardware initially and ended up changing the Uno, the 2560 chip, the crystal and wires too!
I've tried an external 9V 2A power supply plugged to the UNO and with the computer USB.
No change.
I've tried with Arduino IDE versions 1.6.9, 1.8.12 and 1.8.13. The issue is the same.

Any help would be greatly appreciated.

Best regards!

Unfortunately, the pins needed to perform the Loop Back Test are no longer present.

What does that mean? The pins used for loopback are the same as those used for upload...
Do y'all have appropriate auto-reset circuitry?

I have the reset of target 2560 chip connected to D10 of programming Uno. And a 10uF electrolytic capacitor between reset and ground on the programming Uno. (It is the same response with and without the capacitor).

Do you think I've missed something?

@subramanyamn I can upload sketches just fine using my USBasp. I don't believe our issues are the same.

@westfw

What does that mean? The pins used for loopback are the same as those used for upload...

In the wiring for PE0 and PE1, one set of branches lead to the 2560 chip (pad 2 = RX, pad 3 = TX), the others lead to PWM 0 and PWM 1, respectively. So, while the traces that facilitate communication between RN4 and the 2560 chip have not been touched, the branches for PWM 0 and PWM 1 (Pin 0 and Pin 1) no longer exist.

Do y'all have appropriate auto-reset circuitry?

I believe so, yes. I haven't touched any of the circuitry that wasn't connected to a pin.