Modbus error messages

I am trying to get modbus to work, however I am unsure which of these 5 things that could be the problem:

  1. Wrong USB port
  2. Wrong wiring of the USB dongle(D1 and D0 swapped)
  3. Bad USB dongle
  4. Wrong register
  5. Binding not correctly configured

I installed the binding-modbus1 - 1.9.0 binding with the paper UI and then deleted the file: /etc/openhab2/services/modbus.cfg that was automatically generated with this:

serial.fan.connection=/dev/ttyUSB0:9600:8:none:1:rtu:35:5000
serial.fan.id=1
serial.fan.start=100
serial.fan.length=38
serial.fan.type=holding

I am struggeling to get it to work… It throws me a lot of errors:

17:41:09.741 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 03 00 64 00 26 85 cf
17:41:09.742 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes:
17:41:09.744 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@dac561 (unit id 1 & transaction 249). Serial parameters: SerialParameters@858d5[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=5000]
17:41:09.792 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 03 00 64 00 26 85 cf
17:41:09.794 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes:
17:41:09.796 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 2/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@dac561 (unit id 1 & transaction 249). Serial parameters: SerialParameters@858d5[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=5000]
17:41:09.844 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 03 00 64 00 26 85 cf
17:41:09.845 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes:
17:41:09.847 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 3/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@dac561 (unit id 1 & transaction 249). Serial parameters: SerialParameters@858d5[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=5000]
17:41:09.849 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 3, throwing last error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@dac561. Serial parameters: SerialParameters@858d5[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=5000]
17:41:09.858 [ERROR] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (fan): Error getting modbus data for request net.wimpi.modbus.msg.ReadMultipleRegistersRequest@dac561. Error: I/O exception - failed to read. Endpoint ModbusSerialSlaveEndpoint@5fe948[portName=/dev/ttyUSB0]. Connection: SerialConnection@1c4776d[portName=/dev/ttyUSB0,port=/dev/ttyUSB0]
17:41:10.100 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 03 00 64 00 26 85 cf
17:41:10.105 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes:
17:41:10.109 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@934ace (unit id 1 & transaction 250). Serial parameters: SerialParameters@858d5[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=5000]
17:41:10.157 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 03 00 64 00 26 85 cf
17:41:10.158 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes:
17:41:10.160 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 2/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@934ace (unit id 1 & transaction 250). Serial parameters: SerialParameters@858d5[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=5000]
17:41:10.208 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 01 03 00 64 00 26 85 cf
17:41:10.209 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes:
17:41:10.211 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 3/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@934ace (unit id 1 & transaction 250). Serial parameters: SerialParameters@858d5[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=5000]
17:41:10.214 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 3, throwing last error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@934ace. Serial parameters: SerialParameters@858d5[portName=/dev/ttyUSB0,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=5000]

Does this means that the USB port is wrong or is it something else?
I tried doing this:

|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 4                                                                                        80M
        |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=usbfs, 12M

then I plugged in the dongle

[17:28:12] pi@openHABianPi2:~$ sudo lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
        |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=usbfs, 12M
        |__ Port 4: Dev 5, If 0, Class=Vendor Specific Class, Driver=ch341, 12M
[17:33:07] pi@openHABianPi2:~$  ls /dev/tty*
/dev/tty    /dev/tty13  /dev/tty19  /dev/tty24  /dev/tty3   /dev/tty35  /dev/tty40  /dev/tty46  /dev/tty51  /dev/tty57  /dev/tty62    /dev/ttyprintk
/dev/tty0   /dev/tty14  /dev/tty2   /dev/tty25  /dev/tty30  /dev/tty36  /dev/tty41  /dev/tty47  /dev/tty52  /dev/tty58  /dev/tty63    /dev/ttyS0
/dev/tty1   /dev/tty15  /dev/tty20  /dev/tty26  /dev/tty31  /dev/tty37  /dev/tty42  /dev/tty48  /dev/tty53  /dev/tty59  /dev/tty7     /dev/ttyUSB0
/dev/tty10  /dev/tty16  /dev/tty21  /dev/tty27  /dev/tty32  /dev/tty38  /dev/tty43  /dev/tty49  /dev/tty54  /dev/tty6   /dev/tty8
/dev/tty11  /dev/tty17  /dev/tty22  /dev/tty28  /dev/tty33  /dev/tty39  /dev/tty44  /dev/tty5   /dev/tty55  /dev/tty60  /dev/tty9
/dev/tty12  /dev/tty18  /dev/tty23  /dev/tty29  /dev/tty34  /dev/tty4   /dev/tty45  /dev/tty50  /dev/tty56  /dev/tty61  /dev/ttyAMA0
[17:35:40] pi@openHABianPi2:~$ dmesg | grep tty
[    0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa02082 bcm2709.serial=0xc6cdb751 smsc95xx.macaddr=B8:27:EB:CD:B7:51 bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3ea00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 elevator=deadline net.ifnames=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
[    0.001317] console [tty1] enabled
[    0.839016] console [ttyS0] disabled
[    0.840403] 3f215040.uart: ttyS0 at MMIO 0x3f215040 (irq = 59, base_baud = 31250000) is a 16550
[    1.621370] console [ttyS0] enabled
[    3.474022] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[   10.049806] systemd[1]: Expecting device dev-ttyS0.device...
[   10.557358] systemd[1]: Starting system-getty.slice.
[   10.566884] systemd[1]: Created slice system-getty.slice.
[   10.574352] systemd[1]: Starting system-serial\x2dgetty.slice.
[   10.584749] systemd[1]: Created slice system-serial\x2dgetty.slice.
[  641.323074] usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
[  694.578890] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[197120.581891] [  490]     0   490     1110       30       6       0        0             0 agetty
[197120.594687] [  511]     0   511     1370      220       7       0        0             0 agetty
[391518.767389] [  490]     0   490     1110       30       6       0        0             0 agetty
[391518.779894] [  511]     0   511     1370       30       7       0        0             0 agetty
[578720.176689] [  490]     0   490     1110       30       6       0        0             0 agetty
[578720.189125] [  511]     0   511     1370       29       7       0        0             0 agetty
[762320.608835] [  490]     0   490     1110       30       6       0        0             0 agetty
[762320.621248] [  511]     0   511     1370       29       7       0        0             0 agetty
[775046.477450] usb 1-1.4: ch341-uart converter now attached to ttyUSB0

I know this is correct : 9600:8:none:1 so which of the 5 cases could it be?

Use the 1.10 binding version. I think it has some improvements in error logging.

There is no way to tell from here what is wrong. You’ll need to do further diagnostics. The logs you do have suggest that OH finds the USB adaptor okay, but cannot find the mystery remote Modbus device.

Has this device ever worked across Modbus with some other hardware/software? Have you any other Modbus device to try with OH? Is anything fitted with twinkly lights? The OH binding troubleshooting section is worth looking at. Simplify - start out by reading just one register.

This seems not to be available in the paperUI, i will upgrade the OH2 instalation so that the market place addins will be searchable, I guess thats where I will find it right?

I don’t know if it is in marketplace. I think you may have to install it manually from https://openhab.ci.cloudbees.com/job/openHAB1-Addons/lastSuccessfulBuild/artifact/bundles/binding/org.openhab.binding.modbus/target/

If you are just starting out with Modbus, consider using the new Modbus 2 instead

I am trying to control my HVAC: MODBUS and System air

Is the configuration of the modbus 2.0 binding differnet(I know basically nothing about modbus at all) compared to 1.10?

Yes, 2.x binding setup is very different. As you are trying to reproduce someone elses working 1.x setup, I would not recommend going that way for now.

Is there a way I can test if my wiring are correct? Using a multimeter or oscilloscope?

Sure. You’d have to be skilled with a scope to actually “see the data”, but with a meter you can check at least the idle state of the serial line and perhaps on VAC setting see the ‘twitch’ of data packets.

That doesn’t tell you if the data makes sense (baud rate etc.) nor if the slave is responding. If you have an old laptop or such you can make a serial monitor with a cheap USB-RS485 adaptor and RS232 monitor software