diag_query_data might not be working as expected for msg-parameter length of one or two bytes #2451
Replies: 3 comments 8 replies
-
Thanks I will try to simulate your device responses. 32 bytes is a magical limit for a number of rs485 usb devices, so it's normal the message will be received in chunks, however pymodbus should assemble the, and present a complete response.....it not, then please make a short debug log so I have something to simulate. |
Beta Was this translation helpful? Give feedback.
-
Please look at the the modbus standard, "return query data" have a data field of minimum 2 bytes and it must be a multiple of 2. So sending 0, 1 or 3 bytes are not allowed. |
Beta Was this translation helpful? Give feedback.
-
if you want a check on the input data, then pull requests are welcome. |
Beta Was this translation helpful? Give feedback.
-
When testing the diagnostics function on a serial connection to a hardware device I find that for most messages of two bytes or longer it works as expected. For single byte or zero byte messages an error is generated instead. It looks like the replies are discarded because they are considered to be to short.
This is using the dev branch (couple of days old pull) of pymodbus.
Test code:
Debug messages:
Side note: For long test messages (~> 32 bytes) the reply sometimes gets truncated. Still investigating if that happens in my hardware or in pymodbus.
Beta Was this translation helpful? Give feedback.
All reactions