RUT955 - RS485 7 databits

Hello,
for remote logging purposes on a RS485 bus I set up the router as a serial device server. The RS485 bus runs at 4800bd with 7 databits, even parity and 1 stopbit. But I figured out that only 8 databits are accepted by the router for RS485, is this correct?
I’m using the firmware RUT9_R_00.07.05.4.

Regards.

Hello,

First could you confirm that you were referring to Modbus Serial Slave?

Yes, as of now, only 8 bits is accepted for the databits field in the RS485 configuration.

If adjusting the databits of your serial device is not a possibility, maybe we could configure the router’s RS485 configuration in the CLI. (Note that this is just an alternative solution we could do and it is not guaranteed which is why it is important to test it).

  1. Login to the CLI of your router via WebUI or SSH by PuTTY.
  2. Type the command uci show | grep modbus

image
3. Look for the entry number for the RS485 device configuration, in the example, it is [0].
4. Manually change the databits by using the commands below in order.

uci set modbus_server.@rtu_device[0].databits='7'
uci commit modbus_server
reload_config

Then run the uci show | grep modbus command again to check if the databits have been updated. Note that based on my test, the databits will not change in the GUI. However, on the backend side (CLI) it shows that the databits have been configured as ‘7’.

After, kindly test on your side if the serial device and the RUT955 can exchange data on a 7 databit config.

Hope this helps and let me know the results :slight_smile:

Best regards,
Robert

Hallo,
Thanks for your reply.
I configured the serial utility RS485 as “Over IP” TCP server in raw mode, no Modbus.

I tried to change the values with uci but it didn’t work the RS485.
After changing the values with uci I read them back with stty and the change of parity was accepted by uci but the number of databit didn’t change. I tried to change it with stty but this failed too.
I compared it to the RS232 port and there I can change the databits setting in the same way without a problem.

root@RUT955:~# stty -F /dev/rs485 -a
speed 4800 baud;stty: /dev/rs485
 line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc
root@RUT955:~# uci set rs_overip.2.databits='7'
root@RUT955:~# uci set rs_overip.2.parity='even'
root@RUT955:~# uci commit rs_overip.2
root@RUT955:~# reload_config
root@RUT955:~# stty -F /dev/rs485 -a
speed 4800 baud;stty: /dev/rs485
 line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc
root@RUT955:~# uci show | grep rs_overip.2
rs_overip.2=overip
rs_overip.2.device='/dev/rs485'
rs_overip.2.name='RS485'
rs_overip.2.raw='1'
rs_overip.2.protocol='0'
rs_overip.2.flowcontrol='none'
rs_overip.2.keepalive_time='0'
rs_overip.2.tcp_echo_enabled='0'
rs_overip.2.baudrate='4800'
rs_overip.2.max_clients='4'
rs_overip.2.full_duplex_enabled='0'
rs_overip.2.mode='server'
rs_overip.2.timeout='300'
rs_overip.2.keepalive_interval='0'
rs_overip.2.stopbits='1'
rs_overip.2.no_leading_zeros='0'
rs_overip.2.keepalive_probes='0'
rs_overip.2.always_reconnect='0'
rs_overip.2.port_listen='17184'
rs_overip.2.enabled='1'
rs_overip.2.read_duration='100'
rs_overip.2.databits='7'
rs_overip.2.parity='even'
root@RUT955:~# stty -F /dev/rs485 -a
speed 4800 baud;stty: /dev/rs485
 line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc
root@RUT955:~# stty -F /dev/rs485 cs7
stty: /dev/rs485: cannot perform all requested operations
root@RUT955:~#

As workaround I use the configuration 8 databits, no parity, 1 stopbit and handle the eights databit/parity bit in my logging software.

Regards

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