How to self_reset arduino

Hi

Is is possible to reset the arduino using a software command?

Regards

Yes, by using watch dog timer functions (WDT).

Would you post an example?

Check here in the Playground

casemod:
Would you post an example?

Is Google broken?

Half a million hits.

Half a million hits.

I wonder how many of them say "Fix the real problem. Resetting the Arduino is not the real solution"?

Right, I was asking about the watchdog option.

I know I can reset using the Watchdog if the CPU hangs, for example, but I would like to know how to send a command to restart the application back into the bootloader.

Most Google hits return a hardware solution, which is discouraged by Atmel. What happens is that at reset the pins go into tristate mode which stops the reset condition, and quite possibly leave the chip in an uncertain "half-reset" state.

PaulS:

Half a million hits.

I wonder how many of them say "Fix the real problem. Resetting the Arduino is not the real solution"?

What problem? Did someone mentioned a problem with the code? I have the Auto-reset disabled since I don't want the chip to restart each time I start a serial connection. Therefore I need to send a command that resets the chip just before code upload.

Therefore I need to send a command that resets the chip just before code upload.

So, how is the code running on the Arduino supposed to know that you are about to upload new code?

I have the Auto-reset disabled since I don't want the chip to restart each time I start a serial connection.

I would have done that in a reversible way, with a switch. But, then, I'm different I guess.

Thanks Paul,

That’s a good guess, sadly i plan to operate the module using a bluetooth dongle. in a not so accessible location

Here are my observations:

I managed to get the chip reset using the classic way. Just toggle a pin low.
On this case, instead of directly driving the reset pin I am actually using a 555 to held the reset low for 100ms.
I would like to have a simpler solution, but still reliable.

As for how the arduino knows i am sending code:

I have a script that checks the serial port once a second. If a given character is found it writes to the flash.
At power up the value is read again and if set the chip resets again. At this point the compiler just picks up, re-flashes the memory and the bit is cleared so the chip will work normally until I send another programming request via serial.