Arduino 1.8.9 + Teensy 1.47 : T3.2 USB Serial monitor drops lines?

Status
Not open for further replies.

JBeale

Well-known member
My host PC is a "fitlet2" Linux Mint MiniPC, and 'uname -a' says
4.15.0-55-generic #60-Ubuntu SMP Tue Jul 2 18:22:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I am running Arduino 1.8.9 + Teensyduino 1.47 and I have no problem programming a Teensy 4 or a Teensy 3.2 so the setup seems OK.
Also the T4 program input and output via USB serial works OK. However, the T3.2 output window drops many lines, and eventually stops completely, even though I can confirm the Teensy code does continue to run if I add LED blinking. Here's an example showing the problem:

Code:
void setup() {
  Serial.begin(115200);
  delay(3000);  
  for (uint8_t i=0; i<100; i++) {
    delay(100);
    Serial.println(i);
  }
  Serial.println("Done");
}

void loop() {}

Here is the complete output on the Serial monitor including timestamps, note what's missing:
Code:
15:57:29.334 -> 0
15:57:29.433 -> 1
15:57:29.533 -> 2
15:57:29.633 -> 3
15:57:29.733 -> 4
15:57:30.731 -> 14
15:57:31.530 -> 22
15:57:31.630 -> 23
15:57:31.730 -> 24
15:57:32.329 -> 30
15:57:32.429 -> 31
15:57:32.529 -> 32
15:57:33.028 -> 37
15:57:33.227 -> 39
15:57:33.727 -> 44
15:57:33.826 -> 45
15:57:33.926 -> 46
15:57:34.026 -> 47
15:57:34.126 -> 48
15:57:34.325 -> 50
15:57:34.534 -> 52
15:57:34.634 -> 53
15:57:34.734 -> 54
15:57:34.834 -> 55
15:57:34.933 -> 56
15:57:35.033 -> 57
15:57:36.031 -> 67
15:57:36.331 -> 70
15:57:36.530 -> 72
15:57:36.936 -> 76

'dmesg' after a program cycle shows the Teensy disconnects and reconnects as 16C0:0478 (bootloader) and then 16C0:0483 (serial device) after programming, which I think is expected, so I see no obvious clues here:
Code:
[271857.876069] usb 1-6: USB disconnect, device number 37
[271858.271529] usb 1-6: new full-speed USB device number 38 using xhci_hcd
[271858.420594] usb 1-6: New USB device found, idVendor=16c0, idProduct=0478
[271858.420599] usb 1-6: New USB device strings: Mfr=0, Product=0, SerialNumber=1
[271858.420601] usb 1-6: SerialNumber: 00007834
[271858.421915] hid-generic 0003:16C0:0478.0048: hidraw3: USB HID v1.11 Device [HID 16c0:0478] on usb-0000:00:15.0-6/input0
[271859.007364] usb 1-6: USB disconnect, device number 38
[271859.323516] usb 1-6: new full-speed USB device number 39 using xhci_hcd
[271859.472693] usb 1-6: New USB device found, idVendor=16c0, idProduct=0483
[271859.472697] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[271859.472699] usb 1-6: Product: USB Serial
[271859.472701] usb 1-6: Manufacturer: Teensyduino
[271859.472703] usb 1-6: SerialNumber: 307720
[271859.473306] cdc_acm 1-6:1.0: ttyACM0: USB ACM device

EDIT: same thing happens trying this code with a Teensy LC, and the Teensy 4 that was working OK before. Something weird about my host PC I guess. I rebooted my Mint box, and now it works "better" in that it reached "Done" at the end, but it still dropped quite a few lines. Including "Done" there are 101 lines, but the Arduino Serial window only displays 77 lines. It is missing line 6, 13, 17, ...etc.
 
Last edited:
I also have Arduino 1.8.8 / Teensyduino 1.46-beta9 installed on the Linux Mint box, and the same problem appears there as well.
 
My workaround for now is to just use a real serial UART instead of serial-over-USB. The Teensy's real UART serial communication works fine.
 
Maybe some other program on your PC is opening the serial port and also trying to read the data. Mac and Windows don't allow more than 1 program to open the same port, but Linux does. Sadly, Linux does not actually handle the case of 2 program well, even though it allows that case to happen.

As a quick check, try setting Tools > USB Type to one of the non-Serial options, like MIDI or RawHID. That will causing the serial monitor to use HID protocol instead of serial. Do you get missing lines when running in that mode?
 
Thanks for the reply Paul. Indeed it was the age-old problem that somehow I had not seen before on this machine. I did have /etc/udev/rules.d/49-teensy.rules in place but that wasn't good enough. This fixed the problem:

Code:
sudo apt-get remove modemmanager

It's possible that I'd removed it a long time ago- I don't recall- if so maybe it somehow got reinstalled somehow during an update (?)
 
Status
Not open for further replies.
Back
Top