FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
165 views 0 comments
by anonymous

Hi,

I have built a custom FW (based on 6.9.2) with one of the pre-configured settings to be that of the Modbus, where the ID is set to 1. From the 50 devices using this FW, half of them have issues with the Modbus feature. In particular, the clients (PCs) cannot connect to the Modbus, until I manually set the ID in Modbus from 1 to 0 (allow all devices), save, and then back to 1 or reboot the router. Is this due to some sort of race condition or services failed to launch? 
 

/package/base-files/files/etc/config/modbus:

config modbus 'modbus'
        option enabled '1'
        option port '502'
        option device_id '1'
option timeout '0'
option clientregs '0'
option keepconn '1'

Thanks

1 Answer

0 votes
by anonymous

Hello,

  

It's hard to say what the exact issue could be, as this firmware is no longer supported and it's a custom GPL build, however, to overcome the issue a user script could be used.

User scripts are run as soon as the device finishes booting up. In your case, you'd need to restart the Modbus service. This can be done using this command:

/etc/init.d/modbusd restart

/etc/init.d/modbus_serial_master restart

/etc/init.d/modbus_tcp_master restart

This will restart basically all Modbus-related services. If this does not help, UCI could be used to change the values, if by default it's set to 0. The command would look like this:

uci set modbus.modbus.device_id='1'

uci commit modbus

/etc/init.d/modbusd restart

This should set the correct values. Let me know if it helps!

  

Best regards,
DaumantasG