Thanks for all the replies. Reply to Przemek Klowoski =========================
I agree it is almost certainly a serial buffer overflow somewhere. By filling and emptying the buffers between my code on the BBB and my code on the PC I can detect a 12KB buffer. I believe that this 12KB buffer is in the BBB driver on the PC. I tried to set the driver's buffer to be bigger but the driver appears to ignore all calls to the WINAPI SetupComm system call. I have tried OSX but I still get data loss. I have tried to use a second BeagleBone as PC replacement but the first beagle bone does not show up on the list of available serial ports. I have tried: x = serial.Serial('COM10', xonxoff=True) x = serial.Serial('COM10', rtscts=True) x = serial.Serial('COM10', dsrdtr=True) None of these cause any change in behaviour. I have also tried sending stop commands directly: x.write(b'\x13') # byte 0x13 is XOFF This does not cause any change in behaviour either. Reply to arsi ============= If I understand you correctly, you are recommending adding a 4 byte sequence "0x10 0x11 0x12 0x13" on a regular basis in the streaming data to allow the receiving PC to sync up with the stream. Is that what you mean? For my current application the data looks like: 10392.61424 125 1299 10392.61469 125 1242 10392.61514 125 1357 10392.61558 125 1385 10392.61628 125 1357 10392.61674 125 1242 10392.61718 125 1328 10392.61765 125 1473 10392.61810 125 1212 10392.61880 125 1299 It is delimited by "/r/n" which allows easy syncing up. The trouble is that bytes can go missing to make the above data look like: 10392.61424 125 1299 10392.61469 125 1242 10392.61514 125 1357 10392.61558 125 1385 103921628 125 1357 10392.61674 125 1242 10392.61718 125 1328 10392.61765 125 1473 10392.61810 125 1212 10392.61880 125 1299 I could make my format checking stricter and I could add checksums to every line. This would cut down the error rate but I would prefer to fix the cause of the data loss if possible. Reply to Graham =============== I have tried baud rates on the PC from 10Hz to 100GHz including common baud rates like 9600. The serial connection works at all baud rates tested. There appears to be no change in the data rate or the error rate. To rule out a bug in the pyserial library I have also changed the baud rate with a GUI terminal called "Termite 3.1". This also does not change the data rate. I believe that the serial port is a virtual device and all commands to change the baud rate are ignored by the driver. x = serial.Serial('COM10', baudrate=10) x = serial.Serial('COM10', baudrate=9600) x = serial.Serial('COM10', baudrate=100_000_000_000) My current ideas ============= I could add checksums. I could switch from a virtual serial port to using a pair of physical USB-RS232 adapters. This would go: BBB USB->hardware RS232->PC USB. I only mention this because I have plenty of experience with physical RS232 and I have USB-RS232 adapters which respond to the win32 SetupComm call to change the buffer size. I could also switch to something else entirely like SSH over the ethernet port. -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/2c35a45c-e1dc-476a-8b18-5a6312bae8fc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.