Shifted read values on pymodbus 3.7.4 #2560
-
Hello, The code is requesting ~20 2 words registers every 3 seconds, on a 9600 bauds tty serial. We are using the ModbusSerialClient, with a timeout of 250ms. The code used to work fine on 2.5.3, but we decided to rework a bit the code, and update pymodbus to 3.7.4 some weeks ago. On a high level, the code setup the serial port connection, and then a loop is called to read the data. No connect() or close() is called. The read loop takes ~1sec, and 2 second of wait. Since the 3.7.4 update, it happens that the values are mixed: if a register cannot be read (occurs time to time), it may appear that the next read will get the value of the previous register. It appear after several hours of running (2-8h), and after that, all the values are shifted by 1 or two registers. I probably found a solution, I added a connect() and close() for each read. It increase the computation time by ~10ms, but the issue does not seem to reproduce (after 72h of running). Do you have any insight to help me understand what is happening ? Is it a timing issue ? Is it fixed in the latest 3.8.3 ? Was it a mistake to not call connect/close at every read ? Is there a way to flush the buffers, as it seems to be the issue ? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
V3.7.4 is pretty old and we have solved several bugs in later releases so I really cannot remember if there was a bug like that, but I remember that there was several problems specifically with the sync client. The current version v3.8.3 do not have that problem, mainly because the whole locking mechanism have been simplified. |
Beta Was this translation helpful? Give feedback.
V3.7.4 is pretty old and we have solved several bugs in later releases so I really cannot remember if there was a bug like that, but I remember that there was several problems specifically with the sync client.
The current version v3.8.3 do not have that problem, mainly because the whole locking mechanism have been simplified.