Firebeetle 2 ESP32 - changing from USB to Battery freezes software execution
I have a Firebeetle 2 setup with LiPo battery (always connected) and USB supply. The idea is, that on certain times of the day the USB power is on, while during the other times the battery takes over the power supply.
Everthing works fine so far, except on transition case:
Here is the behaviour:- powering by battery only: script works fine- powering by USB only: same, script works fine- powering first by battery w/ USB off, have the script run and during execution switch USB supply on: script continous fine Failure:- power first w/ USB on, have the script run and during execution disconnect USB (of course the battery is fully charged): the whole board crashes, needs reset button. After reset the script runs again with battery supply only.
I took an oscilloscope and monitored VCC. On disconnect of USB the voltage goes smoothly down from about 5V to about 4.0V. No peaks or drops in voltage.
I have also monitored 3V3. On disconnect of USB the voltage stays calmly constant, no peaks or drops.
Has anyone any idea, what's going wrong here?
Should I power the board by Battery only and have the USB only charge the battery? This would involve removing the two diodes…
Possible workaround: Is there a chance to reset the board (by HW), when power supply changes from USB to Batt?