Uploading code to ESP32 through serial suddenly stopped working

Nygmaquest
Posts: 4
Joined: Sun Oct 10, 2021 2:36 pm

Uploading code to ESP32 through serial suddenly stopped working

Postby Nygmaquest » Sun Jan 15, 2023 2:17 pm

Hello,

I created a simple breakout board for ESP32 module, it's just the module itself with some filtering caps on power rail and hooked it up to my FTDI uart to serial converter like so
RX -> TX
TX -> RX
GND -> GND
3.3 -> 3.3V

Then yesterday I tried uploading a simple blink sketch with serial print to the ESP32 module, while the arduino ide was connecting to the ESP32 i connected pin0 to ground and tapped the EN pin to ground. To enter boot mode. It worked without any issues and the code uploaded. I did this several times.
Today, when I tried uploading code once more it just... doesn't work anymore for some reason.
If i do nothing with EN and boot pins I get "Failed to connect to ESP32: No serial data received."
If i ground BOOT and tap the EN pin to ground, like before when it worked, I get either that same error or this one " Failed to connect to ESP32: Wrong boot mode detected (0xb)! The chip needs to be in download mode."
I don't understand why it stopped working, when I didn't change anything.
I tried rebooting my computer but that didn't help.
To make 100% sure it wasn't the FTDI module or its drivers, I swapped it for arduino UNO and tired using it (the UNO) as a serial programmer instead, with exactly the same results.

I know the ESP32 module itself isn't dead because the sketch I uploaded to it yesterday is working just fine and blinking the led, and if I open the serial monitor in Arduino IDE i can see the Serial.print() messages the ESP32 is printing into it.

I noticed that when I pull boot to GND and then tap EN to gnd to cause reset, the serial monitor starts outputting this over and over again:
11:46:45.002 -> rst:0x10 (RTCWDT_RTC_RESET),boot:0xb (HSPI_FLASH_BOOT)
11:46:45.002 -> flash read err, 1000
11:46:45.002 -> ets_main.c 371
11:46:45.378 -> ets Jun 8 2016 00:22:57

I'm not sure if that is supposed to happen or not. Once I disconnect BOOT pin from GND it just starts executing the code normally.


Attached image are the only components connected to the ESP32 apart from the programmer itself. (The R5 is actually 200ohms)
Attachments
Clipboard02.jpg
Clipboard02.jpg (29.15 KiB) Viewed 6279 times

Nygmaquest
Posts: 4
Joined: Sun Oct 10, 2021 2:36 pm

Re: Uploading code to ESP32 through serial suddenly stopped working

Postby Nygmaquest » Wed Jan 18, 2023 5:23 pm

Any ideas from anyone?

I don't really need to save that one esp32 wroom, I can just toss it, but I am very curious about what caused this bootloader failure.
I pulled a fresh pcb and soldered another esp32 to it and so far the serial code upload is working fine, so hopefully it stays that way, because now I'm paranoid that I will accidentally kill another esp (well not kill, just break the bootloader making me unable to upload new code), since I have no idea what went wrong in the first one.
Could perhaps brownout during a code upload, or interrupting the code upload cause the bootloader corruption?
And just to note, it's not me being dumb and not putting it into boot mode correctly, I use esp32 modules all the time (ground BOOT, ground and release EN, to enter boot mode and this is the first time this has happened)

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

Re: Uploading code to ESP32 through serial suddenly stopped working

Postby ESP_Sprite » Thu Jan 19, 2023 1:51 am

boot:0xb (HSPI_FLASH_BOOT) can be a hint: that points at some strapping pin that's not at the right level. Suggest you check those.

Wrt corrupted bootloader: on ESP32 chips, the bootloader is in mask ROM, so aside from physically damaging the chip, there's no way to corrupt it.

Nygmaquest
Posts: 4
Joined: Sun Oct 10, 2021 2:36 pm

Re: Uploading code to ESP32 through serial suddenly stopped working

Postby Nygmaquest » Thu Jan 19, 2023 9:11 am

ESP_Sprite wrote:
Thu Jan 19, 2023 1:51 am
boot:0xb (HSPI_FLASH_BOOT) can be a hint: that points at some strapping pin that's not at the right level. Suggest you check those.

Wrt corrupted bootloader: on ESP32 chips, the bootloader is in mask ROM, so aside from physically damaging the chip, there's no way to corrupt it.
Well.... turns out I am stupid after all. :roll:
I remembered I soldered few pull up 10k resistors to the pcb, checked the pin definitions again, and sure enough, I had 10k pull up on gpio 2 which needs to be low to enter BOOT mode.
I removed the resistor and it started working.

Thank you

Who is online

Users browsing this forum: mike_dawes and 75 guests