Rut 955 : Trying to read modbus rs485 data from slave device using Pyserial

I am trying to read the registers of a slave device connected to my rut955 device, without any success.
The request to the slave is sent successfully, since the slave responds to my request (I have seen it on the oscilloscope); however I can’t read the data from pyserial. I have used “dev/rs485” and also “dev/ttyATH1” in the configuration of my pyserial script. None of that worked.

I was investigating and I think it is because I cannot put the rs485 chip pin that enables communication in reception mode, it only stays in transmission mode.
I tried putting in my python script the setting rtscts = True and it didn’t work, then I set dsrdtr = True and it didn’t work either.

Then I found this post:

I tried to apply it but it didn’t work, since I can’t access modbus_master via UBUS.
When trying to execute ubus “call modbus_master tcp.test” the console tells me that this file does not exist.

The firmware version I use is: RUT9_R_00.07.04.5

Thank you so much :slight_smile:


Please, enable the Modbus Master service first. If the service is disabled, ubus command will not work.

Kind Regards,


What means this message?

root@RUT955:~# ubus call modbus_master tcp.test
“error”: 2,
“result”: “Failed to parse ubus message”


You can enable either Modbus TCP or Serial master via WebUI. Then you can use ubus commands for Modbus. These can be either TCP or Serial:

ubus -v list modbus_master
ubus call  modbus_master tcp.test '{...}'
ubus call modbus_master serial.test '{...}'

For example:

ubus call modbus_master serial.test '{"id":1,"timeout":1,"function":3,"first_reg":1,"reg_count":"1","data_type":"16bit_int_hi_first","no_brackets":1,"serial_type":"/dev/rs485","baudrate":9600,"databits":8,"stopbits":1,"parity":"None","flowctrl":"None"}'

Also, not sure if you need it, but if you want to run SSH commands from python, take a look here.

Kind Regards,

1 Like

I use the command for ubus :

ubus call modbus_master serial.test ‘{“id”:1,“timeout”:1,“function”:3,“first_reg”:1,“reg_count”:“1”,“data_type”:“16bit_int_hi_first”,“no_brackets”:1,“serial_type”:“/dev/rs485”,“baudrate”:9600,“databits”:8,“stopbits”:1,“parity”:“None”,“flowctrl”:“None”}’

and it gives me this result.:

“error”: 0,
“result”: “Failed to create mb context”

I have configured my modbus master serial and slave serial as well, because if the slave is not configured the UBUS command does not work.

If it is a firmware version bug, please recommend one that is stable before this one.


Hello, any idea what may be happening? :slight_smile:


The error is due to the syntax error within the command. Assuming all the other options are fine, please replace parity and flowctrl ‘None’ with lowercase ‘none’.

Kind Regards,

1 Like

This topic was automatically closed after 15 days. New replies are no longer allowed.