Skip to content
FR
  1. LuzineDebug
  2. Electronics & Arduino
  3. A fatal error occurred: Failed to connect to ESP…
Electronics & Arduino Beginner ≈ 10 min to fix

Fix "Failed to connect to ESP32" (Wrong boot mode, No serial data received)

Error message
A fatal error occurred: Failed to connect to ESP32: Wrong boot mode detected (0x13)! The chip needs to be in download mode.
  • A fatal error occurred: Failed to connect to ESP32: No serial data received.
  • A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
  • A fatal error occurred: Failed to connect to ESP32-S3: No serial data received.
  • A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header
  • Connecting......................................
In short

esptool could not put the ESP32 into download mode: the chip booted its normal program instead of waiting to be flashed. Hold the BOOT button during "Connecting...", check the cable and port, and lower the upload speed if needed.

Be the first to confirm this fix

What this error means

To flash, esptool resets the chip while holding GPIO0 low using the DTR/RTS lines of the USB-serial adapter. If that sequence fails, the ESP32 boots from flash. boot:0x13 is SPI_FAST_FLASH_BOOT, the normal boot, hence "Wrong boot mode detected". "No serial data received" means esptool receives nothing at all: wrong port, charge-only cable or unpowered chip. Your project code is not the issue; it is entering download mode or the serial link.

Common causes

  1. Faulty auto-reset: on many cheap boards, the DTR/RTS circuit is too fast or missing and GPIO0 is not held low at the right time.
  2. Wrong port, cable or driver: charge-only cable, missing CP210x or CH340 driver, or port already opened by a serial monitor.
  3. Strapping pins in use: a component pulls GPIO0, GPIO2 or GPIO12 (ESP32) or GPIO0, GPIO2, GPIO15 (ESP8266) to the wrong level at reset.
  4. Speed too high: at 921600 baud, a long cable or poor adapter drops packets ("Timed out waiting for packet header").
  5. Native USB (ESP32-S2, S3, C3, C6): if the running program crashed or disabled USB, the port no longer appears until you force download mode.

Step-by-step fix

  1. Check the port and cable

    Close every serial monitor, use a USB data cable and find the port: it appears when you plug the board in and disappears when you unplug it.

    bash
    # Linux
    ls /dev/ttyUSB* /dev/ttyACM*
    # macOS
    ls /dev/cu.*
    # Windows (PowerShell)
    [System.IO.Ports.SerialPort]::GetPortNames()
  2. Force download mode

    Hold the BOOT (IO0) button, press and release EN (or RST), then release BOOT. You can also keep BOOT pressed while "Connecting..." is displayed and release it once writing starts. On native-USB ESP32-S2/S3/C3: hold BOOT while plugging in the USB cable, then release it.

  3. Test with esptool directly

    This command reads the chip ID without writing anything. If it answers, the link works and the problem is the IDE configuration.

    bash
    pip install --upgrade esptool
    esptool --port /dev/ttyUSB0 --baud 115200 chip-id
    # esptool v4 and older: esptool.py --port /dev/ttyUSB0 chip_id
  4. Lower the upload speed

    In the Arduino IDE, choose "Tools > Upload Speed > 115200". With PlatformIO, set the speed and port in platformio.ini.

    ini
    [env:esp32dev]
    platform = espressif32
    board = esp32dev
    framework = arduino
    upload_speed = 115200
    upload_port = /dev/ttyUSB0
  5. Free the strapping pins

    Temporarily disconnect anything wired to GPIO0, GPIO2, GPIO12 and GPIO15. On ESP32, GPIO12 high at boot sets the flash to 1.8 V and prevents booting: move that component to another pin.

  6. Add a capacitor on EN

    If you have to press BOOT every time, solder a 10 µF capacitor between the EN pin and GND (negative lead on GND). It delays the reset and gives the DTR/RTS circuit time to hold GPIO0 low.

Did this fix work for you?

Confirm it in one click: it will rise for the next developers stuck on the same error.

Keep it from coming back

  • Keep GPIO0, GPIO2, GPIO12 and GPIO15 free, or check their boot-time level in the Espressif documentation for your chip.
  • Use short, known-good USB data cables, and 115200 or 460800 baud if 921600 is unstable.
  • Prefer reputable development boards (DevKitC, Feather, etc.) with a reliable auto-reset circuit.

Frequently asked questions

What does "boot mode 0x13" mean on ESP32?

0x13 is SPI_FAST_FLASH_BOOT: the chip booted normally from flash. GPIO0 was not low at reset, so it did not enter download mode.

Do I have to press BOOT for every upload?

Normally no. If you must, the board's auto-reset is too fast: a 10 µF capacitor between EN and GND fixes it in most cases.

My ESP32-S3 no longer shows up as a serial port, what do I do?

Hold BOOT while plugging in USB to force download mode: the port comes back. Flash a valid program and, in the Arduino IDE, enable "USB CDC On Boot" if you want to use Serial over native USB.

Useful tools for this error

More Electronics & Arduino errors

All Electronics & Arduino errors →