Can't upload to CH340 Arduino Mega 2560. avrdude timeout

Hi all.

After a long time of happily using the Arduino Mega I too got struck with the dreaded avrdude timeout error.

The problem just occurred without anything happening before it. There is something strange about this error. If I try to upload something I got the error, but if I reflash the bootloader I can upload for ONE time only. After that I got the timeout error again. I don't know if reflashing the bootloader erases the entire flash but the last sketch I uploaded will start again after reflashing.

My Arduino is from here and the ISP I use if from here here.

The code is not really relevant here but I will include it anyway.

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(100);
  digitalWrite(13, LOW);
  delay(100);
  }

After uploading that I try to reflash it with anything but it doesn't upload a second time. Serial output works like a charm and so are more complicated sketches but I can't reupload without pressing the reset button. This has some serious problems for me since I upload via bluetooth that also works a single time.

The error I got is

Sketch uses 1460 bytes (0%) of program storage space. Maximum is 253952 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 8183 bytes for local variables. Maximum is 8192 bytes.
C:\Users\Natsuki\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino8/bin/avrdude -CC:\Users\Natsuki\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino8/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM4 -b115200 -D -Uflash:w:C:\Users\Natsuki\AppData\Local\Temp\arduino_build_407265/Blink.ino.hex:i 

avrdude: Version 6.3, compiled on Dec 16 2016 at 13:33:19
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Natsuki\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino8/etc/avrdude.conf"

         Using Port                    : COM4
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
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

My OS is Windows 10 pro and the arduino version I tried it with are 1.6.13 and 1.8.1.

I hope there is a solution for this.

Is anything connected to pins 0, 1 or reset?

When you burn the bootloader, you're using the IDE's 'burn bootloader' facility?

1 Like

I am uploading it to a bare Arduino Mega. Nothing connected except a usb cable and yes. I just use the Burn Bootloader function in the Arduino IDE

Natsuki-chan:
if I reflash the bootloader I can upload for ONE time only. After that I got the timeout error again.

I believe that indicates a problem with the auto-reset.

pert:
I believe that indicates a problem with the auto-reset.

What could be the cause of that? And is there a way to fix the auto-reset?

After really close examination of the board I saw a component (I presume the capacitor) that was missing. I checked it with a multimeter and it was the reset.
So next question then. What capacitor do I need to use. Is it possible to use a electrolytic or do I need to use a ceramic one.

Nice work! I believe it's C7 in the schematic:

So 100 nF / 0.1 uF. I don't think electrolytic capacitors are commonly found in such small values. I have used ceramic and tantalum for this but never tried electrolytic. You can check if the auto-reset circuitry is really the cause of your problem by manually pressing the reset button on the mega as soon as you see the upload begin (after compilation is complete). The reset is necessary to activate the bootloader but not on the first upload after burning the bootloader.

Like I stated in my question I can upload if I press reset.
On another note, bluetooth uploading does work. I made a mistake in wiring and didn't think that auto-reset is not used in bluetooth uploading.
In the image is the broken capacitor