teensy_loader_cli fails every other time

AndyCap

Well-known member
Hi Guys,

Anyone any idea why this would happen:

Flashing first works:

Code:
andrewcapon@admins-iMac tool-teensy % teensy_loader_cli -mmcu=imxrt1062 -w -s -v /Users/andrewcapon/Development/teensy/TeensyTest/.pio/build/teensy41debug/firmware.hex
Teensy Loader, Command Line, Version 2.2
Read "/Users/andrewcapon/Development/teensy/TeensyTest/.pio/build/teensy41debug/firmware.hex": 193536 bytes, 9.5% usage
Found HalfKay Bootloader
Programming..........................................................................................................................................................................................
Booting

The serial port is available, the code is built with -DUSB_MIDI16_AUDIO_SERIAL

When I try to flash again I need to press the reset button and it fails:

Code:
andrewcapon@admins-iMac tool-teensy % teensy_loader_cli -mmcu=imxrt1062 -w -s -v /Users/andrewcapon/Development/teensy/TeensyTest/.pio/build/teensy41debug/firmware.hex
Teensy Loader, Command Line, Version 2.2
Read "/Users/andrewcapon/Development/teensy/TeensyTest/.pio/build/teensy41debug/firmware.hex": 193536 bytes, 9.5% usage
Error opening USB device: Operation timed out
Waiting for Teensy device...
 (hint: press the reset button)
Found HalfKay Bootloader
Read "/Users/andrewcapon/Development/teensy/TeensyTest/.pio/build/teensy41debug/firmware.hex": 193536 bytes, 9.5% usage
Programming...error writing to Teensy

Then if I try again it works:

Code:
andrewcapon@admins-iMac tool-teensy % teensy_loader_cli -mmcu=imxrt1062 -w -s -v /Users/andrewcapon/Development/teensy/TeensyTest/.pio/build/teensy41debug/firmware.hex
Teensy Loader, Command Line, Version 2.2
Read "/Users/andrewcapon/Development/teensy/TeensyTest/.pio/build/teensy41debug/firmware.hex": 193536 bytes, 9.5% usage
Found HalfKay Bootloader
Programming..........................................................................................................................................................................................
Booting

The GUI uploader seems to work (most of the time)
 
I've had similar troubles. One of the problems is that the official CLI tool does not support soft rebooting basically anywhere and so you need to push the reset button yourself to get it to happen. Various people on the forum, myself included, have modified the code to do soft reboots at least on linux and Windows. I haven't yet gotten it to work on MacOS.

Then, you might not be running into this but the timeout values in the CLI tool are waaaaay too short and this leads to issues with some boards and those issues manifest differently from computer to computer. I had to drastically increase the timeouts to make it work reliably.

But, your problem above is the soft reset. For some reason the GUI tool can soft reset on all the operating systems but the CLI does not.
 
Back
Top