hi guys i have a problem, i must reboot arduino via software but if some funtcions are running after the reboot they must be active
Why must you reboot the Arduino via software? Also, the definition of reboot is that everything begins from scratch. So of course no functions can continue to run. Please explain what you really need, and why you think you need it.
I need a function that must continue polling data from a port and I need it to keep running even if I restart the Arduino. I'm doing a school project and I have to use the Arduino and the ethernet shield to communicate with clients connected to the board.
That doesn't answer the question, why must you restart?
Have you ever used the reset button on your pc? Or on a server? That's why I need it, it happens that you have to restart or reboot a machine for reasons.
it happens that you have to restart or reboot a machine for reasons.
If you are watching a you-tube video, and listening to some music when the need to reboot arises, do you expect that the video will resume playing after you reboot? Do you expect the music to start playing again? THAT is what you are asking for. It doesn't happen on the PC. It won't happen on the Arduino.
Have you ever used the reset button on your pc?
Yes. The Arduino has one, too. Learn to use it.
The arduino is inside a box and my task was to reboot it via software, the arduino may have a reboot button on it but I'm kinda sure you don't have a brain inside your head if you are answering someone asking even stupid question with such tone. Still thank you for the help, I'll try to do it another way ![]()
You reboot a PC or server using the reset button if it no longer responds. I guess the same applies to the Arduino; which means that your software reset function also will not work.
Assuming the need to reset is not very urgent so you have the time to do the software reset, keep a table in eeprom of all functions that need to be started and all their parameters.
I think that for a 328 based micro, you can jump to address 0 to force a reboot. A better option however might be the use of the watchdog timer. In your code you keep kicking the watchdog; if for some reason your code 'hangs' and the watchdog no longer gets kicked, it will force a reset after a given time.
BTW the last time that I had to use the reset button on a PC / server was looooooong ago.
sipti:
The arduino is inside a box and my task was to reboot it via software, the arduino may have a reboot button on it but I'm kinda sure you don't have a brain inside your head if you are answering someone asking even stupid question with such tone. Still thank you for the help, I'll try to do it another way
Be very, very careful.
Afaik, you only reboot a pc if there is wrong that needs fixing. You shouldn't need to reboot a PC because it locks up, it shouldn't lock up. SAme thing with an Arduino.
The great thing about an Arduino, is that it's programming is much much more simpler than a PC running multiple cores of processors. The problem with your code should be easier to solve.
You might not have the aptitude to do it yourself, that's ok as long as you have the attitude to do it. Oh, wait.
sipti:
I need a function that must continue polling data from a port and I need it to keep running even if I restart the Arduino. I'm doing a school project and I have to use the Arduino and the ethernet shield to communicate with clients connected to the board.
What you are describing is very common in embedded systems, making the system tolerant of unexpected resets. Good luck ever making anything that goes in a car or airplane or medical device or utility switchgear or just about anything important without designing in tolerance to resets.
I need a little more information about what you're doing, however. If you sketch currently powers up and starts polling data, upon reset it's going to go right back to powering up and polling data. What is it you need to make sure happens properly upon a reset? Does it need to maintain a specific polling period or something? Remember an address where it's sending the data?
There is a big difference between an arrangement that automatically restarts an Arduino if the program crashes and an arrangement that deliberately causes a reset while the program is running properly.
The watchdog timer (WDT) is there to deal with situations where the Arduino code stops running properly.
You should NEVER need to cause a reset while the program is running properly.
You CANNOT cause a software reset if the program is not running properly.
And another situation is where the Arduino restarts after a power failure - but that is the same as any normal start.
...R
If you have anyway of letting the Arduino know it hanged you can use an resistor (I can't remeber the value, but you surelly can find it here in the forum) from an input pin to the reset pin to make it auto reset. Or you could use the arduino watchdog (as already mentioned).
Other then that you should provide your code if you really expects more help.
Hi,
hi guys i have a problem, i must reboot arduino via software but if some funtcions are running after the reboot they must be active
What functions are running after reset?
I think the OP needs to distinguish between a HARD RESET and a SOFT RESET,
The question is what situation needs what sort of reset.
If it is a Hardware lockup or POWER UP, then its a HARD RESET. This is not possible from software, cos software will not be running.
If it is a Software loop or some DETECTED software problem, then a SOFTWARE RESTART is needed.
As the OP describes it, he/she knows that a RESET is needed so software must still be running.
Some involved programming is needed to continually update data and program status to memory so that a software restart, not hardware restart, can be made.
Tom.... ![]()