Go Down

Topic: I have a silly question about Reset pin (the one next to 3.3v source pin) (Read 1 time) previous topic - next topic

shteii01

I want to do software reset to my Due board.  Here is the plan:
1)  Connect digital pin to Reset.
2)  Set one of the digital pins to HIGH in setup().
3)  When I need to reset the board, I set the digital pin to LOW.  The Reset is activated.
4)  The code starts over.

Would this work?

KirAsh4

I *think* it will work, but I would recommend some experimenting.  Keep in mind that when the board resets, all pins are tri-stated.  Make sure you have a pull-up on the reset, otherwise you may get into a nasty loop.

retrolefty

That method does not work on AVR atmega chips and is not recommended by Atmel as that method does not allow the reset signal to remain active (LOW) long enough to guarantee a proper reset as there is a minimum reset pulse width specification. Not sure if the same thing applies to the Atmel ARM processor chip.

Lefty

Grumpy_Mike

It is much more complex than that. The reset line can actually act as an output as well as an input. The reset can be triggered from software for a length of time determined by a register.


shteii01



some googling: http://arduino.cc/forum/index.php/topic,42205.0.html

void software_Reset() // Restarts program from beginning but does not reset the peripherals and registers
{
asm volatile ("  jmp 0"); 


Would the above work on Due?

Grumpy_Mike

Noah's I said it is more complex. You have to see te data sheet for the SAM 3 chips, here is a section
Quote
14.4.4.4
Software Reset
The Reset Controller offers several commands used to assert the different reset signals. These commands are performed by writing the Control Register (RSTC_CR) with the following bits at 1:
• PROCRST: Writing PROCRST at 1 resets the processor and the watchdog timer.
• PERRST: Writing PERRST at 1 resets all the embedded peripherals, including the memory system, and, in particular, the Remap Command. The Peripheral Reset is generally used for debug purposes.
Except for debug purposes, PERRST must always be used in conjunction with PROCRST (PERRST and PROCRST set both at 1 simultaneously).
• EXTRST: Writing EXTRST at 1 asserts low the NRST pin during a time defined by the field ERSTL in the Mode Register (RSTC_MR).
The software reset is entered if at least one of these bits is set by the software. All these com- mands can be performed independently or simultaneously. The software reset lasts 3 Slow Clock cycles.
The internal reset signals are asserted as soon as the register write is performed. This is detected on the Master Clock (MCK). They are released when the software reset is left, i.e.; syn- chronously to SLCK.
If EXTRST is set, the nrst_out signal is asserted depending on the programming of the field ERSTL. However, the resulting falling edge on NRST does not lead to a User Reset.
If and only if the PROCRST bit is set, the Reset Controller reports the software status in the field RSTTYP of the Status Register (RSTC_SR). Other Software Resets are not reported in RSTTYP.

cmaglie


No need to connect any pin, Grumpy_Mike solution is implemented here:

http://arduino.cc/forum/index.php/topic,152885.msg1150829.html#msg1150829

Code: [Select]

void Software_Reset() {
  const int RSTC_KEY = 0xA5;
  RSTC->RSTC_CR = RSTC_CR_KEY(RSTC_KEY) | RSTC_CR_PROCRST | RSTC_CR_PERRST;
  while (true);
}

C.

Go Up