I want to reboot a Teensy 3.2 and a Teensy 3.5 (separately) from software.
There is a thread on how to do this using the watchdog. Unfortunately, this requires editing the .c files in the teensyduino installed files, which means that any other project compiled by the same installation now needs to kick the watchdog every so often.
Is there another way to, effectively, restart my code?
I don't actually need a full hardware power cycle; I would be OK with something similar to:
- clearing BSS to 0
- unpacking initialized data
- re-setting stack back to the beginning
- turning off interrupts and whatever else is needed for start to be happy
- jumping to code start
The reason is, I have a carrier board where the chip can pull its own power switch. This works great when powered from battery, but when powered from the USB, the power doesn't actually turn off when the battery switch turns off. For various reasons, I'd rather the code got rebooted, and I can catch this state after boot by reading the effective battery voltage.
There is a thread on how to do this using the watchdog. Unfortunately, this requires editing the .c files in the teensyduino installed files, which means that any other project compiled by the same installation now needs to kick the watchdog every so often.
Is there another way to, effectively, restart my code?
I don't actually need a full hardware power cycle; I would be OK with something similar to:
- clearing BSS to 0
- unpacking initialized data
- re-setting stack back to the beginning
- turning off interrupts and whatever else is needed for start to be happy
- jumping to code start
The reason is, I have a carrier board where the chip can pull its own power switch. This works great when powered from battery, but when powered from the USB, the power doesn't actually turn off when the battery switch turns off. For various reasons, I'd rather the code got rebooted, and I can catch this state after boot by reading the effective battery voltage.