Arduino times out when uploading sketch

Hello,

I have a Mega that gives me a timeout error when attempting to upload a new sketch.
I reuploaded the bootloader hoping that it would clean it up. It didn't fix the problem, but it did narrow down the issue.

After reuploading the bootloader, I then uploaded the Blink sketch just to test if it would take it, and it worked just fine. However, when I tried to upload a 2nd sketch, it went back to the timeout error. This leads me to believe that it is having problems overwriting the old sketch.

What might be the cause of the problem?
Thanks!

Welcome to the forum.

Do you have a programmer to write the bootloader via the ICSP header ?
Then you can also use that programmer to upload a sketch with "Upload Using Programmer" via the ICSP header.

Is there something wrong with the second sketch ?
Can you remove everything, only the USB connector to the board should be connected. Use a different USB cable. Can you measure the 5V pin ? It should be above 4.5V.

Can you upload the Blink sketch twice ?
Then try to upload a sketch that sends some text to the Serial Monitor. Can you see that text ?
If that works, then you can show your sketch that blocks the upload, although I think it is not possible to block the uploading with a sketch. It is more likely that you have connected something to pin 0 and 1 or that the board is damaged or the USB cable is too cheap.

The board can be damaged if you soldered a wire and heated the board for too long, or if you have used a motor with 12V and that 12V got somehow into the board.

I used an Arduino Uno to program the Mega through the ICSP headers.

After that, I connected the Mega to my PC through USB and upladed the Blink sketch.

Then, I uploaded the Blink sketch again and it timed out.

Nothing was connected to the additional pins on the Mega.

There may very well be some damage but I dont know what would prevent it from dowloading more than one sketch

I don't know what to say. I can not explain it. It might be faulty or the voltage is too low.

auto reset stopped working on the Mega. it is not required when the flash is clean so you can upload once after burning the bootloader.
try the reset button while avrdude attempts to upload

I've done a little more testing with it and found that it will upload once per connection to my PC. Essentially, I just have to unplug and replug the usb cable. The reset button will not give the same result.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.