Problem with Waveshare 2-CH RS485 HAT and Modbus Binding

Hello OH Community,

i have connected the Waveshare 2-CH RS485 HAT and installed it correctly like in the Description of the Manual. It is installed over SPI and u have two more Serial Ports /dev/ttySC0 and /dev/ttySC1

sudo nano /boot/config.txt
Add the line below to the file, the int_pin should be set according to the actual welding:
dtoverlay=sc16is752-spi1,int_pin=24
Then restart Raspberry Pi
sudo reboot

The Testfile to check the Channels was successful.

Now i tried to install the Modbus Binding OH.2.5.8 without success.
in my file: /etc/default/openhab2
i added:

EXTRA_JAVA_OPTS=“-Dgnu.io.rxtx.SerialPorts=/dev/ttySC0:/dev/ttySC1:/dev/ttyAMA0:/dev/ttyS0”

user rights seems to bee okay too:

[17:21:55] openhabian@openhab:~$ ls -l /dev/ttySC*
crw-rw---- 1 root dialout 240, 0 Dec 31 16:49 /dev/ttySC0
crw-rw---- 1 root dialout 240, 1 Dec 31 16:49 /dev/ttySC1

I got the following error message in the openhab log.

2020-12-31 17:17:06.826 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/1 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@70fc3d[portName=/dev/ttySC1,port=]. Endpoint ModbusSerialSlaveEndpoint@a08605[portName=/dev/ttySC1]

2020-12-31 17:17:06.828 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - re-connect reached max tries 1, throwing last error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@70fc3d[portName=/dev/ttySC1,port=]. Endpoint ModbusSerialSlaveEndpoint@a08605[portName=/dev/ttySC1]

2020-12-31 17:17:06.830 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection SerialConnection@70fc3d[portName=/dev/ttySC1,port=] for endpoint ModbusSerialSlaveEndpoint@a08605[portName=/dev/ttySC1]: Could not get port identifier, maybe insufficient permissions. null

Any Idea?

That depends on the groups for the openhab user.

i think these are the important Groups for openhab user or which are missing?

dialout:x:20:openhabian,openhab
tty:x:5:openhab,openhabian
spi:x:999:openhabian,openhab

I found something that new.

dmesg | grep tty

[ 0.000866] printk: console [tty1] enabled
[ 2.445141] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, base_baud = 0) is a PL011 rev2

doesn’t show me the ttySC0 and ttySC1 Port. So they are not available in Openhab.

With the following line i can see that they are installed.

[20:33:54] openhabian@openhab:~$ ls /dev/ttyS*
/dev/ttyS0 /dev/ttySC0 /dev/ttySC1