I’ve noticed with my recently purchased M1, that when I have a battery in, and USB power source connected, when I switch between the two power sources while the M1 is running, sometimes the M1 continues to run uninterrupted, and sometimes it re-sets. I haven’t been able to figure out the logic behind when it continues and when it re-sets. It seems to be random. Is there any logic to it that I’m unaware of? What is it supposed to do when switching power sources with both available?
well, you probably should not have both power supplies connected at the same time (battery and USB). Whether or not the device resets is just a random function of how quickly you switch between the two power sources plus how much instantaneous power the device is drawing at that instant. If it draws enough power to quickly drain the power so that the microcontroller goes into low-voltage reset, then, the device will reset. So, its a combination of a few random events in sequence that follows no particular logic.
But that is sort of like switching rapidly between forward and reverse gear on a parked car: Its not designed to do that, and engineers try to make it difficult for people to hurt themselves or their car, but switching power (in this case: gearbox direction) quickly will sometimes have unpredictable consequences.
My advice: try not to do that too often.
Yikes! I didn’t realize that was to be avoided. I’ll make sure not to have both in place at the same time. Thank you!
It is probably OK because I specifically designed around that possibility, which for example is why the switch needs to be in opposite positions to power from battery versus USB. This is a safety measure to prevent simultaneous dual powering, which is at different voltages (5.0 versus 3.7) so it would be potentially destructive if not engineered against.
A couple years ago, I noticed the switch direction changes based on power source - it is super cool to now understand the design reason. Another amazingly detailed, awesome engineering implementation by @Bob