Can't flash ESP32 S2 with ESPFlasher or web but can flash it with ArduinoIDE

I’m trying to upload ESPHome to ESP32 S2 mini “ESP32-S2FN4R2”, but I can’t flash it using web nor espflasher nor esptool.

I thought that the board is faulty, so I tried flashing anything onto it with ArduinoIDE and it works, I can upload blink sketch with no problems (I know to hold the BOOT button, and reset after flashing). I’ve tried with 2 different boards, same issue.

I’ve tried installing different drivers (zadig, cp210x, ch340, etc), changing the com port speed to 115200, and more; nothing works.

From ESP flashers I’m getting

Using 'COM5' as serial port.
Unexpected error: Cannot configure port, something went wrong. Original message: PermissionError(13, 'A device attached to the system is not functioning.', None, 31)

output from ArduinoIDE; flashing blink sketch:

"AppData\Local\Arduino15\packages\esp32\tools\esptool_py\4.6/esptool.exe" --chip esp32s2 --port "COM5" --baud 921600  --before default_reset --after hard_reset write_flash  -z --flash_mode keep --flash_freq keep --flash_size keep 0x1000 "AppData\Local\Temp\arduino\sketches\560B72A77F94C94826FDB33CDE61833C/Blink.ino.bootloader.bin" 0x8000 "AppData\Local\Temp\arduino\sketches\560B72A77F94C94826FDB33CDE61833C/Blink.ino.partitions.bin" 0xe000 "AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1/tools/partitions/boot_app0.bin" 0x10000 "AppData\Local\Temp\arduino\sketches\560B72A77F94C94826FDB33CDE61833C/Blink.ino.bin" v4.6
Serial port COM5
Chip is ESP32-S2FNR2 (revision v0.0)
Features: WiFi, Embedded Flash 4MB, Embedded PSRAM 2MB, ADC and temperature sensor calibration in BLK2 of efuse V2
Crystal is 40MHz
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00004fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x0004bfff...
Compressed 15568 bytes to 11011...
Writing at 0x00001000... (16 %)
Writing at 0x00001c23... (33 %)
Writing at 0x00002767... (50 %)
Writing at 0x00003244... (66 %)
Writing at 0x00003ba6... (83 %)
Writing at 0x00004887... (100 %)
Wrote 15568 bytes (11011 compressed) at 0x00001000 in 0.5 seconds (effective 260.4 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.1 seconds (effective 215.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.2 seconds (effective 415.0 kbit/s)...
Hash of data verified.
Compressed 244976 bytes to 138447...
Writing at 0x00010000... (1 %)
Writing at 0x00011177... (2 %)
Writing at 0x00012998... (4 %)
Writing at 0x00013f7c... (5 %)
Writing at 0x0001599b... (7 %)
Writing at 0x00017381... (8 %)
Writing at 0x00018831... (10 %)
Writing at 0x0001a03d... (11 %)
Writing at 0x0001c45f... (13 %)
Writing at 0x0001e4f0... (14 %)
Writing at 0x0001f65b... (16 %)
Writing at 0x0002010a... (17 %)
Writing at 0x00020d19... (19 %)
Writing at 0x0002184b... (20 %)
Writing at 0x0002223b... (22 %)
Writing at 0x00022caa... (23 %)
Writing at 0x00023719... (25 %)
Writing at 0x00024316... (26 %)
Writing at 0x00024d99... (27 %)
Writing at 0x00025832... (29 %)
Writing at 0x00026353... (30 %)
Writing at 0x00026ccf... (32 %)
Writing at 0x000276b3... (33 %)
Writing at 0x000280d5... (35 %)
Writing at 0x00028bb8... (36 %)
Writing at 0x00029621... (38 %)
Writing at 0x00029f99... (39 %)
Writing at 0x0002aabf... (41 %)
Writing at 0x0002b4ca... (42 %)
Writing at 0x0002bec7... (44 %)
Writing at 0x0002c828... (45 %)
Writing at 0x0002d38c... (47 %)
Writing at 0x0002dda7... (48 %)
Writing at 0x0002e990... (50 %)
Writing at 0x0002f353... (51 %)
Writing at 0x0002fd58... (52 %)
Writing at 0x00030890... (54 %)
Writing at 0x000313da... (55 %)
Writing at 0x00031f57... (57 %)
Writing at 0x00032933... (58 %)
Writing at 0x000333ba... (60 %)
Writing at 0x00034009... (61 %)
Writing at 0x00035283... (63 %)
Writing at 0x0003611d... (64 %)
Writing at 0x0003819f... (66 %)
Writing at 0x00039ee0... (67 %)
Writing at 0x0003a89a... (69 %)
Writing at 0x0003b276... (70 %)
Writing at 0x0003c0ff... (72 %)
Writing at 0x0003d4ef... (73 %)
Writing at 0x0003eda5... (75 %)
Writing at 0x00040620... (76 %)
Writing at 0x00041041... (77 %)
Writing at 0x00041a7c... (79 %)
Writing at 0x000424e2... (80 %)
Writing at 0x00042f06... (82 %)
Writing at 0x00043ad2... (83 %)
Writing at 0x000446ad... (85 %)
Writing at 0x000450de... (86 %)
Writing at 0x00045b29... (88 %)
Writing at 0x000465ef... (89 %)
Writing at 0x00047111... (91 %)
Writing at 0x00047b3b... (92 %)
Writing at 0x000486dc... (94 %)
Writing at 0x000493fd... (95 %)
Writing at 0x00049ffc... (97 %)
Writing at 0x0004a9ad... (98 %)
Writing at 0x0004b4ea... (100 %)
Wrote 244976 bytes (138447 compressed) at 0x00010000 in 5.4 seconds (effective 365.0 kbit/s)...
Hash of data verified.

WARNING: ESP32-S2FNR2 (revision v0.0) chip was placed into download mode using GPIO0. can not exit the download mode over USB. To run the app, reset the chip manually.
To suppress this note, set --after option to 'no_reset'.
Failed uploading: uploading error: exit status 1

Have you done as the error message suggested?

1 Like

such as? :no_mouth:

To run the app, reset the chip manually

I had this issue, and it turned out i needed to downgrade my driver for the serial port…

The latest is 1.38, have to downgrade to 1.35 every time i plug it in; can’t remember the name at the moment (i am on holiday and left my programmer home) but it is a commonly used chinese serial port (something like CH340 or so).

ESP32 S2 mini uses usb CDC, there is no usb to ttl converter in between. I’ve tried zadig and others.

I think it might be the baud rate? In windows you can only select 115200 as the fastest speed, there is no 921600. External esp flashing tools have such speeds but it still didn’t work, on any common speeds.

I posted the below in another thread a few months ago. Copy link isn’t working for me on mobile, so I had to copy the entire post:

I had the same issue with the lolin_s2_mini (also an ESP32 with Type C). Spent a day trying to flash it the usual way, but no luck.

Went through all the troubleshooting steps like checking the cable is actually wired for data and reinstalling new drivers, but ESPHome wouldn’t flash it no matter what I tried.

In the end, I came across a post which said that ESPHome calls some kind of reboot during the flashing process, causing it to be kicked out of boot mode. Some more digging around led me to Adafruit ESPTool , which lets you perform the first flash without any issues.

This video shows you how to do it step by step (apologies for the annoying robot voice, it was the first video I found).

1 Like

so you might be able to hold the boot button all the time during flashing, so when it reboots it’s in flash mode still? Will check it out after work, thanks.

No, you only need to hold the boot button while you press & release the reset button.

The video I linked shows you the order of button pressing at the 1:26 timestamp.

PS - I didn’t mention this earlier, but you only need to use the tool for the first flash.
Once that’s done, you can flash OTA using ESPHome normally.

There is, but it is integrated on the board .

It will show as a serial port in your device list :wink: