Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: USB Serial Communication problems in Windows

  1. #1
    Senior Member
    Join Date
    Apr 2018
    Eastern Time, USA

    USB Serial Communication problems in Windows

    On a windows 10 computer, using python with pyserial to read output from a Teensy 3.2.

    The Teensy program generates about 4,000 lines of output, but on the desktop, it stops getting input at line 1600 and every call to serial.readline() after that timesout.

    Everything works great when I run the same python program on a Linux desktop or laptop.

    The Windows Device Manager shows a usb serial interface at com9:, and the driver is a Microsoft Serial driver from 2006.

    Serial_install.exe, does not run. It reports that there is already a usb serial driver installed and does not offer an option to replace it.

    So what do we do to get this working?

    Thank you

    From the Teensy code:

      for (int i=0; i<3694; i++){
        Serial.print (i);
        Serial.print (' ');

    From the python code. After 1591 lines, every read elicits the "zero length line" message, at intervals corresponding to the timeout parameter for the serial interface.

       lines = []
        while True:
            l = ser.readline()
            if l is None:
                print( 'null read at', n )
                return lines
            if (sys.version_info > (3, 0)):
                l = l.decode("utf-8" )
            if debug:
                print( 'read ', l.strip() )
            l = l.strip()
            if len(l) == 0:
                print( 'zero length line at', n, 'count', m )
                m += 1
            if l.startswith('done' ):
    Last edited by DrM; 08-25-2020 at 04:54 PM.

  2. #2
    Senior Member
    Join Date
    Apr 2018
    Eastern Time, USA
    The problem turns out to be a too small buffer in the Windows USB serial driver.

    The solution is simply to read the input from the teensy faster, and buffer it up manually.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts