-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Reason for the Unaddressed Slave's "Waiting for Confirmation" in Modbus RTU #799
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
Modbus is typically used with multiple slave devices on one bus, e.g. on a RS-485 bus. When the request is not for your device, then usually there is another one which responds - the addressed one. libmodbus - since on the same shared bus - sees this response too and thus needs to discard it. |
Thank you mhei, and to further provide explaination regarding your answer, here's a scenario Master request Slave 1
Slave 0
If Slave 0, does not do the “Waiting for confirmation” and directly listen to request again by doing the “Waiting for indication”, it will accept the response of other slaves in this case Slave 1 Slave 0
In this case, it will process the frame but since the CRC of that frame is invalid, an error will occur then the remaining frame …21 is accepted, which results to error again. Slave 0 must do the “Waiting for confirmation” to expect that the next receive is the response of another slave in this case Slave 1 and to discard or ignore it. |
I think we can close the issue here? |
I got a question. if there is two server device address 1 and 2, device 2 is offline, and client wants to request in a loop act like:
in this case, the client request address 2, and the address 2 device is offline, at this moment the address 1 server will ignore the further one package. If client after request address 2 and timeout then directly request address 1 server, the address 1 server will ignore this request and needs client to retransmit, but if client just loop this will be a infinite fail loop. Is this situation should be handled by the client? I feel like if the server just don't wait for confirmation which is not for the server address, there will not have this problem, and even the server get the response comes from other server, because the address is not for it, it will ignore the package anyway. Is there a recommended way to solve this kind of problem? |
I'm trying to understand the behavior of the Addressed Slave and Unaddressed Slave in Libmodbus.
When there's a request for the Slave (Addressed Slave), it respond appropriately.
When there's a request but it is not for the Slave (Unaddressed Slave), it ignores the request.
But why after ignoring the request, does the Unaddressed Slave also needs to do the "Waiting for confirmation..."?
To give context, it is mentioned in the library the context for "Waiting for confirmation" (wait for response) and "Waiting for indication" (wait for request)
Further looking at the source of Libmodbus, this behavior seems to be intentional.
But why does the Unaddressed Slave, waits for a response? What is the purpose or reason for "Waiting for confirmation" in this behavior? And is the behavior even necessary? Is it possible to completely change this to directly ignore without any further implications?
The text was updated successfully, but these errors were encountered: