Teensy loader cli with rawhid device

Not open for further replies.


Hello all,

Is there a way to used the Teensy loader cli with a rawhid device that does not require pressing the reset button?

Currently I can use the cli like this to reprogram my board:

$ ./teensy_loader -mmcu=mk20dx256 -w -s program.hex

This works great except I have to press the reset button every time. This is fine for for development.

The problem is my Teensy is not really accessible when I use it in my device. I have to completely disassemble the device whenever I want to update it.

Just for more information. My Teensy shows up as VID 0x16c0 PID 0x0486 when my program is running. In the teensy loader code it appears to only deal with these devices:

teensy_open() - VID 0x16c0 PID 0x0478
hard_reboot() - VID 0x16c0 PID 0x0477
soft_reboot() - VID 0x16c0 PID 0x0483

I'm running the Teensy loader cli under Linux so the soft_reboot() should work. But it appears to only work with the PID 0x0483 device. I can add the necessary support code to my program by I'm not sure what is needed for the soft_reboot() to work with the PID 0x0486 device.

Is there a way to used the Teensy loader cli with a rawhid device that does not require pressing the reset button?

Yes, there are actually 2 ways.

The software only way would involve first running "teensy_reboot -s". You can find this utility in the hardware/tools folder within a copy of Arduino that has Teensyduino installed. On Windows, the default Arduino location is C:\Program Files (x86)\Arduino. On a Mac, control-click Arduino and "Show Package Contents". Then look for "hardware" in Contents/Java.

The hardware way, which involves buying another Teensy 2.0, is extremely reliable and recommended if you're doing something highly automated like a CI server. Program the Teensy 2.0 with the rebootor.hex file, then wire to the Program pin on the Teensy you wish to reboot. Run teensy_loader_cli with -r to tell it to use this 2nd board to auto-reboot the main one. While this does have the downside of more hardware, it's by far the most reliable way. If you're writing a script that will run unattended and occasional problems due to being unable to reboot a crashed board will cause great headaches, this extremely reliable way may be worth the extra hardware cost.
Not open for further replies.