Koromix / tytools

Collection of tools to manage Teensy boards
https://koromix.dev/tytools
The Unlicense
214 stars 27 forks source link

tycmd: upload fails for HID Teensy 3 with older core code #102

Open beldenfox opened 1 year ago

beldenfox commented 1 year ago

I'm running tycmd version 0.9.8 on a Raspberry Pi. I have several Teensy 3 boards attached and found that I could use tycmd to upload new code to some of the boards but not others. On the boards that failed I would get a timeout error. I finally figured out the failing boards had last been flashed using Teensyduino 1.53. Boards flashed with Teensyduino 1.57 or later worked fine.

The Teensies are configured as MIDI-only so they connect to the Pi as HID raw devices. During upload tycmd calls teensy_open_interface inlibty/class_teensy.c and for HID devices that routine sends the feature report 0xAB 0xBA 0xCD 0xDC. A Teensy flashed with a core from Teensyduino 1.53 will not acknowledge that report leading to a USB timeout. A Teensy flashed with core code from Teensyduino 1.57 or later will work fine.

Is it necessary to send that report during an upload? I removed it and was able to upload without issue (which is good since it's physically difficult to access the Teensies).

BTW, the same problem prevents tycmd reset from working.

Koromix commented 1 year ago

It's not needed for uploads, it just signals readiness for serial communications (without it, while (!Serial); loops never break out in Seremu mode).

But (1) it's not needed for uploads and (2) we can probably ignore the error if it fails (just warn the user but go on, even for serial communication).

I'll look into this over the weekend.