ModbusRTUClient connection timeout error #106
Closed
129duckflew
started this conversation in
Q&A
Replies: 2 comments 2 replies
-
Those look like ReadHoldingRegisterResponses. Based on the behavior on startup and in your test program, I would bet you have another piece of software/hardware also trying to communicate with this device, which is absolutely not workable when using Modbus RTU-over-TCP. |
Beta Was this translation helpful? Give feedback.
2 replies
-
@kevinherron Following your suggestion, I checked the settings of my serial-to-Ethernet device, and disabling the cache indeed eliminated the "No pending Req" warning for the Modbus request. And I'able to receive correct modbus rtu response. Thank you! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a Modbus device that supports access via RTU mode,However, it is unclear whether it is due to non-standard implementation by the manufacturer or some other reason, but upon initial connection to the device, I still receive some unknown Modbus response register data
My client configuration is as follows
After creating the client with the above code, I will place it into a Map based on its ID—either escalatorSessionMap or traSessionMap
I use scheduled tasks in SpringBoot to request modbus data once per second as follows
In the code, I filtered the logs of faulty devices with id=397,The id here does not represent the unitId in Modbus, it is merely the id in my business system
When I start the program, I get an error message as
Judging from the error message, it aligns with what I initially mentioned—this Modbus device responds with an unknown Modbus response message upon initial connection. Is there a way to ignore this? Additionally, after attempting to read the device data in a loop a few times, this warning disappears and turns into a direct timeout error. From what angle can I troubleshoot this issue? Any thoughts could be helpful. Thank you very much
I also wrote an additional test program to read the raw TCP data returned on the Modbus port, and even though I did not send any Modbus requests, I still managed to read this data
Some possibly less important information:
I encapsulated the JDK concurrent package's CompletableFuture with Vert.x's asynchronous API in the code, but syntactically it shouldn't cause ambiguity.
Following the approach you mentioned, I checked my RS485-to-Ethernet converter device and found a setting labeled "Do not clear serial port buffer data." I changed it to clear the serial port buffer data every time a TCP connection is established. With this configuration, my Vert.x TCP program started working normally without triggering the Modbus library's warning (No pending request). A simple loop program I used to read data also functioned correctly. However, my main program still fails to connect properly and continues to report a request timeout error.
Here is my simple test program for reading Modbus RTU data.
After starting the program, it can normally output the Modbus response.
However, my main program still reports this error. How should I continue to troubleshoot my issue?
Beta Was this translation helpful? Give feedback.
All reactions