Skip to content
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

lose data when read binary data ! #67

Closed
touchft opened this issue Jul 9, 2020 · 1 comment
Closed

lose data when read binary data ! #67

touchft opened this issue Jul 9, 2020 · 1 comment

Comments

@touchft
Copy link

touchft commented Jul 9, 2020

Same problem happens as PR #61 (branch: ams/fix-read-methods). I meet some strange problems. I've made couple tests:

A. send binary data (such .jpg ) to serial A Tx, which connect to serial B Rx
B . send binary data (such .jpg ) to serial A Tx, which connect to serial A Rx
The function readuntil() (read() or nonblocking_read() in branch: ams/fix-read-methods) from Rx port (for both A and B test) will lose one byte every 1023 bytes received, or lose the last byte if I send less than 1024 bytes.

For example, If I send 1024 bytes (raw) to Tx, I got 1023 bytes from Rx port.
If I send 2048 bytes to Tx, I got 2046 bytes from Rx port !
If I send 100 bytes to Tx, I got 99 bytes from Rx port !
This strange problem happens no matter how much baudrate I set, e.g, 115200,921600.
BTW: The software cutecom test binary file send and receive without any problem for above hardware setup !

If I send a pure text file (all ASCII) to Tx, the above problem is gone!

[new test] function sp_blocking_read() : SAME problem: lose one byte every 1023 bytes received, or lose the last byte if less than 1024 bytes was sent !

@touchft touchft changed the title lose data when read binary data as String ! lose data when read binary data ! Jul 9, 2020
@touchft
Copy link
Author

touchft commented Jul 9, 2020

In fact, when I turn off all flow control, the problem is gone ! When open serial, we has default attributes: RTS SP_RTS_ON and DTR SP_DTR_ON. Use set_flow_control() to turn off these two attributes so that we will remove above problems.

Suggestion: How about we take SP_RTS_OFF and SP_DTR_OFF as default ? Cutecom set these two off as default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant