Confusion about EN and BOOT0

derveroonibo
Posts: 2
Joined: Mon May 06, 2024 9:44 am

Confusion about EN and BOOT0

Postby derveroonibo » Mon May 06, 2024 10:02 am

Hello,
in the ESP Docs there is a Boot Mode Selection guide. This states that EN needs to be pulled low. Then the boot0 pin is pulled to select either bootloader mode or run mode.
The ESP32 will enter the serial bootloader when GPIO0 is held low on reset. Otherwise it will run the program in flash.
I hooked up a logic analyzer to my ESP32 and observed the EN and Boot0 Lines upon flashing via Arduino IDE.
Here it is very cleary visible that EN is pulled low while boot0 is high. Then EN goes high again. Only after this boot0 goes low. Meaning the logic described in the guide is not correct. The boot0 pin goes low about 0.1 ms after EN goes high. An image is in the attachments.
How is this explainable? Why does the esptool not set the lines correctly yet it still works? Is this fixable somehow? I need a boot0 in the correct level while EN has the rising flank.
Attachments
logic_esp_boot.png
logic_esp_boot.png (13.87 KiB) Viewed 1091 times

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

Re: Confusion about EN and BOOT0

Postby ESP_Sprite » Mon May 06, 2024 10:37 am

Could be a measurement issue. There is a RC network on the EN line (making the signal effectively analog) and the logic level threshold on that pin is a bit weird, probably different from the logical analyser. If you have an oscilloscope, I'd stick that on it.

MicroController
Posts: 1701
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Confusion about EN and BOOT0

Postby MicroController » Mon May 06, 2024 11:41 am

IIRC, taking EN high starts the MCU, which then runs the ROM bootloader, which in turn reads the state of the BOOT pin to determine what to do. So it is safe/recommended to pull the BOOT pin low before pulling EN high, but a small delay (millisecond or so) between EN going high and BOOT going low may also still work as long as BOOT is low when the bootloader actually reads its state.

Or, I may be mistaken: https://esp32.com/viewtopic.php?t=31363#p107753

User avatar
ok-home
Posts: 78
Joined: Sun May 02, 2021 7:23 pm
Location: Russia Novosibirsk
Contact:

Re: Confusion about EN and BOOT0

Postby ok-home » Mon May 06, 2024 12:13 pm

straping.JPG
straping.JPG (58.74 KiB) Viewed 1034 times

derveroonibo
Posts: 2
Joined: Mon May 06, 2024 9:44 am

Re: Confusion about EN and BOOT0

Postby derveroonibo » Tue May 07, 2024 6:39 am

Thanks for the replies.

I also looked at the levels using the analog channels. It is the same result.

Makes sense that it works if there is a 1 ms delay to read the pin though. The delay shown is only 0.1 ms.

I can use a different solution to my problem that works in both cases.

Who is online

Users browsing this forum: Google [Bot], TRUEcabbage and 64 guests