Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.
Upload error · esptool

Fix “Wrong boot mode detected (0x13)! The chip needs to be in download mode”

esptool reset the ESP32 but it booted your sketch instead of the bootloader. GPIO0 was not held low — fix auto-reset or press BOOT while connecting.

ESP32ESP32-CAMESP32-S3ESP32-C3Updated 3 Nov 2026

Community draft — report a mistake

What you see

OutputOutput
esptool.py v4.8.1
Serial port COM5
Connecting......................................

A fatal error occurred: Failed to connect to ESP32: Wrong boot mode detected (0x13)! The chip needs to be in download mode.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
Failed uploading: uploading error: exit status 2

To flash an ESP32, esptool resets it with GPIO0 held low so the ROM starts in download mode. The ROM prints its boot mode over serial, and since esptool 4.6 that line is checked. “Wrong boot mode detected (0x13)” means the chip came up in normal flash boot, because GPIO0 was high at the moment of reset.

Holding BOOT by hand proves it in seconds. If that works, fix the auto-reset timing with a 10 µF capacitor on EN, or keep GPIO0 free during uploads. The related ROM message is covered in ESP32 stuck on “waiting for download”.

Quick fix — try in order

  1. 1

    Hold BOOT while it says “Connecting…”

    Press and hold BOOT (IO0) when the dots start, release once you see “Chip is ESP32…”. If that works, the board's auto-reset circuit is the weak spot.

  2. 2

    Free GPIO0

    Anything wired to GPIO0 (a relay module, a button with a pull-up, an LED to 3.3 V) can stop the reset circuit pulling it low. Disconnect it for the upload.

  3. 3

    Add a 10 µF capacitor from EN to GND

    On DevKit clones the EN line rises too fast, so the chip samples GPIO0 before it is pulled low. A 10 µF electrolytic (− leg to GND) slows EN and makes auto-reset reliable.

  4. 4

    Close Serial Monitor and other serial tools

    Some terminals toggle DTR/RTS themselves and fight esptool's reset sequence.

  5. 5

    ESP32-CAM: jumper IO0 to GND

    Boards without the MB adapter need IO0 tied to GND, then a press of RST, before uploading. Remove the jumper and press RST to run the sketch.

Why it happens

What does 0x13 mean?

It is the boot strap value the chip printed: 0x13 = SPI_FAST_FLASH_BOOT, a normal boot that runs your sketch. Download mode prints 0x3 (DOWNLOAD_BOOT). esptool saw the normal boot and gave up early.

Why this message instead of “No serial data received”?

esptool 4.6 and later read the ROM's boot line to tell you what went wrong. Older versions just timed out.

Native-USB chips show other values

ESP32-S3 and C3 print different strap values (for example 0x8). The meaning is the same: the chip booted normally because BOOT was not held.

Board-specific notes

ESP32 DevKit V1: The most common fix is the 10 µF EN capacitor. See the DevKit V1 page for the strapping pins.

ESP32-S3 / C3: Hold BOOT, tap RESET, release BOOT, then upload.

↑↓ to move · Enter to open