The port stayed 4. My Nano is 4 I believe my mega is 3.
It is possible for a short or external circuitry connected to the Arduino board to interfere with the upload process, causing this type of upload error.
Make sure the board is not sitting on anything conductive that could short the contacts on the bottom of the board. Make sure there isn't any conductive debris (e.g., strands of wire or component leads) on the board or on the surface the board is sitting on.
If you have a shield or any external circuitry or components connected to your Arduino board, try this experiment:
- Disconnect the USB cable of the Arduino board from your computer.
- Disconnect any shields, modules, external circuitry, etc. from your board.
- Connect the Arduino board to your computer with a USB cable.
Now try uploading a sketch to the board again. Does the upload succeed?
This experiment will determine whether the upload error was caused by interference from your external circuitry. If so, you can then focus your attention on identifying the specific problem with the circuit and resolving it.
It been sitting on a clean desk all day. I cleaned it with some 99% alcohol yesterday.
I guess I'll have to assume you followed my instructions about removing any external circuitry even though you didn't make the effort to address that part of my reply.
Given the information gathered so far, I am left with only two possible causes for the upload failure:
- The bootloader was somehow missing or corrupted.
- There is physical damage to the microcontroller or its support circuitry.
If the cause is a missing bootloader, the board might be recoverable by a "Burn Bootloader" operation.
I have to warn you there is no guarantee that this somewhat complex procedure which requires additional hardware will recover your board. But if you have the necessary hardware and are up for a challenge and an interesting project then I think it is worth a try.
Prepare ISP programmer
You will need an ISP programmer. If you don't have a programmer, you can use a spare Arduino board as an "Arduino as ISP" programmer.
Arduino as ISP
The following instructions are for using an Arduino board as an "Arduino as ISP" programmer. If you have a dedicated programmer, you can skip to the next set of instructions.
Although the "Arduino as ISP" only works for programming targets of the AVR architecture, you can also use boards of a variety of architectures (e.g., "AVR", "SAMD", "megaAVR") as an "Arduino as ISP" programmer.
ⓘ In the instructions below, the board used as an "Arduino as ISP" is referred to as the "programmer board". The board the bootloader is being burned on is referred to as the "target board".
-
Disconnect the USB cable of the Arduino boards from your computer.
-
Make the following connections between the "programmer board" and the "target board".
ⓘ Refer to the "Connections" table on the SPI library reference page to determine the pin numbers.Programmer Target CIPO (AKA "MISO") CIPO VCC 5V (VCC on 3.3 V boards) SCK SCK COPI (AKA "MOSI") COPI 10 RESET GND GND -
Connect the "programmer board" to your computer with a USB cable.
-
Select File > Examples > 11.ArduinoISP > ArduinoISP from the Arduino IDE menus.
The "ArduinoISP" sketch will open in Arduino IDE. -
Select your "programmer board" from Arduino IDE's Tools > Board menu.
-
Select the port of your "programmer board" from Arduino IDE's Tools > Port menu.
-
Select Sketch > Upload from the Arduino IDE menus.
-
Wait for the upload to finish.
You are now ready to burn the bootloader using your "Arduino as ISP" programmer.
Burn Bootloader
Instructions for burning the bootloader:
ⓘ It is not possible to do this via Arduino Cloud Editor. You will need to use Arduino IDE or Arduino CLI.
- Connect an ISP programmer to your Arduino board.
If you are using an "Arduino as ISP", then you have already connected it according to the previous instructions. - Select the target board from the Tools > Board menu and any other custom Tools menus (e.g., Tools > Processor).
- Select the appropriate programmer from the Tools > Programmer menu.
- Tools > Burn Bootloader
- Wait for the process to finish successfully.
- Disconnect the USB cable of the programmer from your computer.
- Disconnect the programmer from the "target board".
Now connect the "target board" to your computer with a USB cable, select its port from the Tools > Port menu, and try uploading a sketch as usual.
Conclusion
Now connect the "target board" to your computer with a USB cable and try uploading again. Does the upload succeed now?
Sketch uses 5406 bytes (2%) of program storage space. Maximum is 253952 bytes.
Global variables use 482 bytes (5%) of dynamic memory, leaving 7710 bytes for local variables. Maximum is 8192 bytes.
"C:\Users\jkeen\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\jkeen\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega2560 -cwiring "-PCOM3" -b115200 -D "-Uflash:w:C:\Users\jkeen\AppData\Local\Temp\arduino\sketches\B89AA8D6175ED00E27AC5AE6B48B5B3C/ArduinoISP.ino.hex:i"
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 "C:\Users\jkeen\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM3
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.
Failed uploading: uploading error: exit status 1
i hooked everything up exactly as you said to
Please tell me the exact step in the instructions you were at when you encountered that error.
step 7 programmer
Is the hardware you are using as a "programmer board" a Mega 2560?
No its a Nano
OK, well I can see from the upload output you shared that you selected "Arduino Mega or Mega2560" from the Tools > Board menu in Arduino IDE for some reason before you performed step (7) of the instructions. The upload will fail if you have the wrong board selected. So select the correct board from the IDE's menus and try again.
I have several boards mega uno r3 and 2 nano. They use different connectors as well.
You can use any of those as the "programmer board".