3

Following on from the question Reset an Arduino UNO by an command (software) and the excellent answer provided by mpflaga, the comment addressing option (1) suggests that there are design considerations for connecting an output pin to the RESET pin.

Option 1. or a variant can be a clean enough way to do this as long as power on transient conditions are designed for. - Russell McMahon

or more ominuously

From everything I've read, the first option is not recommended. - sachleen

Could someone tell me exactly what those considerations are? Is it that it is not as simple as connecting the two with a jumper cable - is additional circuitry (i.e. an RC timer) required, or is there a software solution?

I find the latter option unlikely as the device is rebooting, so unless the software fix is to ignore hardware interrupts (since a RESET is simply that, and the state of the output pins is unlikely to be known, or stable at reboot) for a few mS after reboot, I presume that a hardware fix is required.

1
  • 1
    An external driver, such as a simple monostable circuit (555 timer, if a little inelegant) could be constructed to pull the reset pin low for the right amount of time when triggered by the uC. However, you are far better off with Nick Gammon's software-only solution. Jul 13, 2015 at 22:11

1 Answer 1

7

Atmel specifically recommend against driving /RESET low from an output pin, because the first thing that the reset process does is set all pins to high impedance, thus cancelling the reset pulse before the recommended reset pulse length has elapsed.

The recommended use of the watchdog timer does not suffer from these limitations. It is designed to reset the board (or there would be no purpose to having it) and it does a proper reset (unlike jumping to address 0x0000).


Reference

Atmel knowledge base - Software Reset

If you want to perform a software reset of your AVR you should use the internal Watchdog. Simply enable it and let it time out. When the Watchdog triggers it resets the program counter back to 0, clears all the registers and performs all the other tasks. This operation gives the same result as pulling the RESET line low.

You should not try to:

  • Use another pin of the AVR to pull the external RESET line. The pins of the AVR are tristated halfway through the minimum reset time, this releases the RESET line and hence nothing happens.

  • Jump to program location 0. Jumping to program location 0 does not clear all the registers and hence you do not have a "clean" reset.


Their suggested code to reset the processor:

#include <avr/io.h>
#include <avr/wdt.h>

#define Reset_AVR() wdt_enable(WDTO_30MS); while(1) {}

int main(void)
{
Reset_AVR();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.