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

Transmitting a modbus tcp broadcast message halts other communication for 200-300 ms #167

Open
vanDrunen opened this issue May 25, 2022 · 0 comments

Comments

@vanDrunen
Copy link

After sending a broadcast message via modbus tcp, I can not send any other messages for 200-300 ms.
Non broadcast messages can be sent back-to-back without problems.

I am using a Modbus TCP to RTU converter, with the RS485 bus running at 230400 baud.
In my application multiple holding registers are sent to a set of slaves, after which a single broadcast is sent for synchronised execution of a function.
Any messages sent directly after the broadcast will not arrive, unless there is a 200-300 ms delay added.
This has been tested with Python 3.8.2 and 3.9.12, multiple modbus-tk versions (0.5.0 to 1.1.2) on OSX and OpenWRT Linux.

A simple example that reproduces this problem:

master = modbus_tcp.TcpMaster(host="192.168.2.110")
master.set_timeout(0.5)
master.execute(1, cst.WRITE_MULTIPLE_REGISTERS, 48, output_value=[1, 2, 3, 4, 5, 6, 7, 8)
master.execute(2, cst.WRITE_MULTIPLE_REGISTERS, 48, output_value=[9, 8, 7, 6, 5, 4, 3, 2)
master.execute(0, cst.WRITE_SINGLE_REGISTER, 1, output_value=1)
# Only when we sleep here for 300ms, the next message will send reliably
time.sleep(0.3)
master.execute(3, cst.WRITE_MULTIPLE_REGISTERS, 48, output_value=[1, 2, 3, 4, 5, 6, 7, 8)
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