ESP32 crashes, how to fix it?
The ESP32 can crash for various reasons. The main ones are: power, interrupt and strapping pins. All of those and even more are covered in this article
Power supply problems
In my experience, most crashes are power related. The esp is quite power hungry and can draw short, but huge spices of current, especially while communicating over Wi-Fi. So if your esp works fine but crashes if you enable Wi-Fi, the crash is most likely power related. Another tell-tale sign of a power problem of a power problem is the console message "Brownout detector was triggered
"followed by a reboot of the device. But what can you do to rectify these issues? If you are using a breakout board, try using another, higher quality USB cable. If that does not work, try adding a capacitor to the 3.3V rail of your device. Any value form 10 - 1000uF should be fine, but note that sometimes more than one capacitor is needed.
If your console outputs something like "Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
", your problem might be interrupt related. Try disabling your interrupts and se if this fixes your problem.
Sometimes the esp does not boot up properly because some strapping pins are not connected right. If you are using GPIO 0,2,4,5,12 or 15, this might be the case: Please consult the article about the ESP32 Pinout
for more information about this.
If your console outputs something like "Task watchdog got triggered. The following tasks did not feed the watchdog in time:
" your program either looped for to long or you forgot to feed the watchdog timer
Most of the tips given here also apply to the esp 8266
If you find any errors or have a suggestion for new content, feel free to contact me at firstname.lastname@example.org