Modbus RTU error 12?
Posted: 29 Apr 2022, 16:46
I'm trying to get a RevPi Connect to talk to a Modbus slave connected directly to the onboard RS485 port using a short twisted pair cable.
I have previously gotten the Modbus slave to work with Node-Red on the same RevPi by using a Modbus master node in Node-Red, so I know the hardware configuration and wiring is OK. That worked at first attempt and I could read meaningful data. However, getting the RevPi virtual master to work with this slave is proving more difficult.
I've added a virtual master in Pictory, set the correct baud rate etc, and added an "action" that reads holding register 1 at slave address 1. I have saved the configuration, reloaded the driver and restarted Modbus ($ sudo systemctl restart pimodbus-master.service). When I do $ piTest -r Modbus_Action_Status_1 I get error code 12:
The "device value" for this action is Input_Word_1, which comes up emtpy (0000). I have no idea what status 12 is and I haven't been able to figure it out. If I change the Modbus address to something else (which doesn't exist, there is only one slave connected) I get a time-out (110) instead, which makes sense. I have also tried using 2 stop bits instead of 1 just in case, but that also results in time-outs.
Here's the Modbus log:
If it matters, the slave I'm dealing with is a Laumas TLB.
Any clues? What is status 12?
I have previously gotten the Modbus slave to work with Node-Red on the same RevPi by using a Modbus master node in Node-Red, so I know the hardware configuration and wiring is OK. That worked at first attempt and I could read meaningful data. However, getting the RevPi virtual master to work with this slave is proving more difficult.
I've added a virtual master in Pictory, set the correct baud rate etc, and added an "action" that reads holding register 1 at slave address 1. I have saved the configuration, reloaded the driver and restarted Modbus ($ sudo systemctl restart pimodbus-master.service). When I do $ piTest -r Modbus_Action_Status_1 I get error code 12:
Code: Select all
1 Byte-Value of Modbus_Action_Status_1: 12 dez (=0c hex)
Here's the Modbus log:
Code: Select all
$ journalctl -u pimodbus-master.service | tail -n 50
Apr 29 15:50:19 RevPi52559 piModbusMaster[3461]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:19 RevPi52559 piModbusMaster[3461]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:19 RevPi52559 piModbusMaster[3461]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:20 RevPi52559 piModbusMaster[3461]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:20 RevPi52559 piModbusMaster[3461]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:20 RevPi52559 systemd[1]: Stopping Revolution Pi Modbus master...
Apr 29 15:50:20 RevPi52559 systemd[1]: pimodbus-master.service: Main process exited, code=killed, status=15/TERM
Apr 29 15:50:20 RevPi52559 systemd[1]: pimodbus-master.service: Succeeded.
Apr 29 15:50:20 RevPi52559 systemd[1]: Stopped Revolution Pi Modbus master.
Apr 29 15:50:20 RevPi52559 systemd[1]: Started Revolution Pi Modbus master.
Apr 29 15:50:20 RevPi52559 piModbusMaster[3816]: piModbusMaster started
Apr 29 15:50:20 RevPi52559 piModbusMaster[3816]: modbus rtu action timeout: 0 s 100000 us
Apr 29 15:50:20 RevPi52559 piModbusMaster[3816]: modbus rtu minimal time between telegrams: 0 s 50000 us
Apr 29 15:50:21 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:21 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:22 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:22 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:22 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:22 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:22 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:23 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:23 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:23 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:23 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:23 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:24 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:24 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:24 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:24 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:24 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:25 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:25 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:25 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:25 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:26 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/110/-112345568
Apr 29 15:50:26 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:26 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:26 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:26 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:26 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:27 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:27 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:27 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:27 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:27 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:28 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:28 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:28 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/110/-112345568
Apr 29 15:50:28 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Apr 29 15:50:28 RevPi52559 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/112345690/12
Any clues? What is status 12?