Brand new Teensy 4.1 not responding to USB-Based requests

kirillmcq

Member
I have a brand new Teensy 4.1(Authentic, not a knock-off), and I am trying to upload this program to it just to make sure it works:

Code:
void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.println(analogRead(0));
  delay(100);
}

The Teensy does have the blinking light program working. When I try and upload that code, I get this error:

Code:
Opening Teensy Loader...
Memory Usage on Teensy 4.1:
  FLASH: code:10988, data:2968, headers:8568   free for files:8103940
   RAM1: variables:3488, code:8320, padding:24448   free for local variables:488032
   RAM2: variables:12384  free for malloc/new:511904
Teensy did not respond to a USB-based request to enter program mode.
Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.
Failed uploading: uploading error: exit status 1

So I pressed the button, and it still responded the same. I then bought a new cable for data transfer, and that didn't work. I've looked at other questions on this site, none have helped me.
Running Linux OS based off of Ubuntu. And for the record, the Arduino Nano works fine with Arduino IDE, but Teensy doesn't. I installed the Arduino IDE library also.
 
Run these commands in a terminal

cd /tmp
wget https://www.pjrc.com/teensy/00-teensy.rules
sudo cp 00-teensy.rules /etc/udev/rules.d/

Physically unplug and reconnect the USB cable for the newly install udev rules to take effect.

If that doesn't resolve the problem, run "tail -f /var/log/syslog" in a terminal. The Linux kernel should give useful info about the USB device connect and disconnect events, including which drivers it's loading and what device names get created.
 
I'm guessing you're using Arduino 2.0.4?

With the older versions of Arduino, running the Teensyduino installer was necessary. It detects pre-10 versions of Windows which need the serial driver INF and Linux systems without the udev rules, so you find out about this when installing.

Now with Arduino 2.0.x, their Boards Manager does the install. We've lost the ability to check this at install time. Probably no need to worry about Windows XP, Vista, 7, 8 anymore. But future software probably should check Linux systems to make sure the udev rules are installed. Maybe it could be added right after this error appears...
 
Copying UDEV rules fixed it. But now, when i try and print something to the Serial port, it doesn't workj every time. Like there would be no output 2 times and then the 3rd time I upload it there is an output
 
Unlike Windows which only allows 1 program to open a serial port, Linux allows 2 or more programs to open the device.

But Linux doesn't handle that situation gracefully. You might imagine is would send a copy of incoming serial data to all programs which have opened the device, since it allowed more than 1 to open it. In fact, Linux handles this scenario quite badly, giving the incoming seemingly randomly to open of the multiple programs which have the device opened.

The Linux serial monitor program should do better to automatically quit when anything goes wrong. But sadly it's not so good at detecting the corner cases where things go wrong. This unfortunate behavior in unusual error cases is on my list low priority issues (where "low priority" means probably won't get fixed for a very long time, maybe not ever).

Leftover serial monitor processes is known issue with the Linux software in unusual error cases.
 
Copying UDEV rules fixed it.

Quick followup, the recent 1.58 release added detection of missing udev rules. It now prints a helpful message if /etc/udev/rules.d/00-teensy.rules doesn't exist.

The Linux-specific issue where lingering serial monitor processes can sometimes keep the port open is still unresolved. It's on my list for 1.59.
 
Back
Top