I’ve done a lot for years with Teensy 3.2 and Teensy 4.0. I recently started playing with Teensy 4.1, and I get a strange behaviour on upload. As the title suggests, it fails specifically every second time. When it fails, it looks like this:
Building in release mode Linking .pio/build/teensy41/firmware.elf Checking size .pio/build/teensy41/firmware.elf Building .pio/build/teensy41/firmware.hex Configuring upload protocol... AVAILABLE: jlink, teensy-cli, teensy-gui CURRENT: upload_protocol = teensy-cli Rebooting... Uploading .pio/build/teensy41/firmware.hex Teensy Loader, Command Line, Version 2.2 Read ".pio/build/teensy41/firmware.hex": 333820 bytes, 16.4% usage Error opening USB device: Operation timed out Waiting for Teensy device... (hint: press the reset button) Found HalfKay Bootloader Read ".pio/build/teensy41/firmware.hex": 333820 bytes, 16.4% usage error writing to Teensy *** [upload] Error 1 Programming...========================== [FAILED] Took 4.35 seconds ==========================
If I switch to the teensy-gui uploader, it uploads every time, but the serial monitor doesn’t resume:
Error: [Errno 2] could not open port /dev/cu.usbmodem117574901: [Errno 2] No such file or directory: ‘/dev/cu.usbmodem117574901’
But I just press up and enter and it’s fine. It seems in either case it could be a timeout waiting for the socket to become available.