[solved] WSL V3: A fatal error occurred: Failed to connect to ESP32-S3: Wrong boot mode detected (0x14)

I re-connected a Wireless Stick Lite V3 in order to re-program it for some other testing as before. The code is compiling just fine, but it fails to upload the code to the board. This time I checked twice whether I selected the correct board and port in the board manager and I did. I get the following error:

I tried to reconnect the board to a different usb port, unplug it, replug with reset button pressed - no difference. the previously loaded program is running happily on the board blinking the led and writing data to the serial interface.
it seems the arduino ide (V2.02) is not able to set the device to a state where it accepts new code.

any ideas how I can fix this ?

Thanks in advance
Wolfgang

You could try ā€˜manuallyā€™ putting the board into boot modeā€”hold the USER button while pressing the RST button, then release both. In the Serial Monitor, you should see a message like:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x0 (DOWNLOAD(USB/UART0))
waiting for download

and at that point the boot loader should just be waiting for you to upload your code.

Doing that, I get the following on the serial monitor before it goes back to run the previously loaded program

08:50:57.818 -> ......ESP-ROM:esp32s3-20210327
08:50:59.629 -> Build:Mar 27 2021
08:50:59.629 -> rst:0x1 (POWERON),boot:0x14 (SPI_FLASH_BOOT)
08:50:59.629 -> SPIWP:0xee
08:50:59.629 -> mode:DIO, clock div:1
08:50:59.671 -> load:0x3fce3808,len:0x43c
08:50:59.671 -> load:0x403c9700,len:0xbec
08:50:59.671 -> load:0x403cc700,len:0x2a3c
08:50:59.671 -> SHA-256 comparison failed:
08:50:59.671 -> Calculated: dcde8d8a4817d9bf5d5d69a7247667264e4e10ac7493514868b61f5aa6146539
08:50:59.671 -> Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
08:50:59.671 -> Attempting to boot anyway...
08:50:59.671 -> entry 0x403c98d8
08:50:59.744 -> ......Blink

Yeah, Iā€™ve seen that too. Unfortunately, I canā€™t remember the exact sequence to move beyond that, but I did manage to succeed after seeing that message. I think it probably happened after Iā€™d been trying several different things with different boards and ports.

Try unplugging the WSL, plugging it back in again (i.e. power cycle the board), selecting the board and port again (within the Arduino IDEā€”are you using the latest Arduino IDE?), then follow the ā€˜manualā€™ sequence. Maybe even restart the IDE. Be persistent though, at least until you get a consistent, repeatable result. I got the message you are seeing more than once, but I havenā€™t seen it at all since I got things working.

I upgraded my Arduino IDE before trying all this stuff too, and I reckon the latest release (2.0.2) is still a bit flakey, or at least itā€™s taking a bit of getting used to the new interface. This may be part of the reason why Iā€™m struggling to remember exact sequences, or even why I tried some seemingly weird or unnecessary sequences in the first place.

Thanks, @UniquePete. I got it working now.

I tried a lot of things without success: Restarting the IDE, unplugging the board, replugging with any combination of buttons pressed or not, tried on a different pc / operating system, ide v 1.8 to no effect.

I noticed, however, that everytime I did try something, the board went into one of two ā€œboot statesā€:

10:40:02.179 -> Build:Mar 27 2021
10:40:02.179 -> rst:0x1 (POWERON),boot:0x14 (SPI_FLASH_BOOT)
10:45:49.293 -> Build:Mar 27 2021
10:45:49.293 -> rst:0x1 (POWERON),boot:0x1c (SPI_FAST_FLASH_BOOT)

The rest of the output was always identical. So pressing the buttons did not result in the expected outcome.
I then used some jumper cables and tried to do the reset into bootloader mode by pulling the pins 6 (user) and 14 (reset) on the right connector line to ground and release(disconnect from ground) them again - reset pin first. That did the trick. I got the state you described above and was able to upload my new sketch.

Uploading new sketches works up until now, even the button combination user-reset, then release both brings the board into bootloader mode now:

15:19:27.223 -> ESP-ROM:esp32s3-20210327
15:19:27.223 -> Build:Mar 27 2021
15:19:27.223 -> rst:0x1 (POWERON),boot:0x0 (DOWNLOAD(USB/UART0))
15:19:27.269 -> waiting for download

I dont know what triggered the faulty behaviour before. I can only speculate at this: maybe its my pc going into a sleep mode, maybe its playing around with wrong board settings. Iā€™ll post here if I find out.

Regards, Wolfgang

I think I found the root-cause for the problem. Since the board wouldnā€™t get into programming mode without using the workaround described above, I did some further investigations. The board is used on a self-designed PCB intended to send messages on interrupts triggered by io pins. Looking at the pinout diagram, I selected GPIO45 and GPIO46 on Header J2 for my interrupts, since they seem to have no other important use than a normal GPIO pin.
I tried to analyze the behavior of the reset and user switches using the schematic diagram, trying to figure out what the difference is between pressing the button, receiving the signal via usb/CP2102 and pulling the pins physically to ground. while studying the ESP32-S3 Datasheet, I found the following:
GPIO46
Since I had a signal on the GPIO46 pulled to high with an external resistor, The board couldnt enter boot mode via USB or user buttons while it was connected to my pcb.
Maybe it isnā€™t a good idea to mark GPIO46 as a freely available GPIO port. At least Heltec could post some information about this in their documentation.
EDIT: I am redesigning my hardware to not using GPIO45 & 46 but rather use GPIO6 & GPIO7 which are not used for other critical ESP32 functions.

2 Likes

Thanks for that! I was going to code test program for i2c. I had a sensor connected on pins 45/46. Disconnecting them got me past the upload issue.