It’s the library, that handles all Arduino modbus. (i am on v1.0.3)
made a small test program:
#include <ModbusRtu.h>
#define TXEN 3
//int16_t au16data[4] = { 1, 2, 3, -10024 }; //no errors
int16_t au16data[4] = { 1, 2, 3, -10004 }; //CRC errors
Modbus slave(7, Serial,TXEN); // this is slave @1 and RS-485
void setup() {
Serial.begin( 2* 9600 ); //arduino mini
slave.start();
}
void loop() {
slave.poll( au16data, 4 );
}
=> CRC-error:
2021-04-21 15:51:33.538 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 5 failed when executing request (ModbusReadRequestBlueprint [slaveId=7, functionCode=READ_MULTIPLE_REGISTERS, start=0, length=4, maxTries=5]). 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: 9 bytes:
07 03 08 00 01 00 02 00 03
[operation ID ef235475-fe3d-44f0-bce3-8d6e6eb2ab10]
And the things in OH3:
Bridge modbus:serial:Arduino1 [port="/dev/ttyUSBarduino",baud=9600,id=7, dataBits=8,parity="none",stopBits="1.0",encoding="rtu",echo=false,receiveTimeoutMillis=5000, connectMaxTries=3] {
Bridge poller ArdWC01 [ start=0, length=4, refresh=16011, maxTries=5, type="holding"] {
Thing data n0 [ readStart="0", readValueType="int16" ] //pin4 lilla_rød
Thing data n1 [ readStart="1", readValueType="int16" ] //pin4 lilla_rød
Thing data n2 [ readStart="2", readValueType="int16" ] //pin4 lilla_rød
Thing data n3 [ readStart="3", readValueType="int16" ] //pin4 lilla_rød
}
}
Will see if i get time to look more into it tomorrow.
(The code inside library and bindings is way beyond my head though)