Mega reset from code

hi,

I'm running a project which on the board which is updating from the serial port of my machine. I have therefore disabled the auto-reset (i.e. I've connected the reset through a resistor to the 5v).

However I'd like the ability to perform a reset but ideally from code. i.e. I can call a php function which will then reset by a call to the arundio throguh the serial port.

So the question is, Is there anyway to force a reset on the board (i.e. some function i can call)?

thanks for your help!!

What did the searches of this forum tell you?

i'm probably using the wrong search terms. I have a lots of posts for hardware resets but not from software.

Do you need to physically reset the other chips as well, or just restart the program?

Unless you add hardware you can't do the first.


Rob

i'm probably using the wrong search terms. I have a lots of posts for hardware resets but not from software.

There is a reason for your search results. There is no true software reset available and there is seldom a valid reason for needing one. Usually it's just a matter of improving the structure of your program to not require a reset. The closest thing to a software reset is utilizing the internal watch-dog timer, however that feature does not have any direct support from the Arduino platform, and one needs to use much caution when using the big dog cause dragons nest there.

Lefty

thanks, i had a feeling that might be the case.

i'll be off to improve the structure of my program :slight_smile:

I've found that dereferencing a NULL pointer will reset my code. I found this out by accident and didn't want it :frowning:

I've found that dereferencing a NULL pointer will reset my code. I found this out by accident and didn't want it

I think you will find that it doesn't really 'reset' processor chip, it just jumps to the start of the setup function without resetting all the peripheral I/O and registers. Some have used your method but again usually just 'fixing' the structure of your program can eliminate the need for a 'reset'. Of course there is always the dreaded (but legal in C) goto statement, but that bring the older dragons down upon you for questioning the clans wisdom. :wink:

Lefty