Teensy 4.1 - Loader tool crashed while uploading and COM no longer works.

RobTec

Member
I was uploading a blank sketch to one of my 4.1 teensy's using most recent Windows 10, with Arduino 1.8.15, not sure Teensyduino version number but the installer was signed on Dec, 22, 2021 and Teensy Loader says it's version 1.56.
Code:
//Blank Sketch
void setup() {
}
void loop() {
}
While the Teensy Loader tool was switching from it's Erasing status bar to the Programming status bar, the loader tool crashed and force closed. This caused windows to go haywire. Arduino IDE, Teensy Loader and Windows, stopped recognizing teensy 4.1's with COM ports and the loader would freeze immediately. So I figured I'd restart my computer, After restarting, everything seems to recognize the 4.1 boards when plugged in, you hear the chime of an inserted usb device. However in the Arduino IDE, it no longer displays the COM port but instead displays
Port: "hid#vid_16c&pid_0478 Bootloader (Teensy 4.1)"
The Teensy Loader can reboot the device, set auto mode, but cannot program it. Windows also doesn't report the device as a COM device anymore in the device manager.
I've tried different cables and different USB ports, 4 different teensy 4.1 boards and everything has the same problems, Even though only one of them errored out while uploading. That to me suggest it's a driver error or some configuration broken on the Windows side and not specifically the 4.1 boards. I tried updating drivers by reinstalling the serial_install.exe and that says "Windows 10 USB Serial Device driver is present. No installation is necessary." I tried reinstalling the entire Teensyduino package, but the installer tells me the same thing about the drivers and I can't force an install as the option is greyed out.
If you try to upload a sketch in this state, the Teensy tool freezes while erasing and the tool reports an image "DOWNLOAD Error"
the loader log says:
23:15:36.263 (loader): Program event
23:15:36.268 (loader): File "C:\Users\...removed...\AppData\Local\Temp\arduino_build_333595\sketch_mar07a.ino.hex", 18432 bytes
23:15:36.269 (loader): File "sketch_mar07a.ino.hex". 18432 bytes, 0% used
23:15:36.290 (loader): elf appears to be for Teensy 4.1 (IMXRT1062) (8126464 bytes)
23:15:36.291 (loader): elf binary data matches hex file
23:15:36.291 (loader): elf file is for Teensy 4.1 (IMXRT1062)
23:15:36.292 (loader): using hex file
23:15:36.313 (loader): begin operation
23:15:36.349 (loader): flash, block=0, bs=1024, auto=0
23:15:36.351 (loader): flash, block=1, bs=1024, auto=0
23:16:06.357 (loader): program: write error
23:16:06.359 (loader): HID/win32: HidD_GetPreparsedData ok, device still online :)
23:16:06.362 (loader): end operation, total time = 30.049 seconds
23:16:06.364 (loader): set background IMG_DOWNLOAD_ERROR
23:16:06.367 (loader): redraw timer set, image 11 to show for 4000 ms
23:16:10.366 (loader): redraw, image 10
23:16:10.367 (loader): set background IMG_ONLINE

How would I go about fixing this?
I've tried different cables, different USB ports, restarting the host machine, different teensy 4.1's, tried to reinstall drivers.
I have yet to full uninstall and reinstall Arduino IDE or Teensyduino, I wanted to ask here about this, before i did that.
(reinstalling ide would be a massive hassle as there's quite a few thing's I'd have to setup again to get all the boards recognized that I'm using)
 
I was reading on this page https://www.pjrc.com/store/ic_mkl02_t4.html about the Diagnostic Blink Codes. When the (error crashed) 4.1 teensy is powered on, it doesn't blink at all. If connected to a pc, it doesn't detect. Though if you press the programming button, it will be detected by windows.

The others that didn't have an upload fail, they are blinking 9 times. It says on that page that nine blinks are a
"ARM JTAG DAP Init Error" - "The ARM JTAG DAP was detected (4 blinks) but could not be initialized. This error is rather unlikely!"
Curious. Hope fully this added information is helpful.
 
!!! I was able to fix the ones which didn't have the crash happen. I did that by holding the button for ~15 seconds when powered on, this apparently defaults back to the blink demo with the Orange LED. After the orange LED was blinking, I uploaded an example sketch. That gave back COM port to my other 4.1's. So at least I have some 4.1's working for now.

However the one that had the loader crash while uploading is still broken. Even after trying to reset it's sketch to the Orange LED Blink defaults with ~15 second button press while on. When you try and upload a sketch after orange blink demo is running, the loader has a download error. Perhaps this 4.1 is dead? Kind of weird that it still is able to come up as a HID device when in orange blink demo, but fails to upload a sketch afterwards. If you skit Arduino IDE and just use the Loader with a hex file, this 4.1 makes the loader application freeze and returns a download error after some time.
 
Okay so I just kept trying to clear the uploaded sketch from the bootloader and finally the one that had the crash was able to upload a new sketch. I used the FastLED Blink example from the File->Examples menu. This gave me back com port on the teensy that had the loader crash.

Basically what I did was plug 'crashed' teensy into the PC, then pressed and held the button until there was a flash on the Red LED near the USB port.
After letting go of the button that Red LED went full bright and stayed on.
Then I unplugged it from the PC and plugged it back into the PC.
I waited for Arduino IDE to show that HID port
Port: "hid#vid_16c&pid_0478 Bootloader (Teensy 4.1)"
Then I uploaded the FastLED Blink example.
After it rebooted, the Com port was now shown.
When it didn't work (which was a ton of times probably tried it over 20 just hoping it would work), after plug cycling the board, i just restarted these step until it did finally work.

Then I used this code to test a large sketch uploading on the crashed board to stress test the loader a bit.
Code:
#include <Wire.h>
#define LARGE_ARRAY_TEST (1)        // 1 = define large array for large code download
#if (LARGE_ARRAY_TEST)
// nested arrays of integers to add code size for testing
#define A0 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15}  // 16  elements 64
#define A1 {A0,A0,A0,A0,A0,A0,A0,A0,A0,A0,A0,A0,A0,A0,A0,A0}  // 256 elements 1KB
#define A2 {A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1}  // 4K  elements 16KB
#define A3 {A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2}  // 64K elements 256KB
#define A4 {A3,A3,A3,A3,A3,A3,A3,A3,A3,A3,A3,A3,A3,A3,A3,A3}  // 1M  elements 4MB
// const variables reside in flash and get optimized out if never accessed
// use uint8_t -> 1MB, uint16_t -> 2MB, uint32_t -> 4MB, uint64_t -> 8MB)
PROGMEM const uint8_t a[16][16][16][16][16] = A4;
#endif

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  if (LARGE_ARRAY_TEST) // if true, access array so it doesn't get optimized out
  Serial.printf( "Large Array Test -- %08lX\n", (uint32_t)&a[15][15][15][15][15] );
}

void loop() {
  // put your main code here, to run repeatedly:
}
After it uploaded, i unplugged and re-plugged the board in to the pc, and seen the following message on the Serial terminal.
Code:
Large Array Test -- 60101D63
Looks like I fixed the crashed/bricked 4.1 board.
 
Basically what I did was plug 'crashed' teensy into the PC, then pressed and held the button until there was a flash on the Red LED near the USB port.
After letting go of the button that Red LED went full bright and stayed on.
Then I unplugged it from the PC and plugged it back into the PC.

@RobTec:
When using the "hold the button for 15 seconds to reset", you should not unplug the Teensy until the solid red LED extinguishes & the orange LED starts blinking. As long as the red LED is on solid, the Teensy is still initializing flash memory, & turning it off during this initialization may have unpredictable results (or possibly bad consequences) !!

Mark J Culross
KD5RXT
 
Last edited:
@RobTec:
When using the "hold the button for 15 seconds to reset", you should not unplug the Teensy until the solid red LED extinguishes & the orange LED starts blinking. As long as the red LED is on solid, the Teensy is still initializing flash memory, & turning it off during this initialization may have unpredictable results (or possibly bad consequences) !!

Mark J Culross
KD5RXT
Thanks for that information, I'll be sure to remember that.
Sometimes during the bootloader cycles with the loader crashed teensy it would just sit with the solid Red led on for a very very long time, were talking over ten minuets on several different attempts and one time I let it sit for over a half an hour with no change. Surely that can't be normal?
 
Thanks for that information, I'll be sure to remember that.
Sometimes during the bootloader cycles with the loader crashed teensy it would just sit with the solid Red led on for a very very long time, were talking over ten minuets on several different attempts and one time I let it sit for over a half an hour with no change. Surely that can't be normal?

That 'RED LED persisting after upload' is not normal. And that is not part of the normal 15 sec Restore that is user initiated with a Button Press.

With the Teensy Loader open there is a ' Help / Verbose 'option that will display the status and info of messages Windows and Teensy present to the loader during operations.

There is perhaps an observed but not yet understood/resolved issue. If it is that same case there will be a message in the verbose text with an "Opps" and in some fashion text similar to 'code doesn't exist for this case'.
 
Back
Top