OC
OceanRemote
Low-code IoT platform
Back to Troubleshooting Hub

ESP32 Upload Failed

Your ESP32 fails to upload firmware in Arduino IDE. The upload process gets stuck at "Connecting..." or times out. This guide covers boot mode entry, USB cable issues, driver installation, baud rate settings, and connection problems for ESP32 Dev Kit, ESP32-S3, ESP32-C3, and other ESP32 variants.

Last updated: April 22, 2026 | 12 min read

Symptoms

  • Arduino IDE shows "A fatal error occurred: Failed to connect to ESP32"
  • Upload progress bar stuck at "Connecting..." indefinitely
  • Error message: "Timed out waiting for packet header"
  • Error message: "Invalid head of packet"
  • Board resets during upload but doesn't enter download mode
  • Upload works on one computer but not another
  • Different ESP32 board works, but specific board fails consistently

Common Causes

  1. Not in Download Mode ESP32 needs GPIO0 LOW during reset to enter bootloader mode. BOOT button must be pressed
  2. Wrong Board Selected Selected wrong board variant
  3. USB Cable Issues Charge-only cable or poor connection
  4. Driver Not Installed Windows missing USB-to-serial driver
  5. Wrong COM Port Selected Multiple ports available; wrong one selected
  6. Another Program Using COM Port Serial Monitor, Cura, or other software holding port open
  7. Power Supply Insufficient Upload draws current; weak power supply causes reset during upload

ESP32 Boot Mode Pins

GPIO0 GPIO2 Boot Mode Use For
1 () Don't Care () Normal boot () Running firmware ()
0 () Don't Care () Download mode () Uploading firmware ()

Most ESP32 boards have auto-reset circuitry that handles this automatically. Clone boards may lack this, requiring manual button press.

Step-by-Step Fixes

1. Manual BOOT Button Sequence

ESP32 needs GPIO0 LOW during reset to enter download mode:

  • In Arduino IDE, click Upload button ()
  • Watch the status bar for "Connecting..." message
  • Press and HOLD the BOOT button on your ESP32 board
  • Press and release the EN button while still holding BOOT
  • Keep holding BOOT for 2-3 seconds after releasing EN
  • Release BOOT button
  • Upload should start
// Timing sequence :
// 1. Click Upload in Arduino IDE
// 2. Watch for "Connecting..." in console
// 3. HOLD BOOT button
// 4. PRESS and RELEASE EN button 
// 5. KEEP HOLDING BOOT for 2-3 seconds
// 6. RELEASE BOOT button
// 
// Alternative: Some boards have auto-reset circuit
// If your board has DTR/RTS connections, no manual buttons needed

2. Select Correct Board in Arduino IDE

Wrong board selection causes upload failures:

  • Tools Board ESP32 Arduino Select your specific board:
  • ESP32 Dev Module For standard ESP32 boards
  • ESP32-S3 Dev Module For ESP32-S3
  • ESP32-C3 Dev Module For ESP32-C3
  • AI Thinker ESP32-CAM For ESP32-CAM boards
  • Flash Size: Match your board
  • Upload Speed: Start with 115200
  • Partition Scheme: Default

3. Install USB Drivers

Most ESP32 boards use CH340 or CP2102 chips:

  • Check Device Manager for "USB Serial Port" or "Unknown Device"
  • CH340 driver: Download from wch.cn
  • CP2102 driver: Download from Silicon Labs
  • ESP32-S3/C3: May use native USB
  • Install driver and restart computer
  • After installation, COM port should appear in Device Manager Ports

4. Reduce Upload Speed

High baud rates can fail on poor USB cables:

  • Tools Upload Speed Change from 921600 to 115200
  • Slower speed is more reliable, especially on Windows
  • For very stubborn boards, try 74880
  • After changing speed, re-compile and upload

5. Check COM Port Selection

Multiple COM ports can cause confusion:

  • In Arduino IDE: Tools Port
  • Disconnect ESP32 USB note which COM ports disappear
  • Reconnect ESP32 the new port that appears is your board
  • Select that port
  • If no port appears, driver not installed or cable issue

6. Test USB Cable

Many USB cables are charge-only :

  • Test with known working data cable
  • Look for cables marked "data sync" or "data transfer"
  • Try different USB port on computer
  • Avoid USB hubs connect directly to computer
  • Short cables are more reliable than long cables

7. Check Power Supply

Insufficient power causes upload failures:

  • ESP32 draws significant current during upload
  • Computer USB ports may not provide enough power
  • Use powered USB hub or external 5V power supply
  • Disconnect relays, sensors, and other peripherals during upload
  • Add 470-1000F capacitor between 5V and GND for stability

Common Upload Error Messages

Error Message Meaning Solution
Failed to connect to ESP32 No response from board () Check COM port, cable, driver, BOOT button sequence
Timed out waiting for packet header () Board not entering download mode () Press BOOT + EN correctly
A fatal error occurred () Communication failure () Lower upload speed, check USB cable
Invalid head of packet () Data corruption () Try different USB cable, lower baud rate
Upload failed: exit status 2 () General failure () Check BOOT button sequence, COM port

Prevention Tips

  • Learn the BOOT+EN button sequence practice timing
  • Use quality data USB cables
  • Install CH340/CP2102 drivers before first use
  • Use 115200 upload speed for maximum reliability
  • Close Serial Monitor before uploading
  • Select correct board
  • Test with Blink sketch first to verify upload works

Related Issues

Frequently Asked Questions

Q: Why do I need to press BOOT button? Other boards don't need this.

A: ESP32 requires GPIO0 LOW during reset to enter download mode. Some boards have auto-reset circuits that do this automatically. Clone boards often lack this circuit, requiring manual button press.

Q: Upload works on Mac/Linux but not Windows. Why?

A: Windows requires specific CH340/CP2102 drivers. Mac/Linux have built-in drivers. Install correct driver for your USB chip. Also, Windows USB power management may affect upload stability.

Q: My ESP32-S3/C3 has native USB. Do I need drivers?

A: ESP32-S3/C3 with native USB use the built-in USB stack. Windows 10/11 have built-in drivers. Select "ESP32-S3 Dev Module" as board. May need to press BOOT button for upload.

Still having upload issues? Contact Support or return to the Troubleshooting Hub.