ATmega328P/Install, then the first upload/05. When the upload fails
Install, then the first upload · 05 of 33

When the upload fails

A failed upload prints one of five messages, and each one points at a different link in the chain: the board choice, the compile, the port choice, opening the port, or the bootloader. Read which one it is before changing anything.

Your board

Read the last red lines

When an upload fails, the IDE shows a short notice and puts the details in the output pane at the bottom. The cause is almost always in the last few lines, and it is one of five. Each stops the upload at a different place.

Where the upload stopped
Bootloader answers
The message
Stopped at
Bootloader answers
Reached the board
yes
avrdude opened the port and nothing answered like a bootloader. The usual causes, in order: the wrong port, the wrong board, or something wired to D0 or D1 that holds the line. It is never the sketch.

Pick a message and the figure lights the link that broke. The links run in the order an upload goes through them, so everything left of the red box worked. That is the useful part: a message from the compiler means the board, cable and driver are not the problem, and a message from the bootloader means the compiler is not.

No board selected

No board selected. Please select your Arduino board from the Tools > Board menu.

The IDE has nothing to compile for. Choose **Tools > Board > Arduino AVR Boards

Arduino Uno**. Nothing has reached the board.

Sketch too big

Sketch uses 35750 bytes (110%) of program storage space. Maximum is 32256 bytes.
Sketch too big; see https://support.arduino.cc/hc/en-us/articles/360013825179 for tips on reducing it.
text section exceeds available space in board

The program is larger than the flash a sketch may use: 32256 bytes on the UNO. The build stops on the computer. Take out what the sketch does not need. The same thing for SRAM says data section exceeds available space in board, and is covered in flash, SRAM and EEPROM.

No upload port provided

Failed uploading: no upload port provided

The sketch compiled and no port is chosen. Open Tools > Port. If nothing new appears there when the board is plugged in, the fault is the cable or the driver, and the CH340 driver is the next step.

Unable to open port

On Windows it reads something like this:

cannot open port COM3: Access is denied.
Error: unable to open port COM3 for programmer arduino

The port exists, and avrdude could not open it. The text after the port name is the operating system's own reason, so it reads differently on each system: Access is denied on Windows and Resource busy on a Mac usually mean another program has the port open, and Permission denied on Linux means your user is not allowed to open it. No such file or directory means the port went away, because the board was unplugged or the cable moved.

Close every other program that might hold the port, including a Serial Monitor in another IDE window, and upload again.

Not in sync

Error: programmer is not responding
Warning: attempt 1 of 10: not in sync: resp=0x00

…and the same pair nine more times. This is the one beginners meet most. avrdude opened the port, reset the board, and nothing answered the way a bootloader answers. Older installs print the same words after avrdude: stk500_recv(): and avrdude: stk500_getsync().

The causes, most likely first:

  1. The wrong port. Something that is not the board is listening. Unplug the board, open Tools > Port, plug in, take the new entry.
  2. The wrong board, or on a Nano the wrong Processor. A board that uploads at another speed never meets the bootloader. It must be Arduino Uno.
  3. Something on pins 0 or 1. The upload travels on them, and a wire, a module or a shield on those pins can hold the line.
  4. The reset did not happen. Press and release the reset button just as the output pane shows that it is uploading. The bootloader then listens for about a second, which is long enough to catch avrdude's first attempt.

On a Nano, the Processor row is the first thing to change once the port is right. Nanos ship with two bootloaders, the newer at 115200 baud and the older at 57600, and ATmega328P (Old Bootloader) is the IDE's setting for the older one. We have not checked which one this Nano ships with, so the error is the test, and the choice that uploads stays right for that board. The UNO has one bootloader, and no Processor row.

A not in sync error never comes from the sketch itself. Whatever the code says, it is not running while the bootloader listens.

When it does not work

not in sync: resp=0x00, ten times

avrdude opened the port and no bootloader answered. In order: choose the port that appears when you plug the board in, set Board to your board (Arduino Uno or Arduino Nano), on a Nano try Processor ATmega328P (Old Bootloader), close the Serial Monitor, take any wire out of pins 0 and 1, then press the board's reset button just as the IDE starts uploading.

cannot open port, Access is denied or Resource busy

Another program has the port open: a second IDE window, the Serial Monitor of another sketch, a serial terminal, or software for a 3D printer or another board. Close it and upload again. Unplugging and replugging the board releases the port too.

Permission denied on /dev/ttyUSB0

On Linux your user is not allowed to open the port. Add yourself to the dialout group with sudo usermod -aG dialout and your user name, then log out and back in. The CH340 driver article has the command.

Sketch too big

The program needs more flash than a sketch may use: 32256 bytes on the UNO, 30720 on the Nano. The build stops before the board is involved. Remove a library, a font or a table the sketch does not need; a fresh upload attempt will not help.

The upload worked once and fails every time since

Something changed after the first good upload. Usually it is a wire now in pin 0 or 1, or a shield or module that uses them. Unplug wires and shields, then press reset as the upload starts.

Where this goes next

The two functions every sketch is made of, and what a reset does to them.

setup() and loop() →

Edit this page — content/books/atmega328p/when-the-upload-fails.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum →