Modbus TCP ReadCoilsRequesT Error

I have Modbus TCP driver 5.9.13 (b2019120923) and I’m getting a Received response with ExceptionCode: 0x02 (IllegalDataAddress) when reading [PLC]Cdddd from a M580 PLC into a Boolean tag, where dddd is any coil address. The tag shows Bad Quality (so I get the nasty overlay unless I opt out), but otherwise the tag works (reads/writes) as expected. I don’t have this issue reading any other datatype registers from this PLC, and I have 2 other M580 PLC’s under the same gateway where Coil type tags generate the same error message (at least the same error is in the logs for those devices) but for those PLC’s the quality is Good.

I can’t argue that the issue doesn’t seem to be with the PLC somehow, but I’ll be damned if I can find any differences between those that work as expected and those that do not, but on the Ignition side there is an unmistakable lack of information in this error message. Is there anyway way I can drill down on this issue to see a little more verbosity in the error? Or perhaps someone here has experienced this issue and knows exactly what causes it?

Thanks!

You can turn the logger for ReadCoilsRequest to TRACE and see exactly what coils are being requested when that error happens.

You might also try turning the “Span Gaps” setting off. Many coils can be grouped together into a single request and often instead of returning 0/false values devices will instead return an error like this when requesting coils that aren’t explicitly mapped to anything.

Turning off Span Gaps has some good effect in that the tag quality is now good. So thanks for that. But I’ve got Span Gaps turned on for the other PLC devices, and there is no issue there.

The plot thickens,

We just ran into this same error and turning of Span Gaps did help. Any idea why that is? Some PLCs didn’t have the issue but some of them did before turning Span Gaps off. Would ignition v8.0 + have the same issue or is this something specific to v7.x?

This isn’t really an issue with Ignition, it just depends on the Modbus implementation of the PLC you are connecting to.

As an example, if you have tags defined for HR1 and HR10, Ignition will try to read these in a single request: read 10 registers starting at register 1. If you turn span gaps off then it will read it as two requests: 1 register starting at HR1 and 1 register starting at HR10.

Some PLCs will return an exception code when reading registers in the “gap” if there are no values defined at those locations in the program. Some PLCs have no issue with this and just return 0s.

I see. Thanks for that information. I guess what perplexed me is that I tried it on 3 different PLCs of the same type (Micro820) but 2 of them resulted in the error while 1 worked. They all had the same tags configured to the Modbus Registers. There were a series of C and HR tags on the PLC.

If you’re really interested in getting to the bottom of it you can take a Wireshark capture of the traffic between Ignition and the device that didn’t work without Span Gaps disabled and a device that did work.

There’s probably a subtle difference in either the registers you’ve defined in the Micro 820 program or the tags being requested in Ignition from that device.