Power on without reset
I'm working on a project that requires me to seal all of the electronics inside an enclosure. It then needs to wait without turning on until a later date. I wanted to accomplish this by putting a magnetic reed switch (normally closed) in line with the battery so that I could just remove a magnet to start the system. I set this all up and it seems to work well to kill power to the system, but when I try to start the system after power has been removed I'm unable to get the LoPy (Lopy 4 with an expansion board) to turn on unless I physically press the reset button.
Is there any way around this?
It seems connecting P8 to 3V3 solves the issue (or an issue which is similar to yours, at least). Don't ask me why.
@elizar No dice with the RC circuit. I'm still doing some investigation, but it doesn't seem like the single rising edge is enough here.
@paloma Don't worry. In years of silicon design we never made a chip that would look for both edges. And I don't know anyone who would build such a thing.
But it's always a good idea - for any digital circuit - to care for a reliable reset signal.
What happens to a microcontroller core when the the power supply bounces is that parts of the chip start working while others are still in the reset procedure. When you design a chip you normally know nothing about the later board environment. Therefore the circuitry on the chip is made in a way that it will start/operate perfectly under optimal conditions. Here that means: when the power is switched on it jumps from 0V to 5V in zero time and behaves like an ideal voltage source.
In the real world nearly every controller has a kind of "startup circuitry" (sometimes integrated in the chip) that holds the core in the RESET state for a while until power is up and ready. PCs power supplys even have a separate signal wire for the POWER_GOOD signal.
@elizar My only concern is that the Lopy might be looking for both a falling edge and a rising edge to combat false resets. This RC circuit would only produce a rising edge upon plugging in the battery. The easiest solution would be to just test it out though so I'll report back after giving this a shot.
@jcaron I haven't been able to find another thread talking about this. If you can remember some search terms that might send me in the right direction I'd really appreciate that.
@paloma Exactly. A simple circuit to hold the reset pin LOW for a few milliseconds. A capacitor between RESET and GND and a resistor from RESET to +3V3 (available at pin 26 @ Gpy; please check the pin number for LoPy).
Start with short times (t=R*C: 1 uF capacitor x 100 kOhm resistor = 100 ms, roughly) because a too long stretched RESET signal may also cause problems.
If you use the Vin voltage (+5 V) with a large resistor like 1M, there will be a permanent small current of about 0.5 uA into the RESET pin. That will not harm the chip but causes an additional load to your battery.
@paloma I understand there’s an issue with the Expansion board 3.0 that prevents booting when running on battery.
I believe there’s a simple fix involving a connection to make or a resistor to add somewhere. You should find the details in another thread on the forum.
@elizar Just to clarify to make sure I'm following, you're suggesting a resistor and capacitor between the reset pin and the Vin pin?
@paloma Maybe a simple R-C combination at the reset pin would do the trick to compensate for the bouncing of the magnetic switch?
I have a similar issue with the wipy/pysense. Removing the power for a certain amount of time locks up the device in an unresponsive state you can only leave via a reset button press. I'll add a supply supervisor generating a proper reset in case of power fail.
Many (most?) processors will lock up if power supply startup/shutdown does not follow a defined (read: fast enough and going all the way up to/down to 0 V) slope. I even once had a case where a battery powered device hung up when the battery was removed for like 5 s. The voltage would drop slowly during that time, but not low enough to guarantee a proper restart. In this case, it was not recoverable, even by a power on reset.
I have not yet tried if the supervisor approach works (still waiting for the part to arrive), it will help but I would not be surprised if in some cases a lockup would occur.