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

Sync RTU sequential reading failure #180

Open
gustavowd opened this issue Apr 3, 2023 · 4 comments
Open

Sync RTU sequential reading failure #180

gustavowd opened this issue Apr 3, 2023 · 4 comments
Labels

Comments

@gustavowd
Copy link
Contributor

If i read sequentially two the sets of registers, the second read never return.

For example:
let rsp1 = ctx.read_holding_registers(32000, 20).unwrap();
let rsp2 = ctx.read_holding_registers(32300, 40).unwrap();

A simple thread sleep of 10 miliseconds between readings solve the problem. However, I beleive this issue should be solved.

@uklotzde
Copy link
Member

uklotzde commented Apr 3, 2023

What's the outcome if you use libmodbus instead of tokio-modbus for this particular device and invocation sequence?

@gustavowd
Copy link
Contributor Author

It works with libmodbus. Maybe its the modbus RTU interframe space of 3,5 char that is not implemented in tokio-modbus.

@uklotzde
Copy link
Member

uklotzde commented Apr 5, 2023

For reference: 2.5.1.1 MODBUS Message RTU Framing

@uklotzde
Copy link
Member

uklotzde commented Apr 5, 2023

Adding a timeout unconditionally before and/or after each request would be a waste of time. Only the client knows if it will send a single request or a sequence of requests that require the insertion of silence intervals. The duration may also vary from device to device.

Ideas how to make this more convenient for clients through the API are welcome.

@flosse flosse added the rtu label May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants