Pages: [1]   Go Down
Author Topic: software reboot  (Read 633 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25770
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

"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.

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8472
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.     
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8472
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
 
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Pages: [1]   Go Up
Jump to: