I’m having an issue with the MODBUS binding and the connection randomly dropping out and generating excessive errors in the log. I am running OH2.4 on a Raspberry Pi 3 B+ on the OpenHabian distribution and connecting to the HVAC Zone controller via a USB>RS485 adaptor so I can control the HVAC via MODBUS.
I’ve added in the binding for the RTU via the Serial Slave thing (Which always says ONLINE even if I pick an alternative port) but the issue is once I add in a regular poll.
In short, the longer the length is set to, the more frequently it goes offline to the point of being constantly offline if I am trying to poll around 30 or more registers (I need to poll about 90 registers in total to get access to all registers that I need). I attempted to cut down how many registers I was accessing by creating multiple pollers that were only checking the bare minimum (4 registers per zone) to be functional but by the time I had 4 zones setup (4 x 4 registers being polled) there was a constant altering of which zone was appearing offline. At present I have it setup with only 2 zones polling the 4 registers but the log is full of CRC and EOF errors. This alternates between a few seconds apart to several minutes apart and I cannot work out why.
To rule out hardware faults I tested the USB adaptor connected to a Windows laptop running CAS MODBUS Scanner which was able to poll 100 registers within a second.
==> /var/log/openhab2/openhab.log <==
2019-07-16 14:24:05.038 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 03 00 60 00 04 44 17
2019-07-16 14:24:05.042 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes:
2019-07-16 14:24:05.048 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/1 error: I/O exception: IOException CRC Error in received frame: 0 bytes: . Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@11532a0 (unit id 1 & transaction 44715). Serial parameters: SerialParameters@2c2f7d[portName=/dev/ttyUSB0,baudRate=19200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2019-07-16 14:24:05.053 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 1, throwing last error: I/O exception: IOException CRC Error in received frame: 0 bytes: . Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@11532a0 (unit id 1 & transaction 44715). Serial parameters: SerialParameters@2c2f7d[portName=/dev/ttyUSB0,baudRate=19200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2019-07-16 14:24:05.060 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@1003ba3[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=96,length=4,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException CRC Error in received frame: 0 bytes: [operation ID c7cc1064-4ff4-471c-9249-260c37617374]
==> /var/log/openhab2/openhab.log <==
2019-07-16 14:32:02.520 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 03 00 60 00 04 44 17
2019-07-16 14:32:02.523 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: null
2019-07-16 14:32:02.526 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/1 error: I/O exception: EOFException null. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@12c62c6 (unit id 1 & transaction 46488). Serial parameters: SerialParameters@2c2f7d[portName=/dev/ttyUSB0,baudRate=19200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2019-07-16 14:32:02.528 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 1, throwing last error: I/O exception: EOFException null. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@12c62c6 (unit id 1 & transaction 46488). Serial parameters: SerialParameters@2c2f7d[portName=/dev/ttyUSB0,baudRate=19200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
2019-07-16 14:32:02.531 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@1003ba3[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=96,length=4,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: EOFException null [operation ID 4b957a3d-4d28-4e70-8e5f-94259bc392b9]
NOTE: I am aware the logs and the screenshot from CAS show different BAUD rates. I tried lower and higher to rule out that as a problem. Also CAS does not have a 0 offset so the value of 81 in OH appears as 82 and so on in the screenshot.