Teensy 4.1 RTOS reboot into teensyloader.

PetervdPerk

New member
I'm running Zephyr RTOS on a Teensy 4.1 I would like to enter the teensy bootloader from software so I can flash it without pressing the button.

Is there a sequence somewhere on how to do this?
 
Any breakpoint opcode will do it:
Code:
asm("bkpt #255");

(or any other immediate value, it's not used)
 
Even though you could use 255 or any other number with today's bootloader, you should use 251 for future compatibility.

Look at the _reboot_Teensyduino_() function in usb.c at line 211.

For lockable Teensy locked into secure mode, a different sequence is needed. You'll also see it in that function.

You'll also see the USB code starts a timer when it receives the request, to call this function later. This isn't strictly necessary. The delay exists in the code because very old versions of Windows USB stack would crash if the USB port disconnected in the middle of a USB control transfer sequence.
 
Back
Top