Use this tag for discussing resetting the processor.
What happens at reset
When a processor is powered on, it goes through a "reset" process, which means that:
- The hardware is set to a defined initial configuration (eg. all pins to inputs)
- The program counter is set to either address zero (the start of your program code), or the address of the bootloader code, depending on how the processor fuses are set.
- The program then starts running.
How does a reset occur?
Resets can be caused by:
- Powering on the chip
- Pressing the reset button (this brings the
/RESET
pin low, which resets the chip) - Bringing the
/RESET
pin low by other means (eg. another chip forcing/RESET
low) - The watchdog timer timing out, if it is configured to do so, and if it is configured to reset the processor when it times out
- A brown-out (low-voltage) condition being detected, if configured to do so
When does the processor start?
If the reset was caused by the /RESET
pin going low, the processor starts a defined time after the /RESET
pin goes high again. This time depends on various fuse settings.
In addition, for a power-on reset, the processor is also designed to wait for a certain time (depending on the fuse settings) to allow any external crystal to come up to speed.
Can you make a software reset?
Some people claim that jumping to the reset address (address zero) "resets" the processor. This is not true, because the hardware has not been reset. All that does is restart the code running.
Another method some authors suggest is using an output pin to bring
/RESET
low. This is also not recommended, as one of the first things the reset sequence does is make all the pins high-impedance (input) and thus the/RESET
pin is not held low long enough.The only reliable way of doing a software-initiated reset, as recommended by Atmel, is to set up the watchdog timer, and then allow it to time-out and invoke a proper hardware reset.