It looks like the serial output buffer overflow. I think you're using the
USB serial port, so it's probably not lost in the USB link, but on the
Windows side the USB serial driver is presumably overwriting the output
buffer.  Would you have a Linux system somewhere to cross-check it by using
a different OS/serial driver combination?
Can you change the settings in the Windows serial port, asking for hardware
flow control?

On Fri, Apr 21, 2017 at 12:26 PM, David Howlett <[email protected]>
wrote:

> I should mention I am using:
>     - Windows 10
>     - Drivers from about 2 weeks ago
>     - A beaglebone image from about 2 weeks ago
>
>
> On Friday, April 21, 2017 at 5:18:37 PM UTC+1, David Howlett wrote:
>>
>> I have spent about two days tracking down an issue in one of my machines.
>> I am streaming pressure readings from an i2c pressure sensor to a PC at
>> high speed. I have reduced the problem to a small test case. To replicate
>> the fault I connect the beaglebone black to a PC, connect to it with serial
>> over the micro USB port, login and launch a command that streams data fast.
>> On the PC run a program that collects the streamed data more slowly than it
>> is being created.
>>
>> import serial
>>
>> x = serial.Serial('COM15')
>> to_send = b'\x03yes HelloWorld\n'
>> x.write(to_send)
>> while True:
>>     received = x.readline()
>>     if received != b'HelloWorld\r\n':
>>         print(received)
>>
>>
>> The python program above prints lines like:
>>
>> b'ld\r\n'
>> b'HelloWoroWorld\r\n'
>> b'HelloWorldorld\r\n'
>> b'HelloWorldorld\r\n'
>> b'ld\r\n'
>> b'ld\r\n'
>> b'ld\r\n'
>> b'ld\r\n'
>> b'ld\r\n'
>> b'ld\r\n'
>> b'HelloWoroWorld\r\n'
>> b'ld\r\n'
>> b'HelloWlloWorld\r\n'
>> b'ld\r\n'
>> b'HelloWorldorld\r\n'
>>
>> At about 4 lines per second. If I set the program on the beagle bone to
>> stream slowly then this issue goes away. It appears to be an issue with a
>> buffer filling up somewhere between the output of the yes command and
>> reading bytes from the windows API. The correct behaviour is that the yes
>> command should be stopped when the buffer is full to prevent the loss of
>> data, then allowed to continue when there is space in the buffer again. I
>> observe that the streaming command (in this case yes) is stopped but there
>> is still data loss happening somewhere.
>>
>> I wrote this in python because it is the language I am most comfortable
>> in but if you needed me to I could rewrite the example in some other
>> language. To run the program shown above you will need pyserial and you
>> will need to change 'COM15' to be whatever the port is called on your
>> computer.
>>
>>
>> --
> 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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/beagleboard/f4c86058-1fee-41fb-bc6f-d41f8eccb3b6%40googlegroups.com
> <https://groups.google.com/d/msgid/beagleboard/f4c86058-1fee-41fb-bc6f-d41f8eccb3b6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAC%3D1GgHaO3GQCnKpVa3ATJ9p1VfEMkYOGvtBdEeMGb2nacR13w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to