How to Reset/Restart Teensy 3.5 using sotware

jimmie

Well-known member
Hello,

This is my first Teensy 3.5 project.

How can I reset/restart the Teensy via software? I wish to code a scenario where if it happens, I want the program to restart (i.i. emulating pressing the button on the Teensy).

Thanks.
 
I realized this only works within the IDE which makes it useless.

If _reboot_Teensyduino_(); is done during runtime, the Teensy reboots but never starts again .....

Any help with this?
 
I tried this instead and it works. This is from:

//https://forum.pjrc.com/threads/24304-_reboot_Teensyduino()-vs-_restart_Teensyduino()

#define RESTART_ADDR 0xE000ED0C
#define READ_RESTART() (*(volatile uint32_t *)RESTART_ADDR)
#define WRITE_RESTART(val) ((*(volatile uint32_t *)RESTART_ADDR) = (val))


Then to restart, use the following:

WRITE_RESTART(0x5FA0004);
 
I realized this only works within the IDE which makes it useless.

If _reboot_Teensyduino_(); is done during runtime, the Teensy reboots but never starts again .....

Any help with this?

As you figured out, 'reboot' puts teensy into 'bootloader' mode or 'boot/download SW from PC' and not restart mode.

@Paul if he read this; realizing the repeating question on (HW/SW) 'reboot' and 'restart', maybe it is time to change terminology.
After all, the overwhelming majority of users say 'reboot a PC' to restart the computer. That this reboot involves bootloading the firmware first is less important.
 
@Paul if he read this; realizing the repeating question on (HW/SW) 'reboot' and 'restart', maybe it is time to change terminology.

These weren't really meant to be a public API. Changing these long-established internal names is pretty much the lowest priority thing I can imagine (just to be honestly realistic....)
 
Anyone know if this would work for Teensy4.1, I'm guessing not in which case is there a way to re-start a T4.1 from code.
 
Back
Top