ModbusTCP connection unexpectedly closed, TRB145

Using TRB145 as ModbusTCP/RTU GW (modbustcp_over_serial). It seems, that the timeout to close the connection is too short, because the response from RS485 may arrive later than TRB145 expects. And why to close the connection after all, can it be kept open?

See the log below, reading unit 11 registers 19…20 (using a pymodbus based tool):

read(11,19,2)
2025-01-24 09:23:50,552 - SEND: 00 20 00 00 00 06 0B 03 00 13 00 02
Holding register read exception: Modbus Error: [Connection] ModbusTcpClient(10.203.0.18:502): Connection unexpectedly closed 0.267093 seconds into read of 8 bytes without response from unit before it closed connection

read(11,19,2)
2025-01-24 09:23:59,231 - SEND: 00 21 00 00 00 06 0B 03 00 13 00 02
Holding register read exception: Modbus Error: [Connection] ModbusTcpClient(10.203.0.18:502): Connection unexpectedly closed 0.264148 seconds into read of 8 bytes without response from unit before it closed connection

read(11,19,2)
2025-01-24 09:24:04,512 - SEND: 00 22 00 00 00 06 0B 03 00 13 00 02
2025-01-24 09:24:04,692 - RECV: 00 22 00 00 00 07 0B 03 04 00 00 00 3F
[0, 63]

read(11,19,2)
2025-01-24 09:24:10,657 - SEND: 00 23 00 00 00 06 0B 03 00 13 00 02
2025-01-24 09:24:10,772 - RECV: 00 23 00 00 00 07 0B 03 04 00 00 00 BD
[0, 189]

read(11,19,2)
2025-01-24 09:24:15,857 - SEND: 00 24 00 00 00 06 0B 03 00 13 00 02
Holding register read exception: Modbus Error: [Connection] ModbusTcpClient(10.203.0.18:502): Connection unexpectedly closed 0.191711 seconds into read of 8 bytes without response from unit before it closed connection

read(11,19,2)
2025-01-24 09:24:19,542 - SEND: 00 25 00 00 00 06 0B 03 00 13 00 02
Holding register read exception: Modbus Error: [Connection] ModbusTcpClient(10.203.0.18:502): Connection unexpectedly closed 0.214101 seconds into read of 8 bytes without response from unit before it closed connection

fw TRB1_R_00.07.06.4

additional information: the latest FW 07.12 is not any better.

RTU slave is always answering, I can see it on TX/RX leds on the slave device. Also, there are no problems at all if I communicate with the slave via USB/RS485 cable.

also CRC control disabling has no effect.
the latest fw has timeout parameter, tried 5 and 10 s there, no diff.

It seems to me there is some dependency on query/answer content, bc some of the registers are easier to read than the others. see below polling reg 13 vs reg 15.

read(11,13,2)
[0, 0]
read(11,13,2)
[0, 0]
read(11,13,2)
[0, 0]
read(11,15,2)
ERROR:controller.comm_modbus:Error: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)
read(11,15,2)
ERROR:controller.comm_modbus:Error: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
read(11,15,2)
ERROR:controller.comm_modbus:Error: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response

repeating serial message does not help either (tried value 1).
the longer the message response (the number of registers), the harder to read:

read(11,13,4)
ERROR:controller.comm_modbus:Error: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response

tried also RUT955, which does not have such a problem. therefore, it’s clearly a TRB145 problem. pls fix.

read(11,0,8) # on RUT955
[0, 0, 1, 5609, 0, 350, 65535, 65294] # succcess

One additional bit of information, perhaps important. Accessing TRB145 with ModbusTCP queries over OpenVPN, TRB is the client. Exactly the same way of access was used with RUT955, which behaved flawlessly.

looked at the line voltages with scope and it is clear, that the host is responding, but the response is mostly ignored by TRB145.
but could it be there is something wrong with the RS485/422 line driver of TRB145? the line voltages during query are different and spikey compared to the much nicer response. the lines is connected as instructed, 1-2 B, 3 GND, 4-5 A. no full duplex in setup.

there was no problem at all with RUT955, but I cannot take line voltages image from that any more.

with FTDI USB/RS485 cable the query waveform is different, close to the response, and no comm problems at all.

looked also at the RX pin of the driver chip inside TRB145. looks like it gets some data on query using fc 03 from slave 11 (0Bh). but other than the few first bytes seem corrupt, as the CRC (2 last bytes) is invalid.
the slave has resistors connected to the line, as it should: 120 Ohm between A-B, 1.8k from A to 5V, 1.8k from B to 0V.

have purchased RUT906 now for comparison. and it works well, see the signal on one RS485 line:

so my verdict is: TRB145 IS UNUSABLE, BECAUSE THE ONLY LOCAL INTERFACE IT HAS, IS FAULTY.