-
Notifications
You must be signed in to change notification settings - Fork 1k
USBSerial loosing characters on Linux #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @ktand |
Hi @fpistm Sure! I will work my way from 1.5.0 and up. |
I have found the commit that introduces this problem and also what causes it. The commit is @eea20cec and the problem is in the
What happens is that when the Another thing, not directly related to this bug: If there is another interrupt delaying execution and causing the |
A simple workaround that fixes the issue of lost characters could be to read
But since I'm not exactly sure how the timeout is supposed to work I'm not sure it's the right solution. It does however fix the character drop for me. Not sure why this only happens on Linux and not on Windows.... |
I was reading your first e-mail and was thinking we need a local variable to save the value, so your proposal is spot on. Re:timeout - this value depends how often the host reads data over the USB connection. Clearly there are some differences in the serial driver implementations between Windows and Linux. In theory you need much bigger value with low boud rates. For example if you are emulating 9600bps serial, a full USB packet of 64 bytes would take (64*10/9600) or ~67ms to transmit, so the timeout should be 100 or thereabout. |
Just a quick note to avoid any confusion HAL tick is 1ms. So USB_CDC_TRANSMIT_TIMEOUT is 3ms. |
Is that really true? Doesn't a USB packat transfer take the same time regardless of baudrate? |
@ktand |
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Describe the bug
I'm using the Marlin 3d-printer firmware on the Armed 3D-printer board (STM32F407) together with Octoprint running on a Raspberry PI 3 A+. Octoprint request temperature status to be sent from the printer to the Octoprint host on a reqular basis (every 2nd second). A temperature status message looks like this:
T:23.01 /0.00 B:22.88 /0.00 @:0 B@:0
The problem is that sometimes one or more characters of this message is lost. I have tested without Octoprint, using minicom, and the character loss is there as well so this is not a problem with Octoprint.
The problem exists in the master branch but not in release 1.5 (I'm currently testing with master @ commit 7feeb09)
The message is composed by calls to both string and single character Stream functions
What is strange is that on Windows no characters are lost.
To Reproduce
I have tried, but failed, to reproduce this in a test program by sending the message above every 2nd second.
Could this be a timing issue? Marlin uses multiple timer interrupts.
I understand this is not easy to investigate but I'll be happy to help test if someone got an idea what could be causing this.
Board (please complete the following information):
The text was updated successfully, but these errors were encountered: