I have a RUT956 reading RS232 over a serial connection and posting it via MQTT to our cloud server. I would like to also make the register data from the RS232 available to be polled/served to an external RS485 Master.
I found some directional guidance in the forum but feel I am missing a critical piece. Any guidance is much appreciated as I hope to avoid custom registers or scripts.
Each serial interface can only be enabled in one service. Thus, it is not possible to have multiple services configured for the same RS232 or RS485 interface. Since RS232 is already in use, it cannot be used in other services. There’s not much that can be done without additional workarounds/scripts. The only suggestion that comes to mind is to enable custom Modbus registers on RUT956 and write to them (for example, via MQTT). Then, poll those registers via RS485.
I am attempting your suggestion of a custom script. First I tried with python since I am more familiar with it, but the RUT956 does not have space for the library to install.
Trying to use the ubus commands and some pieces I found in the forums I came up with the following script. It does not seem to have all the correct utilities available. Any guidance on the correct syntax and tools?
Trying to get the script to read rs232 and write the register values to custom registers in the tcp slave so that I can poll it using a second master via 485.
#!/bin/sh
Configure serial port
stty -F /dev/rs232 9600 cs8 -cstopb -parenb -echo
Function to read RS232 registers and write to Modbus registers
Since other services on RUT are already using the RS232 serial port, I cannot guarantee that your solution will work properly. However, you can try.
For Modbus, you will want to use ubus commands mentioned here.
I would also suggest taking a look at other posts on this forum using the search functionality. For instance, the following posts might be helpful: