TCP modbus configuration

Hi,
I’m experiencing issues to read modbus registers.
I followed this tutorial : https://docs.octave.dev/docs/modbus-guides
but after configuring my bus, I try to verify ressources but I only have the /modbus/config ressource.
When I check the server log, nothing happens so I’m sure the edge device is not requesting any registers.
Can you help me ?

here is the config generated via web interface:

{
  "buses": [
    {
      "config": [
        {
          "groups": [
            {
              "address": 0,
              "name": "test1",
              "number": 12,
              "type": "HLD"
            }
          ],
          "period": 10,
          "slaves": [
            {
              "address": 2,
              "name": "slave_nb_2"
            }
          ]
        }
      ],
      "ethname": "eth0",
      "ipaddr": "192.168.1.48",
      "ipport": 502,
      "name": "TCP"
    }
  ]
}
``
 I also have /ethernet/config: 
{
  "devs": [
    {
      "ip": "192.168.1.91",
      "name": "eth0",
      "netmask": 24
    }
  ]
}

but if i connect to the fx30 and type ifconfig I see 192.168.13.31 instead of 192.168.1.91.  I cannot ping my server 192.168.1.48 as the device is not in the same network.

Hi Benoit, when you run the terminal session to connect to the FX30 what IP are you connecting to? I’m trying to get a base line of the subnets of your network. As an example I only connect to my FX30 with a usb cable that under device manager creates a virtual ethernet connection and I can connect to the FX30 address of 192.168.2.2.

When I run my ifconfig from my putty session I see this adapter and then I see my eth0 adapter which I configure for my modbus tcp.

Note, the ethernet config only has a subnet config not a gateway config, so if your using a managed network with layer 3 switches and vlans, you may be seeing issues because your not getting to your default gateway to route the messages across the different subnets.

Also my first attempts at configuring the Modbus services left me confused on where I was setting my local ethernet vs the Modbus slave but got it worked out. I ran into issues and had to flush the iptables (got the pointer from Sierra Tech Support) to get my connection to work.

From console session the command is : iptables -F

Hope some of this helps.
M

Hello Benoit,
the first time you change the device’s own IP address, you might have to reboot the device for the change to be applied

A.

Hi,

Thanks for your answer.
When I ifconfig from putty, I got 192.168.13.31/24 which is completely unknown network (I never worked in that range). So I changed manually the /etc/network/interface file to a convenient IP and can now ping my modbus server from the FX30 cmd line.
But the fx30 doesn’t poll the server. and I cannot execute any test request as the ressources are not present on the FX30.
Under /modbus, I only have the config part as shown in my previous post, I don’t see this kind of ressource : /modbus/bus1/server1/request/send

I’m using the latest firmware (3.0.2).

If you are able to ping the device from your terminal session now. You might try the command:
iptables -F

I had the same issue with my unit and the sierra team recommended that and it worked for me.

Hello Benoit,

As indicated by MM, please apply the following once for all to open the firewall for Modbus TCP:

iptables -I INPUT -i eth0 -j ACCEPT
(or set stricter rules if you wish)

Automatic setting of the firewall will be handled in 3.1

A.

still no /modbus/busx ressource and no request coming to my server.
is there a way to factory reset/format/redo everything from a clean system ?

regards

Hello Benoit,

This is rather strange. What you can do is:

  1. Empty the /io/ethernet/config and /modbus/config Resources in the Resources UI (or click on revert to Blueprint value). An apply that change in order to

  2. while in SSH on the device:

  • cd /legato/systems/current/appsWriteable/cloudInterface/config
  • if possible, recover any .json file (you should have config.json) for us to analyze later on
  • rm *.json in that folder
  • reboot.

A.

Hello,

I deleted my io and modbus config using the blueprint.
Then I checked the /lecato…/cloudInterface/config folder that was almost empty (no .json file, only a link named placeholder).

then I reconfigured via octave web interface and rebooted.
rechecked the web interface and the directory: same situation, no /modbus/bus1 ressource and no json in the cloudinterface/config dir.

:s

Hello,

You should have had a config.json file, there must be something going on on your device that I’d like to have a look at with you.

I would suggest we plan a dedicated call early next week to sort things out

A.