3cky / mbusd

Open-source Modbus TCP to Modbus RTU (RS-232/485) gateway.
BSD 3-Clause "New" or "Revised" License
575 stars 219 forks source link

Mbusd keeps disconnecting a Growatt MIN 2500 TL-XH inverter #114

Open mdk2412 opened 1 week ago

mdk2412 commented 1 week ago

Hello,

first of all, great piece of software, just what I needed. I started using mbusd to read out my Eastron SDM630 meter, which worked perfectly. Mbusd runs on a raspberry pi 1 B+, RS485 connection via a USB adapter, data are processed by an iobroker installation using modbus adapter.

However, I have now changed this setup on the mbusd side to communicate with my solar inverter instead and let the Eastron talk directly to the inverter (the latter works flawlessly). No errors are logged, however mbusd now keeps disconnecting almost instantly permanently. Values get through in either direction sporadically, i.e. both holding and input registers are in principle working.

I suspect that the inverter is responsible for the problems. However, is there any setting that I could adapt to maintain the connection? Here is a part of the log (verbose level 9):

19 Nov 2024 07:31:41 mbusd-0.5.3 started...
19 Nov 2024 07:31:41 tty: trying to open /dev/serial/rs485 (speed 9600 mode 8n1)
19 Nov 2024 07:31:41 tty: state now is TTY_PAUSE
19 Nov 2024 07:31:41 conn_loop(): select(): max_sd = 4, t_out = 000000:100000 
19 Nov 2024 07:31:42 conn_loop(): select() returns 0 
19 Nov 2024 07:31:42 tty: state now is TTY_READY
19 Nov 2024 07:31:42 conn_loop(): select(): max_sd = 4, t_out = 000060:000000 
19 Nov 2024 07:31:57 conn_loop(): select() returns 1 
19 Nov 2024 07:31:57 conn_open(): accepting connection from 10.9.11.60
19 Nov 2024 07:31:57 queue_new_elem(): length now is 1
19 Nov 2024 07:31:57 conn[10.9.11.60]: state now is CONN_HEADER
19 Nov 2024 07:31:57 conn_loop(): select(): max_sd = 5, t_out = 000060:000000 
19 Nov 2024 07:31:57 conn_loop(): select() returns 1 
19 Nov 2024 07:31:57 conn[10.9.11.60]: state now is CONN_RQST_FUNC
19 Nov 2024 07:31:57 conn_loop(): select(): max_sd = 5, t_out = 000060:000000 
19 Nov 2024 07:31:57 conn_loop(): select() returns 1 
19 Nov 2024 07:31:57 conn[10.9.11.60]: read request fc 4
19 Nov 2024 07:31:57 conn[10.9.11.60]: state now is CONN_RQST_TAIL
19 Nov 2024 07:31:57 conn[10.9.11.60]: request: [01][04][0b][b8][00][03]
19 Nov 2024 07:31:57 conn[10.9.11.60]: state now is CONN_TTY
19 Nov 2024 07:31:57 tty: state now is TTY_RQST
19 Nov 2024 07:31:57 conn_loop(): select(): max_sd = 4, t_out = 000060:000000 
19 Nov 2024 07:31:57 conn_loop(): select() returns 1 
19 Nov 2024 07:31:57 tty: written 8 bytes
19 Nov 2024 07:31:57 tty: request written (total 8 bytes)
19 Nov 2024 07:31:57 tty: state now is TTY_RESP
19 Nov 2024 07:31:57 tty: estimated 11 bytes, waiting 119791 usec
19 Nov 2024 07:31:57 conn_loop(): select(): max_sd = 4, t_out = 000000:119791 
19 Nov 2024 07:31:57 conn_loop(): select() returns 0 
19 Nov 2024 07:31:57 tty: response timeout
19 Nov 2024 07:31:57 tty: attempt to retry request (1 of 3)
19 Nov 2024 07:31:57 tty: state now is TTY_RQST
19 Nov 2024 07:31:57 tty: written 8 bytes
19 Nov 2024 07:31:57 tty: request written (total 8 bytes)
19 Nov 2024 07:31:57 tty: state now is TTY_RESP
19 Nov 2024 07:31:57 tty: estimated 11 bytes, waiting 119791 usec
19 Nov 2024 07:31:57 conn_loop(): select(): max_sd = 4, t_out = 000000:119791 
19 Nov 2024 07:31:57 conn_loop(): select() returns 1 
19 Nov 2024 07:31:57 tty: read 11 bytes
19 Nov 2024 07:31:57 tty: rx offset is 0
19 Nov 2024 07:31:57 tty: read 11 bytes of 11, offset 0
19 Nov 2024 07:31:57 tty: state now is TTY_PROC
19 Nov 2024 07:31:57 tty: response read (total 11 bytes, offset 0 bytes)
19 Nov 2024 07:31:57 tty: response is correct
19 Nov 2024 07:31:57 tty: response: [01][04][06][00][01][00][00][00][00][5d][53]
19 Nov 2024 07:31:57 conn[10.9.11.60]: state now is CONN_RESP
19 Nov 2024 07:31:57 tty: state now is TTY_PAUSE
19 Nov 2024 07:31:57 conn_loop(): select(): max_sd = 5, t_out = 000000:100000 
19 Nov 2024 07:31:57 conn_loop(): select() returns 1 
19 Nov 2024 07:31:57 conn[10.9.11.60]: state now is CONN_HEADER
19 Nov 2024 07:31:57 conn_loop(): select(): max_sd = 5, t_out = 000000:092128 
19 Nov 2024 07:31:57 conn_loop(): select() returns 1 
19 Nov 2024 07:31:57 conn[10.9.11.60]: state now is CONN_RQST_FUNC
19 Nov 2024 07:31:57 conn_loop(): select(): max_sd = 5, t_out = 000000:082073 
19 Nov 2024 07:31:57 conn_loop(): select() returns 1 
19 Nov 2024 07:31:57 conn[10.9.11.60]: read request fc 4
19 Nov 2024 07:31:57 conn[10.9.11.60]: state now is CONN_RQST_TAIL
19 Nov 2024 07:31:57 conn[10.9.11.60]: request: [01][04][0c][63][00][0b]
19 Nov 2024 07:31:57 conn[10.9.11.60]: state now is CONN_TTY
19 Nov 2024 07:31:57 conn_loop(): select(): max_sd = 4, t_out = 000000:074309 
19 Nov 2024 07:31:58 conn_loop(): select() returns 0 
19 Nov 2024 07:31:58 tty: state now is TTY_RQST
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 4, t_out = 000060:000000 
19 Nov 2024 07:31:58 conn_loop(): select() returns 1 
19 Nov 2024 07:31:58 tty: written 8 bytes
19 Nov 2024 07:31:58 tty: request written (total 8 bytes)
19 Nov 2024 07:31:58 tty: state now is TTY_RESP
19 Nov 2024 07:31:58 tty: estimated 27 bytes, waiting 136458 usec
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 4, t_out = 000000:136458 
19 Nov 2024 07:31:58 conn_loop(): select() returns 1 
19 Nov 2024 07:31:58 tty: read 18 bytes
19 Nov 2024 07:31:58 tty: rx offset is 0
19 Nov 2024 07:31:58 tty: read 18 bytes of 27, offset 0
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 4, t_out = 000000:126795 
19 Nov 2024 07:31:58 conn_loop(): select() returns 1 
19 Nov 2024 07:31:58 tty: read 9 bytes
19 Nov 2024 07:31:58 tty: read 27 bytes of 27, offset 0
19 Nov 2024 07:31:58 tty: state now is TTY_PROC
19 Nov 2024 07:31:58 tty: response read (total 27 bytes, offset 0 bytes)
19 Nov 2024 07:31:58 tty: response is correct
19 Nov 2024 07:31:58 tty: response: [01][04][16][00][24][0e][8c][07][19][00][02][00][02][00][e1][00][00][00][00][01][18][00][00][00][00][9a][42]
19 Nov 2024 07:31:58 conn[10.9.11.60]: state now is CONN_RESP
19 Nov 2024 07:31:58 tty: state now is TTY_PAUSE
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 5, t_out = 000000:100000 
19 Nov 2024 07:31:58 conn_loop(): select() returns 1 
19 Nov 2024 07:31:58 conn[10.9.11.60]: state now is CONN_HEADER
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 5, t_out = 000000:093061 
19 Nov 2024 07:31:58 conn_loop(): select() returns 1 
19 Nov 2024 07:31:58 conn[10.9.11.60]: state now is CONN_RQST_FUNC
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 5, t_out = 000000:086372 
19 Nov 2024 07:31:58 conn_loop(): select() returns 1 
19 Nov 2024 07:31:58 conn[10.9.11.60]: read request fc 3
19 Nov 2024 07:31:58 conn[10.9.11.60]: state now is CONN_RQST_TAIL
19 Nov 2024 07:31:58 conn[10.9.11.60]: request: [01][03][0b][dc][00][01]
19 Nov 2024 07:31:58 conn[10.9.11.60]: state now is CONN_TTY
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 4, t_out = 000000:079209 
19 Nov 2024 07:31:58 conn_loop(): select() returns 0 
19 Nov 2024 07:31:58 tty: state now is TTY_RQST
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 4, t_out = 000060:000000 
19 Nov 2024 07:31:58 conn_loop(): select() returns 1 
19 Nov 2024 07:31:58 tty: written 8 bytes
19 Nov 2024 07:31:58 tty: request written (total 8 bytes)
19 Nov 2024 07:31:58 tty: state now is TTY_RESP
19 Nov 2024 07:31:58 tty: estimated 7 bytes, waiting 115624 usec
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 4, t_out = 000000:115624 
19 Nov 2024 07:31:58 conn_loop(): select() returns 0 
19 Nov 2024 07:31:58 tty: response timeout
19 Nov 2024 07:31:58 tty: attempt to retry request (1 of 3)
19 Nov 2024 07:31:58 tty: state now is TTY_RQST
19 Nov 2024 07:31:58 tty: written 8 bytes
19 Nov 2024 07:31:58 tty: request written (total 8 bytes)
19 Nov 2024 07:31:58 tty: state now is TTY_RESP
19 Nov 2024 07:31:58 tty: estimated 7 bytes, waiting 115624 usec
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 4, t_out = 000000:115624 
19 Nov 2024 07:31:58 conn_loop(): select() returns 1 
19 Nov 2024 07:31:58 tty: read 7 bytes
19 Nov 2024 07:31:58 tty: rx offset is 0
19 Nov 2024 07:31:58 tty: read 7 bytes of 7, offset 0
19 Nov 2024 07:31:58 tty: state now is TTY_PROC
19 Nov 2024 07:31:58 tty: response read (total 7 bytes, offset 0 bytes)
19 Nov 2024 07:31:58 tty: response is correct
19 Nov 2024 07:31:58 tty: response: [01][03][02][00][00][b8][44]
19 Nov 2024 07:31:58 conn[10.9.11.60]: state now is CONN_RESP
19 Nov 2024 07:31:58 tty: state now is TTY_PAUSE
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 5, t_out = 000000:100000 
19 Nov 2024 07:31:58 conn_loop(): select() returns 1 
19 Nov 2024 07:31:58 conn[10.9.11.60]: state now is CONN_HEADER
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 5, t_out = 000000:094552 
19 Nov 2024 07:31:58 conn_loop(): select() returns 0 
19 Nov 2024 07:31:58 tty: state now is TTY_READY
19 Nov 2024 07:31:58 conn_loop(): select(): max_sd = 5, t_out = 000060:000000 
19 Nov 2024 07:32:00 conn_loop(): select() returns 1 
19 Nov 2024 07:32:00 conn[10.9.11.60]: state now is CONN_RQST_FUNC
19 Nov 2024 07:32:00 conn_loop(): select(): max_sd = 5, t_out = 000060:000000 
19 Nov 2024 07:32:00 conn_loop(): select() returns 1 
19 Nov 2024 07:32:00 conn[10.9.11.60]: read request fc 4
19 Nov 2024 07:32:00 conn[10.9.11.60]: state now is CONN_RQST_TAIL
19 Nov 2024 07:32:00 conn[10.9.11.60]: request: [01][04][0b][b8][00][03]
19 Nov 2024 07:32:00 conn[10.9.11.60]: state now is CONN_TTY
19 Nov 2024 07:32:00 tty: state now is TTY_RQST
19 Nov 2024 07:32:00 conn_loop(): select(): max_sd = 4, t_out = 000060:000000 
19 Nov 2024 07:32:00 conn_loop(): select() returns 1 
19 Nov 2024 07:32:00 tty: written 8 bytes
19 Nov 2024 07:32:00 tty: request written (total 8 bytes)
19 Nov 2024 07:32:00 tty: state now is TTY_RESP
19 Nov 2024 07:32:00 tty: estimated 11 bytes, waiting 119791 usec
19 Nov 2024 07:32:00 conn_loop(): select(): max_sd = 4, t_out = 000000:119791 
19 Nov 2024 07:32:00 conn_loop(): select() returns 0 
19 Nov 2024 07:32:00 tty: response timeout
19 Nov 2024 07:32:00 tty: attempt to retry request (1 of 3)
19 Nov 2024 07:32:00 tty: state now is TTY_RQST
19 Nov 2024 07:32:00 tty: written 8 bytes
19 Nov 2024 07:32:00 tty: request written (total 8 bytes)
19 Nov 2024 07:32:00 tty: state now is TTY_RESP
19 Nov 2024 07:32:00 tty: estimated 11 bytes, waiting 119791 usec
19 Nov 2024 07:32:00 conn_loop(): select(): max_sd = 4, t_out = 000000:119791 
19 Nov 2024 07:32:00 conn_loop(): select() returns 0 
19 Nov 2024 07:32:00 tty: response timeout
19 Nov 2024 07:32:00 tty: attempt to retry request (2 of 3)
19 Nov 2024 07:32:00 tty: state now is TTY_RQST
19 Nov 2024 07:32:00 tty: written 8 bytes
19 Nov 2024 07:32:00 tty: request written (total 8 bytes)
19 Nov 2024 07:32:00 tty: state now is TTY_RESP
19 Nov 2024 07:32:00 tty: estimated 11 bytes, waiting 119791 usec
19 Nov 2024 07:32:00 conn_loop(): select(): max_sd = 4, t_out = 000000:119791 
19 Nov 2024 07:32:00 conn_loop(): select() returns 0 
19 Nov 2024 07:32:00 tty: response timeout
19 Nov 2024 07:32:00 tty: attempt to retry request (3 of 3)
19 Nov 2024 07:32:00 tty: state now is TTY_RQST
19 Nov 2024 07:32:00 tty: written 8 bytes
19 Nov 2024 07:32:00 tty: request written (total 8 bytes)
19 Nov 2024 07:32:00 tty: state now is TTY_RESP
19 Nov 2024 07:32:00 tty: estimated 11 bytes, waiting 119791 usec
19 Nov 2024 07:32:00 conn_loop(): select(): max_sd = 4, t_out = 000000:119791 
19 Nov 2024 07:32:00 conn_loop(): select() returns 0 
19 Nov 2024 07:32:00 tty: response timeout