Software Reset Teensy without Re-enumerating USB serial?

I would like to be able to perform a software reset of a Teensy 4.1 while leaving the USB serial connected to an application on my host machine.

I have tried setting SCB_AIRCR = 0x05FA0004; and using a watchdog, but both seem to power cycle the Teensy causing my host machine to reassign a new com port while the host application is using the previous com port.

Is it possible to perform a less drastic reset and reboot the Teensy while the USB remains connected to the host application? Thanks!
 
USB is done partially in software. What this means is that any time the teensy reboots it will reset the USB stack and you will have a connection cycle. You would have to try to reset differently. One option (not perfect) is to simply call the setup function again. It sounds stupid but that will reset the code back to when you first got control of the hardware. At that point USB was already set up so it won't drop the connection. You would then re-setup CAN, serial, I2C, etc. But, of course, if you were using anything that does dynamic allocation and if you rely on global variables then these things will not have been reset. It may be possible to call the earlier functions that set up the teensy, perhaps even just after the code would ordinarily set up USB. But, this will be trial and error and you'd be wading through weeds and waist deep mud to get it working.
 
Back
Top