Teensy2.0++ - Software Reset

Status
Not open for further replies.

a.angeletos

New member
Hello fellows,

I have an arduino board which is connected with a teensy2.0++ and they communicate over I2C.
What I want to do is to perform a Reset once a command is received (lets say via Serial). For the arduino board I found out
that one way to do it is to connect a wire between a digital pin and the reset pin of the board.
Bringing the pin low will cause the arduino to reset. Note that you must bring the pin HIGH at the beginning of the setup loop in order to avoid
a continues reset of the board. For more info you can have a look here (http://www.instructables.com/id/two-ways-to-reset-arduino-in-software/#step1)

My question is, if I share the digital pin which pulls the reset pin of the arduino to my teensy2.0++ reset pin will this work?
Will it reset both boards?

Thanks in advance,
Alex
 
There are 3 types of reset on Teensy 2.0 and Teensy++ 2.0, so the first question to ask is which type is right for your application.

Two of the resets are hardware-based: power-on reset and reset to bootloader. If you pulse the reset pin low, you'll get the reset to the bootloader. If you just want to make your program restart, that's definitely not the one you want.

The power-on reset happens only when the power comes up. To get this reset, you'll need to disconnect power, and also make sure no pin is driven with a voltage, which could unintentionally feed enough power into the chip through a normal pin to prevent it from fully powering down.

On Teensy++ 2.0, you can also get the power-on reset by driving the ALE pin high during and for a short time after applying a pulse to the reset pin. The ALE pin has a 1K resistor to ground, so normally it's always low (which causes the reset pulse to reset to the bootloader).

The 3rd type of reset is software emulated. This might be the best one for you? It tries to emulate a reset similar to Arduino Uno. On Uno, there are 2 separate chips, one running your code and the other doing the USB communication. But on Teensy it's just 1 chip. So when you reset the chip, the USB disconnects. To your computer, it looks as if the cable gets physically unplugged, then plugged back in when the chip reboots. If you want the USB to disconnect, then you want a hardware reset. But if you want the USB to stay connected (as happens with Arduino Uno's reset), the software emulated reset is your best option. It keeps the USB connected but restarts the software. It's not a true reset, but it's a pretty good software emulation of reset. It avoids the difficult problems that happen (especially with Windows) when you disconnect the USB while a program has the device in use.

To do the reset, just call the function _reboot_Teensyduino_() EDIT: actually _restart_Teensyduino_(). The reboot actually happens 15 ms after you make this call, so don't be surprised when it returns and your code keeps running briefly. Just add a delay after the function call.

If you want a hardware signal to trigger the software emulated reboot, you might use attachInterrupt() to run a function that calls _reboot_Teensyduino_() when the pin is pulsed low.
 
Last edited:
Sorry, but doesn't _reboot_Teensyduino_() jump to the bootloader? I thought _restart_Teensyduino_() did the software restart?

Or perhaps I'm confused?
 
Hello,

I'm a arduino lover and working with the arduino and arduino stater kits. In my one of the project, I tried to arduino reset*as like you described but my arduino project failed and given many errors. After that, I researched many arduino blog and forum. then I got the two best way to reset the arduino. First one is Arduino Reset Pin and second one is Arduino Reset Button. You can choose the best method according to you. You can refer the arduino software reset. this is the best guidance which I preferred. Surely, it will helps you a lot. Thanks.
 
Hi Paul,

How to restart the complete program in Teensy 4.0 using program or function ? Is there any pin on teensy4.0 which can be triggered to do so ?


There are 3 types of reset on Teensy 2.0 and Teensy++ 2.0, so the first question to ask is which type is right for your application.

Two of the resets are hardware-based: power-on reset and reset to bootloader. If you pulse the reset pin low, you'll get the reset to the bootloader. If you just want to make your program restart, that's definitely not the one you want.

The power-on reset happens only when the power comes up. To get this reset, you'll need to disconnect power, and also make sure no pin is driven with a voltage, which could unintentionally feed enough power into the chip through a normal pin to prevent it from fully powering down.

On Teensy++ 2.0, you can also get the power-on reset by driving the ALE pin high during and for a short time after applying a pulse to the reset pin. The ALE pin has a 1K resistor to ground, so normally it's always low (which causes the reset pulse to reset to the bootloader).

The 3rd type of reset is software emulated. This might be the best one for you? It tries to emulate a reset similar to Arduino Uno. On Uno, there are 2 separate chips, one running your code and the other doing the USB communication. But on Teensy it's just 1 chip. So when you reset the chip, the USB disconnects. To your computer, it looks as if the cable gets physically unplugged, then plugged back in when the chip reboots. If you want the USB to disconnect, then you want a hardware reset. But if you want the USB to stay connected (as happens with Arduino Uno's reset), the software emulated reset is your best option. It keeps the USB connected but restarts the software. It's not a true reset, but it's a pretty good software emulation of reset. It avoids the difficult problems that happen (especially with Windows) when you disconnect the USB while a program has the device in use.

To do the reset, just call the function _reboot_Teensyduino_() EDIT: actually _restart_Teensyduino_(). The reboot actually happens 15 ms after you make this call, so don't be surprised when it returns and your code keeps running briefly. Just add a delay after the function call.

If you want a hardware signal to trigger the software emulated reboot, you might use attachInterrupt() to run a function that calls _reboot_Teensyduino_() when the pin is pulsed low.
 
Status
Not open for further replies.
Back
Top