While using the MCU as a Modbus TCP master, trying to read 8 or less coils from a slave throws ERR_BAD_SIZE. I'm using pyModSlave as a slave.
I checked that request and response ADUs are correct with Wireshark, and also that the buffer in 'TCPgetRxBuffer' (Modbus.c) matches with the response ADU.
Debugging 'TCPgetRxBuffer' function, I noticed that in line 997 there is this condition:
if (buflen>11) { // minimum frame size for modbus TCP
In the case I described above, buffer length is exactly 10 bytes:
Transaction ID (2 bytes) + Protocol ID (2 bytes) + N.º following bytes (2 bytes) + Slave ID (1 byte) + Function Code (1 byte) + Data length (1 byte) + Data (1 byte in this case)
Is this a case the code currently doesn't take into account or am I missing something else?
Hi,
While using the MCU as a Modbus TCP master, trying to read 8 or less coils from a slave throws ERR_BAD_SIZE. I'm using pyModSlave as a slave.
I checked that request and response ADUs are correct with Wireshark, and also that the buffer in 'TCPgetRxBuffer' (Modbus.c) matches with the response ADU.
Debugging 'TCPgetRxBuffer' function, I noticed that in line 997 there is this condition:
if (buflen>11) { // minimum frame size for modbus TCP
In the case I described above, buffer length is exactly 10 bytes:
Transaction ID (2 bytes) + Protocol ID (2 bytes) + N.º following bytes (2 bytes) + Slave ID (1 byte) + Function Code (1 byte) + Data length (1 byte) + Data (1 byte in this case)
Is this a case the code currently doesn't take into account or am I missing something else?