How do I reset the processor in software? Is there a reset() function to call, a register bit to set, etc? I wish to reset the processor and any hardware, essentially causing a reset like a power-on reset. If there's not a way, I wish to reset the processor and both USB cores. Thanks.
In case you want to know why I want to reset, I have a long story
I'm trying to emulate some USB device with my teensy 4.1. The feature I'm trying to develop is for teensy to change what USB device it emulates without reprogramming and hopefully without resetting. Say it starts off not emulating any USB device. But if a button labeled "KYBD" is pressed, teensy will initialize usb device side to emulate a keyboard. Then if another button labeled "MOUSE" is pressed, teensy will detach from USB and reattach as a mouse, or maybe detach and reattach as a composite device with both keyboard and mouse. In order to do this, I must find where usb_init() gets called and whether it is possible at all to reset usb hardware and software so I can reinitialize with a different set of descriptors and functions.
I'm digging into the startup sequence and I found where teensy 4.1 initializes the USB device hardware, which is in ResetHandler() towards the end, before calling main() which calls setup() then loop(). In case I can't find a way to properly detach USB device side and reattach as a different device, I'd like to cause the board to reset.
In case you want to know why I want to reset, I have a long story
I'm trying to emulate some USB device with my teensy 4.1. The feature I'm trying to develop is for teensy to change what USB device it emulates without reprogramming and hopefully without resetting. Say it starts off not emulating any USB device. But if a button labeled "KYBD" is pressed, teensy will initialize usb device side to emulate a keyboard. Then if another button labeled "MOUSE" is pressed, teensy will detach from USB and reattach as a mouse, or maybe detach and reattach as a composite device with both keyboard and mouse. In order to do this, I must find where usb_init() gets called and whether it is possible at all to reset usb hardware and software so I can reinitialize with a different set of descriptors and functions.
I'm digging into the startup sequence and I found where teensy 4.1 initializes the USB device hardware, which is in ResetHandler() towards the end, before calling main() which calls setup() then loop(). In case I can't find a way to properly detach USB device side and reattach as a different device, I'd like to cause the board to reset.