Am I missing something here in this Modbus Addressing?

Over the past couple of days I have been trying to figure out how to address some Modbus points to connect back to another system. Earlier today I finally got it to work. I exported my points and adjusted them to match the syntax of the working point but when I imported them back in they didn’t work. I will say that I also had to adjust the server that is sending the data because the modbus addressing was wrong so that may be the issue.

I am getting an error in the log of (0x02) illegal addressing. This is the syntax I am using
[xxx]20.HRF2 to represent registers 40002 and 40003 on node 20 in the server.

Here are a few other things I have noticed.

  • The server has the device on Node 20 which when i got the first point to work I used Node 20, but when I used the OPC browser there is a folder under the OPC connection I am using that said UnitID0. I tried changing the Node to 0 and that made the tag go from an x to a ? but didn’t connect.

  • When I disabled the server sending the data. All of my tags switched from x’s to ?s. So I know there has to be some communication there.

  • The OPC connection on the gateway says its connected.

  • The first point that worked is no longer working.

Am I missing something?

I figured out the first bullet. I had a rogue string of Modbus mappings on the gateway from when I was dicking around with this before. So that Unit ID 0 thing isn’t there anymore (I deleted the test mappings)

This means you’re connected to the Modbus device on the other end it’s rejecting the address you’re trying to read. If it was working with this address, but now suddenly isn’t, then something must have changed on the other end.

OK, that makes sense. Since I don’t fully understand how the other system works and I did some modbus updating. It probably just needs reset. Thank you!


Alright so I think I got this problem down to it being an ignition issue. So I have been back and forth with other people trying to figure out why this is happening and I ended up finding a solution…temporarily.

I deleted my Modbus connection, added a new Modbus connection to the same server and remapped my tags manually. Then my data popped up. Then about 5 minutes later all of my tags got the x again. I went into the logs and it is giving me the same error. (0x02) Illegal data addressing.

Ignition had no problem with the addressing minutes before, so I know it has to be an issue with ignition. Do you have any ideas on how to fix this?

I am using edge if that makes a difference.

Are you using leased scan classes or continuing to add new tags addressing this device?

This error code comes from the device, so there’s only 2 possibilities here:

  1. you’re using leased scan classes, adding tags, or otherwise changing the set of tags subscribed against the device such that you eventually include one that results in the Illegal data address error
  2. the device spontaneously decides to start responding this way, possibly because of a configuration change, or possibly because it’s buggy.

Maybe you can get a Wireshark capture while it’s working vs while it’s not working and compare the difference.

Also, if you think scenario #1 is in play, try disabling the “Span Gaps” setting for that device connection.

The span gaps thing has worked so far! I am going to give it a few minutes to make sure its not screwing with me again. I have read the description of what that does but I don’t fully understand it.

I think that it is requesting all of the data at the same time instead of individually tag by tag. If this is the case then my issue was that the data wasn’t filling entirely within the timeout timeframe, then faulting out because of that?

It has to do with what registers are requested as a group.

Imagine you subscribed to HR1 and HR10. By default, the driver will simply send one request, starting at HR1, requesting 10 registers.

In some devices this is okay, even if there isn’t any data defined in the registers between. They just return zeros or something. In other devices, reading any undefined registers torpedos the entire request with something like the Illegal data address error you see.

If the span gaps thing works then it means you were probably adding tags or somehow modifying the subscription in such a way that an undefined address eventually got requested.

1 Like