Drexel & Weiss Device Integration

I now use an RS232 shield on the GPIOs, Openhab3 on a Raspberry Pi 4. D&W also provided the D&W Modbus adapter for exchange on a trial basis. The 3-pole cable is shielded and 3m long. On the oscilloscope, I can see on the TXD when I send via ModPoll on the Raspberry. I do not get an answer from Drexel & Weiss.
If I try to send with the same setting with the Modbus binding, no signal is sent to the TXD.
The authorizations are actually set too.
I also tried several USB-RS232 adapters.
I’m slowly getting stuck.
Maybe someone can help me.

I have never tried to send RS232 directly from the Raspberry PI. As mentioned in the article, I used the LAN/RS232 converter, is a rather small investment. However if you really want to send RS232 directly with the raspberry this might help: The D&W device should answer, if you send valid data. On page 10 you find a valid example: Drexel und Weiss Modbus RTU. Unfortunately the CRC you need to calculate. Modbus address, mode and baudrate needs to beforehand set in the D&W device to correspond with your RS232 settings. If you even have an oscilloscope you can check if you receive the signal on the D&W TTL interface.

With the ModPoll program on the Raspberry, I am able to send data with the Serial Hat. With Openhab, however, I am not able to send anything over the same interface. Of course I have set the connection settings Parity, Stopbit, and so on. I have not yet calculated the CRC. I assumed that the Modbus binding would do that for me …

Show us the settings that worked there.

Show us the settings you used there.

Show us your openhab.log for the failure.

[ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 2/100 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@112170a[portName=/dev/serial0,port=]. Endpoint ModbusSerialSlaveEndpoint@c9baee[portName=/dev/serial0]

What does it do for try number 1? I’m trying to find out if it never connects, or fails to re-connect.

Number 1 was the same…

Directly after reboot:
2021-03-02 22:31:33.898 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing ‘modbus:serial:3c6b556ac8’ changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)

That’s not the same, and it’s not connect try 1/100.

I’m inclined to think the second message tells you the truth -you’ve got permissions issues on the serial port (which will result in Things not initializing).

2021-03-02 15:50:12.539 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/100 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@1b774b5[portName=/dev/serial0,port=]. Endpoint ModbusSerialSlaveEndpoint@34f97e[portName=/dev/serial0]

I had already thought of an authorization error

That’s good, what did you do about it? I wonder why you didn’t say before.

The serial binding docs used to have a usefule section on permissions, but gone now.
Old notes, still valid -
https://docs.openhab.org/v2.2/addons/bindings/serial1/readme.html#port-configuration-notes

I entered the Java command line arguments as well as Extra_java_opts.
I also added Openhab dialout to the user group and restarted it.
No success so far:
2021-03-09 21:35:06.716 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/100 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@19f7eef[portName=/dev/serial,port=]. Endpoint ModbusSerialSlaveEndpoint@11519a8[portName=/dev/serial]

Is your port really named “serial”? I don’t know *nix stuff, but think you can use ls console commands to see what’s available to who.

I can address the serial interface with / dev / ttyAMA0 and also with / dev / serial or / dev / serial0. With the Modpoll program, I can also send it to the Raspberry

Well, the modbus binding cannot get hold of that serial port. Either something else has hold of it, or the openhab user isn’t allowed.

Try starting adding a Modbus Serial Thing in the UI, and see what you are offered in the “Serial Port” dropdown, a list of ports that openHAB can see.

/ dev / ttyAMA0 is offered. However, I have tried this several times.
There is still no output to be seen on the oscilloscope and the following is still in the Openhab log:
2021-03-12 20:40:16.963 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/100 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@1868773[portName=/dev/ttyAMA0,port=]. Endpoint ModbusSerialSlaveEndpoint@e4a557[portName=/dev/ttyAMA0]

when I restart Openhab, I also get answers on the oscilloscope.
In the Openhab log 9 attempts:
2021-03-12 20:50:19.825 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 80 failed when executing request (ModbusReadRequestBlueprint@4305ec[slaveId=130,functionCode=READ_COILS,start=202,length=2,maxTries=80]). 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 64b445ad-3fde-4ea4-91aa-05ece7463390]

That’s big step forward :smiley:

It’s reporting a read error, something outside of openhab. Check your Serial Bridge settings.

You have not yet said if you ever got an answer from the Drexel & Weiss when you use Modpoll for testing?

./modpoll -m rtu -a 140 -r 202 -c 2 -p none -t 3:hex -i -b 9600 -d 8 /dev/ttyAMA0
modpoll 3.9 - FieldTalk™ Modbus® Master Simulator
Copyright © 2002-2020 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: Modbus RTU, FC4
Slave configuration…: address = 140, start reference = 202, count = 2
Communication…: /dev/ttyAMA0, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms
Data type…: 16-bit register (hex), input register table
Word swapping…: Slave configured as big-endian word machine

– Polling slave… (Ctrl-C to stop)
Illegal Data Address exception response!
– Polling slave… (Ctrl-C to stop)
Illegal Data Address exception response!

I’m not sure if the command is 100% correct, but the answer I get is “Illegal data address exception response”
The slave ID is 130
Ventilation tab - outside air temperature: 202
Modbus RTU, baud rate 9600, data bit 8, stop bit 1, parity none

Thing “modbus serial” is online
Thing regular poll" is offline:
COMMUNICATION_ERROR

Error with read: org.openhab.core.io.transport.modbus.exception.ModbusConnectionException: Error connecting to endpoint ModbusSerialSlaveEndpoint@2935db[portName=/dev/ttyAMA0]

Not much point using that as a model to set upopenHAB yet.
Let’s see if we can make modpoll work to begin with, Modbus binding is clumsier for experimenting (because the assumption is that you know what you’re doing).

The good news is that modpoll got an intelligible response from the target slave.
This means serial port, baud, parity, slave ID are good. :smiley:

The bad news is the target slave said “No.” It has rejected your request for some reason - wrong type, address or number of registers.
You asked for 2 input type registers, starting at 202

Important: Modpoll uses modbus register numbers. These start at 1. Other software (such as openHAB) uses register addresses. These start at 0.
So 202 in modpoll is 201 in openHAB.

Many devices will reject attempts to poll 32 bit values, that span two 16-bit registers, if you start on the wrong odd/even address.

If you are trying to reproduce this from the first post here -

In modpoll you would use
modpoll -m rtu -a 140 -r 203 -c 2 -p none -t 3:hex -i -b 9600 -d 8 /dev/ttyAMA0

wow … i got an answer:
./modpoll -m rtu -a 140 -r 203 -c 2 -p none -t 3:hex -i -b 9600 -d 8 /dev/ttyAMA0
modpoll 3.9 - FieldTalk™ Modbus® Master Simulator
Copyright © 2002-2020 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: Modbus RTU, FC4
Slave configuration…: address = 140, start reference = 203, count = 2
Communication…: /dev/ttyAMA0, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms
Data type…: 16-bit register (hex), input register table
Word swapping…: Slave configured as big-endian word machine

– Polling slave… (Ctrl-C to stop)
[203]: 0x0000
[204]: 0x1A1A

I would not have come up with the idea of a number higher or lower … If I start the query with register 201, I get answers for 201 and 202. If I query register 202, I get the error message "Illegal Data Address exception response ! "
This is a huge success for me!
Now the only question for me is how to enter the correct parameters in OpenHAB.

1 Like