Why Can't I Upload Code?
If you're stuck with upload errors, here's the simple way to fix it:
- Check your board and port selection first. Most errors are just the wrong board or port picked in the IDE.
- Try a different USB cable. Some cables are power-only and won't transfer data.
- Install drivers if you're using a compatible board (CH340/CP2102).
- If all else fails, check the bootloader or try another computer.
The most common error: sync problems
You'll see something like this:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
This means your computer can't talk to the Arduino. Here's how to fix it:
1. Check board and port selection
This is the #1 cause of upload errors.
Verify your board type
- Tools → Board
- Make sure it matches your actual board:
- Arduino Uno for Uno boards
- Arduino Nano for Nano boards
- Arduino Mega or Mega 2560 for Mega boards
- ESP32 Dev Module for ESP32 boards
- For Nano boards, also check Tools → Processor:
- Old bootloader (for older/cheaper Nanos)
- ATmega328P (for newer ones)
Verify your port
- Tools → Port
- Select the port your Arduino is connected to:
- Windows: COM3, COM4, etc.
- Mac: /dev/cu.usbserial* or /dev/cu.wchusbserial*
- Linux: /dev/ttyUSB0 or /dev/ttyACM0
- Not sure which port? Unplug your Arduino, see which port disappears from the menu, plug it back in - that's your port
Pro tip
If your board doesn't show up in the port list at all, see why won't my board show up in COM ports.
2. Check for running code interference
If your Arduino is running code that constantly uses the serial port (like lots of Serial.print statements), it can block uploads.
Quick fix
- Click the Upload button
- When you see "Uploading..." in the Arduino IDE
- Quickly press and release the reset button on your Arduino
- This gives the bootloader a chance to accept the upload
If this works, your code is the problem. Add a small delay in your loop() or reduce Serial.print frequency.
3. USB cable issues (yes, again)
Even if the board shows up, a flaky cable can cause upload errors.
- Try a different USB cable
- Try a different USB port (avoid USB hubs)
- Make sure the cable is pushed in fully on both ends
4. Wrong bootloader settings (Nano boards)
Arduino Nano boards are notorious for this. The board type is correct, but the bootloader version might not be.
- Tools → Board → Arduino Nano
- Tools → Processor → Try both options:
- ATmega328P
- ATmega328P (Old Bootloader)
- Try uploading with each one
Most cheap Nano clones use the old bootloader. If one doesn't work, try the other.
5. Driver issues
If you're using a compatible board with CH340 USB chip, make sure drivers are installed.
See: how do i install Arduino IDE and drivers
6. Bootloader might be corrupted
If nothing else works, the bootloader might be toast. Signs:
- Board shows up in ports correctly
- Correct board and port selected
- Different cables don't help
- Upload never worked, even right out of the box
You'll need to burn a new bootloader using another Arduino as a programmer. Arduino's ArduinoISP guide walks through this.
7. Upload works but code doesn't run
Different problem - the upload succeeds but your code doesn't behave correctly:
Check the code itself
- Upload the Blink example (File → Examples → 01.Basics → Blink)
- If Blink works, your code has a bug
- If Blink doesn't work, might be hardware or wrong board selection
Check the serial monitor
- Tools → Serial Monitor
- Set baud rate to match your code (usually 9600 or 115200)
- Add debug Serial.print statements to see where your code is executing
Quick diagnostic checklist
- ✓ Board type matches your physical board?
- ✓ Correct processor/bootloader selected (especially for Nano)?
- ✓ Port is selected and shows up in list?
- ✓ USB cable supports data (not charge-only)?
- ✓ Drivers installed for CH340/CP2102 chips?
- ✓ Tried pressing reset during upload?
- ✓ No other software using the serial port?
Common error messages decoded
Wrong board type, wrong port, or board not in bootloader mode. Check Tools → Board and Tools → Port.
Wrong port selected, or something else is using the port (close Serial Monitor, Processing, other Arduino IDE windows).
Board not detected. Check cable, drivers, and port selection.
Serial Monitor or another program is using the port. Close everything and try again.
You're not in the dialout group. Run: sudo usermod -a -G dialout $USER then log out and back in.
Most upload errors start with wrong board/port selection. Check Tools → Board and Tools → Port first, then try a known good cable. Hardware failures are rare.
Related: Why won't my board show up in COM ports? · Official Arduino vs compatible boards · How do I install Arduino IDE and drivers?