Closed Jendem closed 2 years ago
Have you checked the latest pymodbus 2.1.0 ? There was a similar issue reported and was fixed
I have now tried with the latest version, 2.1.0, but the problem still exists.
The if checkFrame()
is never true in processIncomingPacket(...)
in rtu_framer.py
.
Maybe it could compare frame_size
and len(self._buffer)
, and if the buffer grows beyond the frame size, it should call self.resetFrame()
?
Ok, Thanks for the confirmation. I will take a look.
Can confirm am having the same issue
Added a potential fix and test results in comments #363 .
solved on current dev.
Feel free to open a new PR, if you still experience problems.
Versions
Pymodbus Specific
Description
What were you trying:
Modbus client on PLC is writing to pymodbus server using code 16 (Write Multiple Registers). If the serial line is disconnected and then connected again, the RTU framer never passes its
checkFrame(self)
method.Code and Logs
Adding some logging to the file
rtu_framer.py
:What did you expect? A normal log is like this: The buffer grows until the package is complete, in this case to 33 elements.
What has happened, what went wrong If the communication is broken, the buffer grows, because the CRC vil never match. Notice the last two bytes
0x18 0x3a
are wrong in the firstpymodbus.server.async:Data Received
log.What did you expect? Some kind of reset if the buffer grows larger than the expected size.