Detailed logs…
Bridge modbus:serial:vva_bsp "VVA Broadcast" [port="/dev/ttyUSB0", id=0, baud=115200, stopBits="1.0", parity="even", dataBits=8, encoding="rtu", echo=false, receiveTimeoutMillis=500, flowControlIn="none", flowControlOut="none", timeBetweenTransactionsMillis=50, connectMaxTries=2, connectTimeoutMillis=1000]
{
Thing data vva_bsp_time_sync "BSP time sync" [writeTransform="JS(vva_ts_rpc_time_sync.js)"]
}
The connectMaxTries=2 is just to be “the same” as all the other bridges.
2021-01-07 07:40:30.801 [DEBUG] [t.wimpi.modbus.io.ModbusRTUTransport] - Sent: 00 10 00 40 00 05 0a 28 1e 00 07 01 07 00 15 aa 55 7d 42
==> /var/log/openhab2/events.log <==
2021-01-07 07:40:30.677 [.event.RuleStatusInfoEvent] - d1a57a97-d28f-4755-b3fc-5c8367454eec updated: RUNNING
2021-01-07 07:40:30.679 [ome.event.ItemCommandEvent] - Item 'itm_vva_bsp_time_sync' received command 43605
2021-01-07 07:40:30.692 [.event.RuleStatusInfoEvent] - d1a57a97-d28f-4755-b3fc-5c8367454eec updated: IDLE
2021-01-07 07:40:30.694 [nt.ItemStatePredictedEvent] - itm_vva_bsp_time_sync predicted to become 43605
==> /var/log/openhab2/openhab.log <==
2021-01-07 07:40:31.306 [DEBUG] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 00 10 00 40 00 05 0a 28 1e 00 07 01 07 00 15 aa 55 7d 42
##### This line indicates the problem, the binding expects a response even though ID=0
2021-01-07 07:40:31.308 [DEBUG] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)
2021-01-07 07:40:31.312 [DEBUG] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/1 error: I/O exception: IOException Error reading response (EOF). Request: net.wimpi.modbus.msg.WriteMultipleRegistersRequest@1a80aa (unit id 0 & transaction 158). Serial parameters: SerialParameters@17077d5[portName=/dev/ttyUSB0,baudRate=115200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=500]
2021-01-07 07:40:31.314 [DEBUG] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 1, throwing last error: I/O exception: IOException Error reading response (EOF). Request: net.wimpi.modbus.msg.WriteMultipleRegistersRequest@1a80aa (unit id 0 & transaction 158). Serial parameters: SerialParameters@17077d5[portName=/dev/ttyUSB0,baudRate=115200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=500]
2021-01-07 07:40:31.316 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 2 failed when executing request (ModbusWriteRegisterRequestBlueprint@1404955[slaveId=0,reference=64,functionCode=WRITE_MULTIPLE_REGISTERS,registers=ModbusRegisterArrayImpl(28 1e 00 07 01 07 00 15 aa 55),maxTries=2]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException Error reading response (EOF) [operation ID 712cbe65-e51c-4e40-b1f4-013cdb325432]
2021-01-07 07:40:31.431 [DEBUG] [t.wimpi.modbus.io.ModbusRTUTransport] - Sent: 00 10 00 40 00 05 0a 28 1e 00 07 01 07 00 15 aa 55 7d 42
2021-01-07 07:40:31.934 [DEBUG] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 00 10 00 40 00 05 0a 28 1e 00 07 01 07 00 15 aa 55 7d 42
2021-01-07 07:40:31.935 [DEBUG] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: Error reading response (EOF)
2021-01-07 07:40:31.938 [DEBUG] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/1 error: I/O exception: IOException Error reading response (EOF). Request: net.wimpi.modbus.msg.WriteMultipleRegistersRequest@1a285e (unit id 0 & transaction 159). Serial parameters: SerialParameters@6bf61e[portName=/dev/ttyUSB0,baudRate=115200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=500]
2021-01-07 07:40:31.940 [DEBUG] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 1, throwing last error: I/O exception: IOException Error reading response (EOF). Request: net.wimpi.modbus.msg.WriteMultipleRegistersRequest@1a285e (unit id 0 & transaction 159). Serial parameters: SerialParameters@6bf61e[portName=/dev/ttyUSB0,baudRate=115200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=500]
2021-01-07 07:40:31.941 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 2 failed when executing request (ModbusWriteRegisterRequestBlueprint@1404955[slaveId=0,reference=64,functionCode=WRITE_MULTIPLE_REGISTERS,registers=ModbusRegisterArrayImpl(28 1e 00 07 01 07 00 15 aa 55),maxTries=2]). Aborting. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException Error reading response (EOF) [operation ID 712cbe65-e51c-4e40-b1f4-013cdb325432]
2021-01-07 07:40:31.985 [DEBUG] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:vva_bsp:vva_bsp_time_sync 'BSP time sync' had ModbusSlaveIOExceptionImpl error on write: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException Error reading response (EOF)', cause2=null)
2021-01-07 07:40:31.992 [DEBUG] [rt.modbus.internal.ModbusManagerImpl] - Modbus operation ended, timing info: {total: 1209 ms, connection: 98, transaction=1065, callback=7} [operation ID 712cbe65-e51c-4e40-b1f4-013cdb325432]
==> /var/log/openhab2/events.log <==
2021-01-07 07:40:31.992 [hingStatusInfoChangedEvent] - 'modbus:data:vva_bsp:vva_bsp_time_sync' changed from OFFLINE (COMMUNICATION_ERROR): Error (ModbusSlaveIOExceptionImpl) with write. Request: ModbusWriteRegisterRequestBlueprint@135de17[slaveId=0,reference=64,functionCode=WRITE_MULTIPLE_REGISTERS,registers=ModbusRegisterArrayImpl(28 00 00 07 01 07 00 15 aa 55),maxTries=2]. Description: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException Error reading response (EOF)', cause2=null). Message: Modbus IO Error with cause=ModbusIOException, EOF=false, message='I/O exception: IOException Error reading response (EOF)', cause2=null to OFFLINE (COMMUNICATION_ERROR): Error (ModbusSlaveIOExceptionImpl) with write. Request: ModbusWriteRegisterRequestBlueprint@1404955[slaveId=0,reference=64,functionCode=WRITE_MULTIPLE_REGISTERS,registers=ModbusRegisterArrayImpl(28 1e 00 07 01 07 00 15 aa 55),maxTries=2]. Description: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: IOException Error reading response (EOF)', cause2=null). Message: Modbus IO Error with cause=ModbusIOException, EOF=false, message='I/O exception: IOException Error reading response (EOF)', cause2=null
Basically what is missing in the binding is:
Normally when you SEND a modbus message you update the modbus state to “Reply time out” so you wait until you get a reply from the slave before raising the “no reply error” (or you handle the reply if a reply comes in).
When you send a broadcast you don’t go to state “reply time out delay” but you head for state “message turn around delay”. In the standard the state machine “2.4.1 Master State diagram” explains that clearly.
It’s probably easy to “fix” in the error handler (check for ID=0 in the sent frame and not generate no reply error on expiry of reply time out) or switch state to “turn around delay” after sending the message out and ignore error handling all together.
I have no experience in java but I wrote a modbus master/slave in C for ARM so I’m willing to help getting this to work as per standard.