Go Down

Topic: software reboot (Read 704 times) previous topic - next topic

Quimby

Hello, Sometimes my program has problems and needs to be reset or rebooted. How can I do this in a sketch?
Thank you.

Nick Gammon

Do you mean you want to reboot it programmatically (by a function call)? Or have it reboot if things go wrong and it stops functioning?
http://www.gammon.com.au/electronics

AWOL

Quote
Sometimes my program has problems and needs to be reset or rebooted. How can I do this in a sketch?

How about fixing the "problems", rather than putting a sticking plaster on them?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Graynomad

You can do

asm ("jmp 0");

It's not a hardware reboot but will restart the code.

But as AWOL said, fix the probems, rebooting should never be the answer unless you're using a watchdog timer in a critical enviromnent and there's just no way to recover.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Quimby

Hello Greynomad,
Thanks for something constructive! I have a program the writes log info to an SD card. Sometimes it runs for days without problems. I start a new log file every day. I check the FreeRam() and it is about 300 (if it gets too low there are problems) before and after the write to the SD card. I write to the log once a minute. The log files are about 180kb per day. I flush and close the file after each log. I display the size of the log file after I write to it. Sometimes the log file does not get larger. If I press reset it will start working again. Once the program goes through it's loop a few times the freeram stays the same for days. I just want to check the log file and when it stops getting larger for several cycles restart the cpu.  Thanks for the reply, I'll try it.     

Graynomad

It sounds like you're having a go at finding the problem and these things can be a real bugger to hunt down.

Another thing to do is dump all the variable when you discover the problem.

There isn't a nearby pool pump or something that fires up every day is there?

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Go Up