Serial communication with Teensy 4.1 - Teensy showing in boards manager, but unavailable to serial comm

CLykke

Member
Hi

I'm currently working on a project using a Teensy 4.1 and is encountering a "random" error using Arduino IDE 2.3.2 and Teensy 1.59. When plugging in my Teensy, it is sometimes mistaken for an ESPCAM (AI THINKER), and when my pc has recognized it as such, I simply cannot make it accept it is a Teensy anymore. No matter which USB port I plug it into, it will contiously believe it is an ESPCAM, and for some reason always force the com port to be com5, even though when I use ESP/PICO/Arduinos, each usbport has distinct com-indexes.

It should be mentioned, that in a previous project, I have used the same cable and port for an ESPCAM. Nevertheless, the error persists across USB ports and different cables.

Most of the time, Arduino recognizes the Teensy. When Arduino has made the mistake however, I cannot force it to use the Teensy interface in any way, and show serial communication. I am still able to upload code, and the Teensy itself operates as expected, I just do not get any serial output, despite the serial monitor implying that a connection is made.

Is there anyone else who has encountered this and know of a way around it?

So far I have not found a fix myself, other than it sometimes begins working out of nowhere again.

Thanks in advance, Christian


1745771983612.png


1745772177914.png
 
Forgot to add, I'm running Windows 10 22H2, build 19045.5737 on a Lenovo Legion Y520-15IKBN, and that the exact same code, board and cable have been running successfully previously, up until the serial communication no longer functioned.
 
Try changing Tools > USB Type RawHID. After upload Teensy should be using only HID and not Serial at all. HID is used to emulate serial, so Serial.print() in your program should still print to the serial monitor. Does that work? Does the COM5 go away?

If so, what happens if you change Tools > USB Type back to Serial and upload again?
 
I've rebooted the pc 4 times since my original post, reuploaded the code, and currently the serial monitor functions. It does not seem to make any difference if I set the USB type to RawHID or Serial, as I recieve serial output in both modes now. I am also capable of uploading code in both USB types.

I restarted my laptop 4 times, as on the first 3 reboots, nothing had changed, and I assumed it must have been some sort of fault on the windows-side with communicating through the USB port.

Currently, the COM5 is not present, no matter which USB port I insert the cable to.

1745778997183.png
1745779020888.png

1745779052133.png
 
The issue has surfaced once again. This time it appeared after having rebooted the teensy 5-6 times in short succession.

I am still capable of uploading code, no matter if the USB type is set to raw HID or Serial. Nevertheless, no serial communication appears on the monitor. The COM5 connection of an AI thinker has reappeared as well.

Currently the teensy is running the same program as a few hours ago, and the serial output should therefore be the same as in previous reply.

If it supplies any clues, the code I'm running is found on my github here: https://github.com/Morl4d1m/ESD6Spring2025/tree/main/Project/Kode/MLSGeneratorSerialLogger

1745788466534.png
1745788502139.png
1745788594608.png
 
Unfortunately the Teensy is not visible in TyCommander, so that hasn't helped yet.

I have just booted the PC and Teensy after 8 ish hours, and the error was still present, so it probably isn't something related to a capacitor or similar hardware on the board.

As I could still upload code, I tried reaching it through the serial monitor message system in arduino, but did not get any reaction (made a blink program, which should turn on/off based on serial input).

After that, I tried viewing the com port in device manager, and no matter which port I placed the cable in, it all read com5.

Frustrated as I was, I tried yanking the usb in and out quite a few times, while pressing the program button at random (often interrupting the programming). After doing so, Windows began thinking the board had been broken😅 However, the ESPCAM option vanished in Arduino IDE, and I would suddenly get teensy serial output. Furthermore, I can write to the teensy:
1745840326279.png

It still seems to make no difference which USB Type the Teensy has been set to, as I can write to and get feedback from both Serial and raw HID.

In the device manager, it appears to be connected to port 1 as a USB composite device, and does not show up as other boards usually do, but I do not know if this is standard Teensy behavior, as this is my first Teensy.

1745840641803.png


Currently my best bet is that something is logged wrongfully in the teensy if the programming is stopped at some specific point, making it unreachable for the serial communication, and that it requires a reset in some form before it is functional again.

However, this does not explain why it started working after 3 reboots yesterday, unless I unintenionally have managed to disconnect it at that exact point in programming.
 
Nevermind my previous reply, arduino still believes it is an ESPCAM.

Therefore, I tried finding it in device manager again. This time it was under "Ports" (as all other boards usually is). In here, it said the device was malfunctioning, and I therefore forced it to restart (didn't screenshot it as I didn't know what would happen). This resolved the communication capabilities to serial monitor, as I now can write and read the teensy through serial and raw HID.

However, the ESPCAM still shows as an option in arduino IDE:
1745842123464.png


If/when I encounter the issue again, I will screengrab each click, so that others might benefit from it in the future
 
Have you ever actually used an ESP32 board? Or any other USB CP210x serial device? I think you may have a bad driver installed that is mistakenly trying to handle the Teensy, even though it's not compatible.
 
Have you ever actually used an ESP32 board? Or any other USB CP210x serial device? I think you may have a bad driver installed that is mistakenly trying to handle the Teensy, even though it's not compatible.
Yes, as stated in the first post, I have used that exact port for an ESPCAM quite a lot last fall. And during the last 3-ish years, I've used quite a few microcontrollers (rPi, Pi PICO W, Arduino R3, Cmod A7-35T FPGA, ESPCAM, various ESP32 versions, Arduino Mega, etc) through that port, as it's the only USB port on the left side of my laptop (away from my mouse), but I've never had such severe issues with it as now.

So it could very well be that some driver is trying to communicate with the Teensy, despite not being able to
 
Unfortunately the Teensy is not visible in TyCommander, so that hasn't helped yet.
Seems the computer is not recognizing it then as Teensy or other usb serial as it will work with other devices.

Have not done it in some time - but there are ways to see and remove recognized USB devices.

Perhaps do a simple sketch with Dual USB and see if TyCommander shows it then as that gives it a new ID and TyCommander should see and present both. If that doesn't work then there is something behind the scenes getting in the way of the correct driver to use.
 
Yes, as stated in the first post, I have used that exact port for an ESPCAM quite a lot last fall. And during the last 3-ish years, I've used quite a few microcontrollers (rPi, Pi PICO W, Arduino R3, Cmod A7-35T FPGA, ESPCAM, various ESP32 versions, Arduino Mega, etc) through that port, as it's the only USB port on the left side of my laptop (away from my mouse), but I've never had such severe issues with it as now.

So it could very well be that some driver is trying to communicate with the Teensy, despite not being able to
What I would try: the next time you plug the Teensy in and it shows up as COM5, go into device manager and tell it to uninstall the driver for that device.
 
Might be worthwhile to consider Teensy is appearing twice in the Ports menu. This is normal when you programmed with USB Type set to Serial (the default).

How Arduino's Serial Monitor will access the hardware is differs depending on which you choose. If you use Task Manager, you should see a different program runs in the background when the serial monitor is open. With "usb:0/140000/0/1" selected, it will be "teensy_monitor.exe" running. With COM5 selected, it will be something Arduino provided, not one of the utilities that came with the Teensy 1.59 install.

Usually both work fine. But if you're having problems, keep in mind you can select either, which results in a completely different utility program running in the background to actually communicate with the hardware.

1746006042315.png
 
Back
Top