-
Notifications
You must be signed in to change notification settings - Fork 1k
Serial connections dropping characters, not flushing buffers #885
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
This may or may not be related, but |
There is a bug here, thanks for the report. When N bytes was read from the CDC interface, N < 64, and the host has more than N bytes still to send then (64-N) bytes were dropped. Fix incoming.
This part has the same root cause as #873 - the callbacks for completed USB transfers run using the same mechanism as I will also look at adding a |
If the CDC receive buffer was full and some code read less than 64 bytes (wMaxTransferSize), the CDC code would submit an OUT transfer with N<64 bytes length to fill the buffer back up. However if the host had more than N bytes to send then it would still send the full 64 bytes (correctly) in the transfer. The remaining (64-N) bytes would be lost. Adds the restriction that CDCInterface rxbuf has to be at least 64 bytes. Closes micropython#885. Signed-off-by: Angus Gratton <[email protected]>
If the CDC receive buffer was full and some code read less than 64 bytes (wMaxTransferSize), the CDC code would submit an OUT transfer with N<64 bytes length to fill the buffer back up. However if the host had more than N bytes to send then it would still send the full 64 bytes (correctly) in the transfer. The remaining (64-N) bytes would be lost. Adds the restriction that CDCInterface rxbuf has to be at least 64 bytes. Closes micropython#885. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
If the CDC receive buffer was full and some code read less than 64 bytes (wMaxTransferSize), the CDC code would submit an OUT transfer with N<64 bytes length to fill the buffer back up. However if the host had more than N bytes to send then it would still send the full 64 bytes (correctly) in the transfer. The remaining (64-N) bytes would be lost. Adds the restriction that CDCInterface rxbuf has to be at least 64 bytes. Fixes issue micropython#885. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
I tested this on a Pico running MP 1.23 and the latest version of usb-device-cdc on mip
main.py:
client.py:
I need to read four bytes off the input to confirm I should call
ingest()
, but in doing so I consistently lose eight bytes after the first call toreadinto()
(the output skips V -> e after 256 bytes) and some of the content never appears to leave the buffer. Moving theread()
call intoingest()
doesn't help, nor does usingreadinto()
instead.The text was updated successfully, but these errors were encountered: