Some users who experienced unexplained upload failures at the verification step reported that the problem was resolved by performing a "Burn Bootloader" operation on the board.
A program called a "bootloader" is stored in a special area in the microcontroller's memory. This program receives the sketch program upload data from the computer and writes the data to the program memory. When you perform a "Burn Bootloader" operation, you upload a new copy of the bootloader program to the microcontroller.
It is not clear what could cause the bootloader program to be corrupted in a manner that allows it to communicate with the computer as usual, but fail to write to program memory, without the microcontroller having suffered physical damage (which can not be fixed by a "Burn Bootloader" operation). However, if it has apparently helped others to restore their boards to a usable condition, burning the bootloader might be worth a try.
The "Burn Bootloader" procedure is quite complex and there is no guarantee that your board will be restored if you manage to successfully complete the procedure.
If you are up for a challenge and learning about this interesting procedure (which can be used for other advanced applications), then go for it! But if you prefer to focus on your actual project rather than going down this rabbit hole then I recommend simply replacing the bad board with a new one.
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".
Programmer Target CIPO (AKA "MISO") CIPO VCC 5V (VCC on 3.3 V boards) SCK SCK COPI (AKA "MOSI") COPI 10 RESET GND GND ⓘ The documentation for the boards you are using will identify the location of these pins. If you are using an official Arduino board, check the pinout diagram on the documentation page for the board.
-
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 without the verification error now?