You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Modbus Serial Listener is receiving a correct Request: 0B 03 07 D1 00 01 D5 ED as listed in the debug log on line 12.
This request is expected to be processed and answered.
Actual Behavior
Actually the request is discarded because of a CRC error, although the CRC values are correct
Steps to Reproduce the Problem
Connected a Huawei PV Inverter to a RaspberryPi via a WaveShare USB2rs485 adapter
The inverter permanently sends request to Modbus id 11 like the one shown above
All those requests are discarded due to CRC errors
See the log attached for the full debug log from the testing session
Find additional log messages which I have added to the code of ModbusRTUTransport.readRequestIn to understand the cause of the problem
According to my analysis the inBuffer used for the CRC check contains different data than byteInputOutputStream.getBuffer() which holds correct request
Specifications
Version: 3.2.2-SNAPSHOT (also tested with 3.2.1)
Platform: Debian GNU/Linux 11 (bullseye)
Subsystem: ModbusRTU
Baud rate is 9600, maybe the other open ticket is also relevant for this issue, although I tries the proposed fix, which did not resolve my issue liessman-sem.log
Code with additional log messages
if (logger.isDebugEnabled()) {
logger.debug("Request: {}", ModbusUtil.toHex(byteInputOutputStream.getBuffer(), 0, dlength + 2));
logger.debug("inBuffer: {}", ModbusUtil.toHex(inBuffer, 0, dlength + 2));
}
byteInputStream.reset(inBuffer, dlength);
if (logger.isDebugEnabled()) {
logger.debug("after reset: {}", ModbusUtil.toHex(inBuffer, 0, dlength + 2));
}
// check CRC
int[] crc = ModbusUtil.calculateCRC(inBuffer, 0, dlength); // does not include CRC
if (ModbusUtil.unsignedByteToInt(inBuffer[dlength]) != crc[0] || ModbusUtil.unsignedByteToInt(inBuffer[dlength + 1]) != crc[1]) {
if (logger.isDebugEnabled()) {
logger.debug("CRC should be {}, {} inBuffer={}", Integer.toHexString(crc[0]), Integer.toHexString(crc[1]),
ModbusUtil.toHex(inBuffer, 0, dlength + 2));
}
The text was updated successfully, but these errors were encountered:
Expected Behavior
The Modbus Serial Listener is receiving a correct Request: 0B 03 07 D1 00 01 D5 ED as listed in the debug log on line 12.
This request is expected to be processed and answered.
Actual Behavior
Actually the request is discarded because of a CRC error, although the CRC values are correct
Steps to Reproduce the Problem
Specifications
liessman-sem.log
Code with additional log messages
The text was updated successfully, but these errors were encountered: