ESP32 upload failure

Gilbert
Posts: 41
Joined: Wed Sep 16, 2020 2:58 pm

ESP32 upload failure

Postby Gilbert » Sat Feb 20, 2021 3:34 pm

Recently I started to see hick-ups when trying to upload my sketch to the ESP32 board. I had to try several times in order to get the job done. Now I'm dead in the water. Every attempt to upload ends with a long line of Morse code (....____.... etc) and the message "A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header".
Before that I had an upload failure while the upload was on-going. As a result (I guess) of the failed upload ESP32 is now constantly crashing. I doubt that the crashing impacts the upload - I've had crashes before, related to errors in my sketch and upload would still succeed.

I removed all resistors, LEDs etc. from the breadboard to make sure there is no interference with "forbidden" pins on the ESP32.

Board: DOIT ESP32 DEVKIT V1
Arduino: 1.8.13
Baud rate: 912600 (I tried lower baud rates, but no success)
COM driver: Silicon Labs CP210x USB to UART Bridge 6.7.6.2130 (manually installed the latest version, but made no difference)

Crash info (in case this means anything to anyone):
16:09:32.734 ->
16:09:32.734 -> rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
16:09:32.734 -> configsip: 0, SPIWP:0xee
16:09:32.734 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
16:09:32.734 -> mode:DIO, clock div:1
16:09:32.734 -> load:0x3fff0018,len:4
16:09:32.734 -> load:0x3fff001c,len:1044
16:09:32.734 -> load:0x40078000,len:8896
16:09:32.734 -> load:0x40080400,len:5816
16:09:32.734 -> entry 0x400806ac
16:09:32.968 -> ets Jun 8 2016 00:22:57
Is there a way to perform a "factory reset" of the ESP32, i.e. to re-install the bootloader?
I have simple scope (bandwidth 20 MHz). Is there anything I can check (e.g. on the CP2102) to see if the hardware is broken or not? Measuring directly on the CP is not an option as the pins are too close together, but maybe on the WROOM module? Those pins have a pretty decent spacing.

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 upload failure

Postby chegewara » Sat Feb 20, 2021 8:49 pm

This should not be needed, but did you try to enter download mode with buttons?

Gilbert
Posts: 41
Joined: Wed Sep 16, 2020 2:58 pm

Re: ESP32 upload failure

Postby Gilbert » Sun Feb 21, 2021 9:35 am

Yes, of course. That's the normal way of uploading. But now the device doesn't make the connection. When I press the button the crashing stops (I can tell because the led doesn't flash anymore and serial monitor stops producing crash data).
What's intersting is that I had to press the button only once or at most twice when the device was new. A few days before the device went into total failure I had to press several times to get the upload going. The button is ok. I checked continuity with my ohm meter.

Gilbert
Posts: 41
Joined: Wed Sep 16, 2020 2:58 pm

Re: ESP32 upload failure

Postby Gilbert » Sun Feb 21, 2021 10:20 am

Finally got it working again. In the past, just pressing the RST button did the job (well, until recently...). I now found in one of the espressif docs that I need to press the BOOT button and if that doesn't help, keep the BOOT button pressed and press the RST button as well. I'm pretty sure I read somewhere that pressing both buttons simultaneously must never been done (... unless you know what you're doing...).
Can you shed some light on this? Why was it working using the RST button i.s.o. the BOOT button (assuming this is not the right way to upload code)?

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 upload failure

Postby ESP_Sprite » Mon Feb 22, 2021 1:59 am

Normally, the way to get into the boot loader mode is to pull GPIO0 low (which pressing the BOOT button does) and resetting the chip (which pressing and releasing the RESET button does). Most devboards have some extra logic that allow these actions also to be done by some IO pins on the serial-to-usb chip. However, this circuit is a bit timing-sensitive and while it mostly functions, depending on drivers, existence of a VM, OS, component tolerances etc, it may not always work. There is nothing wrong with using the RESET and BOOT buttons manually if you need to.

Gilbert
Posts: 41
Joined: Wed Sep 16, 2020 2:58 pm

Re: ESP32 upload failure

Postby Gilbert » Mon Feb 22, 2021 9:32 am

Thanks a lot. Sounds like ESP32 boot/upload process is not very deterministic...

xiard01
Posts: 4
Joined: Sat Jan 14, 2023 10:04 pm

Re: ESP32 upload failure

Postby xiard01 » Sat Jan 14, 2023 10:15 pm

I seem to be having a somewhat similar problem with the Adafruit ESP32-S3 Feather. I attached to the device with a cable that I presume to be a data cable, because I was able to detect the device (COM7) and upload a single sketch to it (using the Arduino IDE). After that one success, I have been unable to upload to the device. When I unplug it and plug it back in, it powers and runs the sketch I loaded (blinking the on-board LED in an SOS pattern, so very recognizable). I can see it in the Arduino IDE and get board info.

When I try to upload, the board appears to go dead. I.e., all lights turn off. The IDE reports:

Code: Select all

Sketch uses 267985 bytes (18%) of program storage space. Maximum is 1441792 bytes.
Global variables use 26792 bytes (8%) of dynamic memory, leaving 300888 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.2.1
Serial port COM7

A fatal error occurred: Could not open COM7, the port doesn't exist
Failed uploading: uploading error: exit status 2
I have tried holding down the boot button while I upload. The behavior is exactly the same. As soon as the IDE starts uploading, the part seems to go "dead" (no lights).

I also tried pressing both reset and boot buttons. As soon as I hit reset, the lights on the board go off. At that point, while holding down reset, the part stops responding at all (connection lost), which is what I would expect.

Any suggestions for what else to try?

xiard01
Posts: 4
Joined: Sat Jan 14, 2023 10:04 pm

Re: ESP32 upload failure

Postby xiard01 » Sun Jan 29, 2023 4:36 pm

I figured this out. When I connect to the ESP32-S3 Feather it connects using one COM port. When ready to receive an upload it appears to use a different COM port.

* hold down the boot button on the board
* press the reset button on the board and release it
* all lights will be off on the board at this point
* check device manager and see what COM port the board is using
* select that COM port in the Arduino IDE
* select the correct board type. For me, the IDE appears to choose a random ESP32 board type each time and I have to reset it

Now I can upload to the board. Once the upload is complete, click the reset button on the board.

Who is online

Users browsing this forum: inF1704 and 77 guests