USB g_serial bug? - loosing data in one direction
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I am having some difficulties with kernel module Gadget Serial v2.4. g_serial is used on ARM machine BeagleBone Black with Arch Linux 4.6.3-1 which is communicating with host PC.
The problem was reproduced on these hosts:
- Linux 4.2.0-23, PC x86_64,
- Linux 3.4.43, Cubieboard2 armv7l,
- Windows 10, PC x86_64,
and with different software:
Device (BeagleBone Black):
- C++ and termios,
- python3-pyserial.
Host (PC or Cubieboard2):
- C# + .NET,
- python3-pyserial.
Python test: https://github.com/tomasxvavra/serial_test.
The issue is that data is lost in direction device -> host. For example if device sends to ttyGS0 100 MB of data, then the host receives from ttyACM0 only 99.7 % of the data. This never happens in direction host -> device.
Amount of data which is lost is varying based on these conditions:
Size of data "packets" written to serial port:
*If 100 MB is written to port at once through s.write(data) than it is much less likely to fail. Writing to port at various packet sizes results in variour error rates. For example:- Smaller packets <=512 B - mostly ok, sometimes fails with around 10-512 B mising.
- Bigger packets 4096 - 32768 B: Fails more often and larger amounts of data is missing.
Speed of the host device - Fail rate was much higher on slower Cubieboard2 than on PC, especially with bigger packets.
Sometime it fails when sending only 1024 B, or similar sized number, usually 512 B is lost. I also tried to analyze USB packets with wireshark and there really was missing packets. But nothing else I could interpret as a anomaly.
So from my kernel point of view, it looks like some timing issue to me. Any similar experiences with g_serial? Thank you.
Edit
I found out that when the host is Cubieboard2 (2 CPUs), then the failure rate rapidly drops if I load the one cpu with
cat /dev/zero > /dev/null
But different amount of load can make it even worse. Still looking as some timing issue :/
kernel bugs
add a comment |
up vote
2
down vote
favorite
I am having some difficulties with kernel module Gadget Serial v2.4. g_serial is used on ARM machine BeagleBone Black with Arch Linux 4.6.3-1 which is communicating with host PC.
The problem was reproduced on these hosts:
- Linux 4.2.0-23, PC x86_64,
- Linux 3.4.43, Cubieboard2 armv7l,
- Windows 10, PC x86_64,
and with different software:
Device (BeagleBone Black):
- C++ and termios,
- python3-pyserial.
Host (PC or Cubieboard2):
- C# + .NET,
- python3-pyserial.
Python test: https://github.com/tomasxvavra/serial_test.
The issue is that data is lost in direction device -> host. For example if device sends to ttyGS0 100 MB of data, then the host receives from ttyACM0 only 99.7 % of the data. This never happens in direction host -> device.
Amount of data which is lost is varying based on these conditions:
Size of data "packets" written to serial port:
*If 100 MB is written to port at once through s.write(data) than it is much less likely to fail. Writing to port at various packet sizes results in variour error rates. For example:- Smaller packets <=512 B - mostly ok, sometimes fails with around 10-512 B mising.
- Bigger packets 4096 - 32768 B: Fails more often and larger amounts of data is missing.
Speed of the host device - Fail rate was much higher on slower Cubieboard2 than on PC, especially with bigger packets.
Sometime it fails when sending only 1024 B, or similar sized number, usually 512 B is lost. I also tried to analyze USB packets with wireshark and there really was missing packets. But nothing else I could interpret as a anomaly.
So from my kernel point of view, it looks like some timing issue to me. Any similar experiences with g_serial? Thank you.
Edit
I found out that when the host is Cubieboard2 (2 CPUs), then the failure rate rapidly drops if I load the one cpu with
cat /dev/zero > /dev/null
But different amount of load can make it even worse. Still looking as some timing issue :/
kernel bugs
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I am having some difficulties with kernel module Gadget Serial v2.4. g_serial is used on ARM machine BeagleBone Black with Arch Linux 4.6.3-1 which is communicating with host PC.
The problem was reproduced on these hosts:
- Linux 4.2.0-23, PC x86_64,
- Linux 3.4.43, Cubieboard2 armv7l,
- Windows 10, PC x86_64,
and with different software:
Device (BeagleBone Black):
- C++ and termios,
- python3-pyserial.
Host (PC or Cubieboard2):
- C# + .NET,
- python3-pyserial.
Python test: https://github.com/tomasxvavra/serial_test.
The issue is that data is lost in direction device -> host. For example if device sends to ttyGS0 100 MB of data, then the host receives from ttyACM0 only 99.7 % of the data. This never happens in direction host -> device.
Amount of data which is lost is varying based on these conditions:
Size of data "packets" written to serial port:
*If 100 MB is written to port at once through s.write(data) than it is much less likely to fail. Writing to port at various packet sizes results in variour error rates. For example:- Smaller packets <=512 B - mostly ok, sometimes fails with around 10-512 B mising.
- Bigger packets 4096 - 32768 B: Fails more often and larger amounts of data is missing.
Speed of the host device - Fail rate was much higher on slower Cubieboard2 than on PC, especially with bigger packets.
Sometime it fails when sending only 1024 B, or similar sized number, usually 512 B is lost. I also tried to analyze USB packets with wireshark and there really was missing packets. But nothing else I could interpret as a anomaly.
So from my kernel point of view, it looks like some timing issue to me. Any similar experiences with g_serial? Thank you.
Edit
I found out that when the host is Cubieboard2 (2 CPUs), then the failure rate rapidly drops if I load the one cpu with
cat /dev/zero > /dev/null
But different amount of load can make it even worse. Still looking as some timing issue :/
kernel bugs
I am having some difficulties with kernel module Gadget Serial v2.4. g_serial is used on ARM machine BeagleBone Black with Arch Linux 4.6.3-1 which is communicating with host PC.
The problem was reproduced on these hosts:
- Linux 4.2.0-23, PC x86_64,
- Linux 3.4.43, Cubieboard2 armv7l,
- Windows 10, PC x86_64,
and with different software:
Device (BeagleBone Black):
- C++ and termios,
- python3-pyserial.
Host (PC or Cubieboard2):
- C# + .NET,
- python3-pyserial.
Python test: https://github.com/tomasxvavra/serial_test.
The issue is that data is lost in direction device -> host. For example if device sends to ttyGS0 100 MB of data, then the host receives from ttyACM0 only 99.7 % of the data. This never happens in direction host -> device.
Amount of data which is lost is varying based on these conditions:
Size of data "packets" written to serial port:
*If 100 MB is written to port at once through s.write(data) than it is much less likely to fail. Writing to port at various packet sizes results in variour error rates. For example:- Smaller packets <=512 B - mostly ok, sometimes fails with around 10-512 B mising.
- Bigger packets 4096 - 32768 B: Fails more often and larger amounts of data is missing.
Speed of the host device - Fail rate was much higher on slower Cubieboard2 than on PC, especially with bigger packets.
Sometime it fails when sending only 1024 B, or similar sized number, usually 512 B is lost. I also tried to analyze USB packets with wireshark and there really was missing packets. But nothing else I could interpret as a anomaly.
So from my kernel point of view, it looks like some timing issue to me. Any similar experiences with g_serial? Thank you.
Edit
I found out that when the host is Cubieboard2 (2 CPUs), then the failure rate rapidly drops if I load the one cpu with
cat /dev/zero > /dev/null
But different amount of load can make it even worse. Still looking as some timing issue :/
kernel bugs
kernel bugs
edited Dec 7 at 23:50
Rui F Ribeiro
38.7k1479128
38.7k1479128
asked Jul 4 '16 at 10:21
GeraltCZ
112
112
add a comment |
add a comment |
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f293747%2fusb-g-serial-bug-loosing-data-in-one-direction%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f293747%2fusb-g-serial-bug-loosing-data-in-one-direction%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown