I have been working on an issue for several days. I found a forum post that explains exactly what I am encountering: ESP32 Forum Topic 47197
Problem:
On initial start-up ESP32-S3-WROOM-1, after power supply has been removed for some time… it appears to boot in a stuck state.
If I manually click the reset button or unplug and re-plug the power supply, it boots correctly.
I found that I am able to replicate this quicker by unplugging the ESP32 and hitting the boot button several times and then plugging it back in. This will encounter the boot stuck state.
This is the explanation from the forum which explains it very well:
During the first boot after a manual power-on reset, everything works perfectly.
However, if the supply is removed for a long time (idle mode when the system is unused) and then reapplied, the ESP32-S3 fails to start correctly. The system appears stuck — the NeoPixel LED does not light up, the I2C bus is inactive, and the MCU does not execute any code.
Reason according to ESP32 Forum
There have been similar cases, see e.g. ESP32 Forum Topic 47172 or ESP32 Forum Topic 16141.
It seems to usually boil down to wrong RC circuits on the EN or BOOT strapping pin. When the capacitors are discharged after a ‘long’ time w/o power they take too long to charge when power is first applied and prevent the ESP from booting normally. After a short time on power the caps are charged to the correct voltage and a manual reset then leads to a successful boot.
My Question
Is there any way to resolve this in ESPHome? If I have an extended power outage, I want the ESP32 to be able to recover.
It is very difficult to find any one with this issue.
Edit: I am powering the ESP32 with a HiLink HLK-10M05
I believe the issue only occurs when powering thru the 5V terminal on the ESP32. When using USB-C it is not occurring.
If problem is power supply, quite difficult to resolve on your esphome code.
You should get some proof though. Esphome logs over usb could be first step.
That creates completely different situation. Esp boots way faster than your network…
I tried another power supply and the same issue persists. When the initial boot is stuck, no logs are available using Esphome. Unless there is another option I can do.
I have created this code to run independently of Home Assistant. My network is not needed.
I have also confirmed that powered 5V thru USB-C still encounters the issue.
Read carefully. Question is if esphome is running or not. Completely different argument if esphome is connected to any wireless network or not.
Use usb-logging or code your esp to blink a led.
With power supply I mean the whole chain from PSU down to esp32 3.3V rail, not just some external plug. Bad supply design on esp32 board can cause problems as well.
Not related/resolvable to/on esphome.
Also bad/incorrect wiring can cause boot problems.
You are trying to see if it even gets as far as to boot to esphome?
If so, when it is in the “stuck” state, I am unable to get any logs. I pulled the 5v pin on a USB cable and gather logs that way. Nothing is visible during this issue.
Understood, you are thinking a board issue. I believe this may be the problem. I have 2 of the ESP32-S3 DEV boards. 1 with the ESPRESSIF logo on the ESP chip and one without it. The one with the logo is the one that is giving me issues.
I just swapped it for the “off” model and I will let it sit to see if the issue occurs.
I do not believe there is a software solution for what you describe. Using the recommended RC circuits on EN and BOOT and/or using a different brand of power supply. The could be a problem with the 3.3V regulator. If you have another ESP32, does it always boot?
I was having a similar problem with ESP8266 and Tasmota. I monitored the serial port with an isolated serial to USB adapter. Isolated because at boot the USB glitched and my terminal emulator (PuTTY) disconnected. Sure enough, it just stopped during the boot process. Reloading Tasmota, resetting the configuration and manually (not with backup) reconfiguring fixed the problem. OK, not ESP32 and not ESPHome, but worth a try.
I am not familiar with using RC circuits on EN and BOOT but I did use a different brand power supply already. It did not resolve it. I tried powering thru USB-C and same boot issue occurred.
I appreciate the advice, I’m ok with tossing the original board because there is clearly an issue with the construction of it.
Solution:
I was able to try another ESP32-S3 dev board from a different vendor and it booted successfully every time!
There must be an issue with my original board I used that’s described here: ESP32 Forum Topic 47197