Teensy 4.1can't command through Serial Monitor but works on anothr Computer

Hardware

  • Board: Teensy 4.1
  • OS: Windows 10 Pro 10.0.19045
  • Driver: usbser.sys (Windows built-in USB Serial driver)

Problem Description

The Teensy 4.1 can send data to PC successfully (I can see serial output in Arduino IDE Serial Monitor and SecureCRT), but receiving any input causes immediate disconnection.

Symptoms:

  • Serial output from Teensy works perfectly
  • When I type any character and press Enter in Serial Monitor/SecureCRT, the COM port disconnects immediately
  • The device disappears from Device Manager and reappears after a few seconds
  • This happens with both Arduino IDE Serial Monitor and SecureCRT

What I've Tried

  1. Replaced USB cable with phone data cable → No change
  • Connected to motherboard USB port (not front panel) → No change
  1. Uninstalled conflicting USB drivers:
  • Prolific USB-to-Serial (oem164.inf, plser.sys)
  • CH340 (oem95.inf, ch341.sys)
  • FTDI drivers (oem17.inf, oem18.inf, oem141.inf)
  1. Uninstalled all USB devices from Device Manager and restarted → No change
  2. Tested Teensy on another computer → Works perfectly (input and output both work)
  3. Tried different firmware with minimal serial test code → Same issue
  4. Tried to uninstall Teensy driver, but "Delete the driver software for this device" option is not available (because it uses Windows built-in usbser.sys)

Firmware Code

I'm using a simple serial command parsing firmware based on PJRC official examples:

void loop() {
    if (Serial.available() > 0) {
        String cmd = Serial.readStringUntil('\n');
        cmd.trim();
        if (cmd.length() > 0) {
            processCommand(cmd);
        }
    }
    delay(10);
}

The same code works perfectly on another computer.

Question

Is this a known issue with Windows 10 USB Serial driver? Since the Teensy works fine on another computer but fails on this Windows 10 machine, and I've already removed all conflicting USB drivers, what else can I try?

Show the connections.

Your code is missing the setup() function, and within that should be a Serial.begin(baud); and will not compile. Make a minimal sketch to show what you observe.

How? What code is making the output?

[edit]

I used to use a Prolific USB to serial driver that... sucked... every Windows update erased it because it did not have the right ?things? to keep it, and would need to re-install the driver. Worse, the driver needed to be flagged as "Win7 compatible" then "run as administrator"... and even worse than worse, it needed the "original" 3.3 version installed before installing the most recent version. A Charliest of Foxtrots. But once installed to their liking, it worked.

Not that I am aware of, although my computer is running Windows 11. If you were running an older system like 7 or 8, I would suggest you check the Serial Drivers.

Did you follow the instructions on Teensyduino: Teensy support for Arduino IDE

If you have not already done so, you might try asking on the Teensy forum:
What's new | Teensy Forum

Hi @leodavid.

This is a fairly complex program. My recommendation is to distill the code down to the absolute minimum, with minimum complexity, that is required to reproduce the fault.

Often by the time I complete this exercise, the cause of the fault becomes clear. Even if the outcome is not a self-resolution, that minimal, reproducible, verifiable example (MCVE) will be very useful to the helpers who are supporting you with the problem.

An example of what I mean by a minimal sketch:

void setup() {}
void loop() {}

If you find the fault still occurs even after uploading that sketch to the board, it would tell us that the problem is at a low level, not specific to some code in your full sketch. Conversely, if the fault does not occur when running that minimal sketch, then we have information that something in your full sketch code is required to produce the conditions under which the fault occurs.

We might find that a required condition is the initialization of the Serial interface:

void setup() {
  Serial.begin(9600);
}
void loop() {}

Or perhaps only when the received data is read?:

void setup() {
  Serial.begin(9600);
}
void loop() {
  if(Serial.available() > 1) {
    Serial.read();  // Clear buffer
  }
}

Another thing you may want to check is that the Serial Monitor outputs a \n character.

Check the setting:
image
Make sure it has one of the options that includes the new line

Here's some other stuff to try, and blind guesswork about possible problems...

Try setting Tools > USB Type to any of the options without "Serial". Of course upload again for the change to take effect. For example, pick "MIDI". In these modes, the USB code on Teensy will implement a special HID interface so you can still use Serial.print() to the Arduino Serial Monitor. This gives you a path to completely avoid usbser.sys.

Try setting Tools > CPU Speed to something slow, like 150 MHz or maybe even 24 MHz. If this problem turns out to be power related, maybe running slower which reduces power consumption will make a difference?

Try other USB ports on your PC. You might also look at which ports are actually a different USB controller (Windows doesn't make finding this easy). On many PCs most or sometimes even all the USB ports are served from a single controller.

Try another USB cable. Yeah, this seems like a long shot, especially if your cable works with that other PC. But consider Teensy USB uses 480 Mbit/sec speed, so shoddy cables that work well at 12 Mbit/sec might "just barely work" at 480 speed, fine with some USB ports on some PCs but perhaps troublesome on others?

Try connecting through a USB hub, especially a powered hub. The words you've given suggest this may be a problem with your PC believing the USB device has been removed. When you use a USB hub, the USB protocol assigns the responsibility for detecting device insertion and removal to the circuitry inside the hub. Probably another long shot, but you did ask what else you can try.

If your computer is a laptop, try testing with and without the laptop's power brick connected.

If Teensy and circuitry you've wired to Teensy connects to anything else, remove all external connections so the only path for power (and ground) is the USB cable. If any of the circuitry connects to anything which might have a path to ground, you could have a "ground loop" issue.

And lastly, you've tried cold rebooting your PC, right? {Anakin & Padme meme}