I ran into a brownout on a custom board with an ESP32-WROVER-E-N8R8. Normal Wi-Fi station mode worked fine, but starting SoftAP directly from Wi-Fi off caused a reset. Adding 100 µF did not prevent it.
Startup sequence
3.3 V rail on the oscilloscope
Result
Figure 1 — Wi-Fi off → SoftAP
About 776 mV of voltage droop
Brownout reset
Figure 2 — Wi-Fi off → STA → enable SoftAP
Much smaller dips, with a 140 mV cursor reference
No brownout reset
Both captures use a time base of 40 ms/div. In Figure 2, the lower cursor sits slightly below the visible dips, so 140 mV is a reference for scale.
The sequence that worked on my board was to call WiFi.mode(WIFI_STA), wait for ARDUINO_EVENT_WIFI_STA_START, and then call WiFi.softAP(ssid, password) while Wi-Fi was still running. STA_START marks the start of station mode, so there’s no need to wait for a router connection before enabling the AP.
Changing the startup order was enough to avoid the reset on my board. I’m curious whether anyone else has measured a similar difference between direct SoftAP startup and enabling SoftAP after STA has started.
How did you power the board.
What was the drop on the 5volt pin.
I had similar problems with poor quality USB leads.
A software hack can't fix a poor quality supply.
You could have the same issue when the final code is running.
If the drop was also on the 5volt supply, then use a different USB lead.
If the drop only was on the 3V3 supply (unlikely), then add a ~470uF cap to that supply.
Yes, I’m aware that my power supply is not ideal. I’m powering the ESP32 through an nPM1300 power management IC, which cannot actually supply enough current (300 mA max, while the ESP32 may require up to 500 mA).
Wi-Fi was never part of the original design, which is why the power supply has been perfectly adequate for its intended application.
The reason I shared this observation is something else:
Apparently, the peak current demand during AP initialization can be reduced by approximately a factor of six, or at least shifted in time, simply by changing the Wi-Fi initialization sequence.
By enabling Wi-Fi in station mode first and activating AP mode afterward, the ESP32 works reliably even with my limited power supply, without triggering a brownout.
In my opinion, this suggests a shortcoming in the Wi-Fi stack's initialization sequence. If the same hardware can initialize the AP without excessive peak current simply by changing the software sequence, there seems to be room for improvement in how the Wi-Fi stack handles power consumption during startup.
The speed with which the initialization is completed is relevant here. The software is written for a properly powered board. That you found a workaround for the insufficient PSU is great, but power consumption is not the focus of the implementation.
In my opinion it's fine, but you could consider taking up the matter with the ESP32 Arduino core developers on github.
Current of an ESP32 is about 100mA during WiFi, but with short peaks.
That peak current draw of 500mA can be mitigated with a capacitor across the 3V3 supply.
A 470uF/6V3 tantalum capacitor can be as small as a match head.
Could you measure the supply rail at the module pins with a scope at the moment it fail, and share the regulator part number and the schematic around it ?