Hi Everyone,
Does anyone have any ideas about how to build a "press and hold for 10 seconds" reset circuit for the Arduino, kind of like you see on home routers? Obviously it would require a separate button than the reset button.
Thanks!
Hi Everyone,
Does anyone have any ideas about how to build a "press and hold for 10 seconds" reset circuit for the Arduino, kind of like you see on home routers? Obviously it would require a separate button than the reset button.
Thanks!
Can you do that with a capacitor and resistor. Choose the resistor so the voltage on the capacitor drains away slowly until it is low enough to cause a reset (or vice versa if reset needs a high).
...R
They do it by checking the button right after power on, so you'd check it in setup. If it's down, don't bother continuing setup yet, just go into a loop until 10 seconds go by or the button is let up. If you make it 10 seconds with the button still down, do your system reset thingy; otherwise continue setup and pretend it didn't happen or furiously blink an LED and force the user to reset it again.
If it's already running (in loop()) how would you get back into setup() without calling it again? I know you can't software-reset an AVR. Would a hardware-based reset circuit that is started by pressing the reset button work? I figure if it could reset the AVR on press (but not keep it in a reset state) then setup could just look for if the button is pressed since the user hasn't stopped pushing.
Ideas?
You can software reset by "jumping" to location 0 which is the RESET vector.
I'm aware of location 0x0000... The problem is that moving to the reset vector does not clear memory and previously set memory isn't guaranteed to be cleared which can result in unstable execution. The only safe way to reset is to do a hardware reset by pulling the reset pin low.
The C run-time start-up code will initialize everything that it initialized the first time, but yeah the CPU config registers won't be set to their power on defaults unless some kind of reset occurs. RAM is not initialized in any case by the hardware. A watchdog reset should take care of your concerns though and you can trigger that from software.
Ah, gotcha. Forgot about that. Sounds good to me. Except - what if something is messed up and memory has been corrupted and we can't rely on an interrupt or polling to trigger a WDT reset but the watchdog is still being serviced? I guess that would need external reset circuitry?
This has just come up on the Freetronics forum
http://electronicsfordogs.com/articles/self-resetting-atmel-atmega-328
It is now clear that, if you are using millis and have to have it running unattended for more than fifty days, you have to do something about resetting..........
Nick_Pyner:
It is now clear that, if you are using millis and have to have it running unattended for more than fifty days, you have to do something about resetting..........
Incorrect.
Please try to stay on-topic.