Serial print lockup

Not open for further replies.

Bob Larkin

Well-known member
The serial printing works for about 5 seconds and then printing locks up. The Teensy is still running, but nothing prints, suggesting it is the at the PC end. This started out in a big program, but remains after paring down to the trivial level. What am I doing wrong???

Teensy 3.6 unmodified, no additional hardware
Arduino 1.8.9 fresh from the download
Teensyduino 1.46 fresh from the download
Ubuntu 18.4 64-bit
// EVALCodec1.ino  Bob Larkin 24 June 2019

#if (TEENSYDUINO < 146)
#error "Teensydunio < 1.46"
/* Print j++ added to LED Blink, Teensyduino Tutorial #1 */
const int ledPin = 13;
uint16_t j;

void setup() {
  pinMode(ledPin, OUTPUT);
  delay(1000);   // For serial print

void loop() {
  digitalWrite(ledPin, HIGH);   // set the LED on
  delay(1000);                  // wait for a second
  digitalWrite(ledPin, LOW);    // set the LED off
  delay(1000);                  // wait for a second

This will print "01" corresponding to about 5 seconds. Changing the blink delays will change the number of j values printed, but it is always about 5 seconds worth. The blink of the LED continues on and on. What is the deal?? Thanks, Bob
Here are the tool settings
I'm running it here on Ubuntu 18.04. Can't reproduce the problem. As you can see in this screenshot, it's been running for about 1 minute without issues.

Here's some suggestions to try.

1: Make sure you have the latest udev rules file installed. It was updated several weeks ago for a change Ubuntu pushed in updates.

2: Check if ModemManager is running or even installed. If it is, and you don't use a modem, get rid of ModemManager. With apt-get, you might need a "purge" option or something? Usually when serial works for a few seconds then fails, it's ModemManager interfering. Linux is the only system that allows more than 1 program to open a port, but it doesn't actually have the code to allow 2 to really work correctly at the same time (as is commonly done in HID drivers). Theoretically any other program on your PC could also be interfering, but ModemManager is the usual culprit.

3: Try adding a "while (!Serial) ;" near the beginning of setup(), so your program doesn't access the port until Linux is ready. So far this sort of problem confusing the driver has only been reported on Raspberry Pi, but who knows, maybe it could be an issue?
Not open for further replies.