CoDeSys EtherNet/IP Scanner Configuration Assembly data

Ken Roach

Lifetime Supporting Member + Moderator
Join Date
Apr 2002
Location
Seattle, WA
Posts
17,497
Does anyone in the community have some experience to help a novice understand how to use the Configuration Assembly data for an Adapter device being controlled by a CoDeSys 3.5 EtherNet/IP Scanner ?

I understand how to configure and use the Input and Output Assemblies. When you create an Adapter under the Scanner in the project tree, CoDeSys gives you an array of bytes that you can Map to global variables in the project. That makes sense, and I've used it.

But the Configuration Assembly gets sent to the Adapter device when the I/O connection is first established, then any time it is re-connected.

Many devices have a null configuration assembly; their I/O is simple and they don't need config info. I set up an SMC EX260-EIP like that last night and the valves happily go clickity-clack.

But my adapter device is a Baluff BNI-EIP-507 4-port IOLink Master block, so it requires a substantial amount of configuration data to come from the PLC to configure each IOLink port.

I can see that the Configuration Assembly is defined... I just don't see where to address or map it.

It's not the Connections -> Configuration Data pane. Those are obviously Parameters (they have atomic data types and min/max/description) and they probably come from an EDS file.

And it's not the User Defined Parameters; those too are definitely Parameter Object and similar download parameters, so you can roll your own auto-device-configuration.

I've searched as thoroughly as I know how for examples on the CoDeSys FAQ, online help, and Forge website.

Any info about how to use EDS files with the CoDeSys EtherNet/IP Scanner would also be gratefully accepted.

CDS_Assemblies.png
 
You install eds files through the device repository. Then, when you go to 'add device' you can add that specific device instead of the generic one. (Mind you, i'm using the SoMachine variant, so it might be called something a bit different)
 
As usual, posting here prompts me to figure stuff out better (and Dravik just posted to confirm how it works).

It turns out you need an EDS, even a simple one. Baluff provided a pretty good one, and I added it to the Device Repository in CoDeSys (Tools -> Device Repository -> Fieldbuses -> EtherNet/IP ->EtherNet/IP Remote Adapter, then click Install and select the EDS from your PC's filesystem).

Once I did that, the Configuration Assembly data showed up in the Configuration Data pane in the Connections tab. The default labels there previously confused me into thinking they were just for stuff you could define as individual Parameters.

I've clearly got a lot of learning to do with CoDeSys (and with this Baluff device) but I've got data flying around and can read the distance value out of a Banner QX4 laser over EtherNet/IP, so I'm underway !

CDS_Config_Assembly_EDS.PNG
 
OK, I'm going to keep asking simple questions.

Offline, I can enter values into the Configuration Data pane on the Connections tab for the EtherNet/IP Adapter.

For example, the first parameter is Port Function, a 16-bit UINT that defines whether the ports on the Baluff block are configured for discrete I/O or for IOLink. The default value is 85 (decimal) = 2# 0000 0000 0101 0101 to enable all four ports.

My only IOLink device is connected to Port 2, so if I (offline) put a "4" into that field, then download, the other three ports physical IOLink status indicators turn off and only Port 2 is left running. Great, that proves I can set up configuration data.

But is there a way for me to set that data programmatically in CoDeSys instead of manually entering it while offline ?

I can't see how to "Map" variables to the Configuration Assembly like I can for Input and Output Assemblies, nor can I see a way to get to that BYTE[98] array as a global tag or anything else that the addressing assistant can point me to.
 
Hello Ken: I have been using Codesys for EtherNet/IP a lot, and although I like it very much, the advantages that its multi-protocol capability offers comes with the trade-off of having some limitations into specific capabilities of the different protocols. So for example, I have not found a way to inhibit devices programaticaly, so as to be able to send forward_close commands (for example as required for a QuickConnect implementation), in order to change configurations dynamically as you would be able to do with Logix. I think if there is any configuration change required in any of the adapters the scanner needs to be reconfigured, reason why there is no way to map the configuration assembly into variables of the PLC application. So there is no way, I believe, to dynamically change the contents of the configuration assembly, nor a mechanism to send forward_close and then forward_open again to be able to change the configuration of the adapter devices, without having to change the PLC application.
 
Thank you very much for your input, Alfredo ! I have seen your posts about CoDeSys and EtherNet/IP and very much appreciate your experience and information.

I am still using the 2-hour grace period runtime for my experiments.

Have you experienced the EtherNet/IP drivers failing to start again when you power cycle or "sudo reboot now" the Linux computer (in my case, a Raspberry Pi or Beaglebone Black) ?

I have found that I can Start and Stop the runtime from within CoDeSys (using the "Update Raspberry Pi" tool) but if I actually cycle power, I have to do a fresh Download to the controller to get the EtherNet/IP drivers running again.

I wonder if that has to do with the grace period runtime, and if it would restart reliably if I installed a license.
 
Thank you very much for your input, Alfredo ! I have seen your posts about CoDeSys and EtherNet/IP and very much appreciate your experience and information.
I am still using the 2-hour grace period runtime for my experiments.
Have you experienced the EtherNet/IP drivers failing to start again when you power cycle or "sudo reboot now" the Linux computer (in my case, a Raspberry Pi or Beaglebone Black) ?
I have found that I can Start and Stop the runtime from within CoDeSys (using the "Update Raspberry Pi" tool) but if I actually cycle power, I have to do a fresh Download to the controller to get the EtherNet/IP drivers running again.
I wonder if that has to do with the grace period runtime, and if it would restart reliably if I installed a license.

Ken, thanks for your kind words, but it is me who has been learning from your posts on industrial CIP communication issues and Rockwell PLC issues for years now, for which I am grateful. I enjoy both the contents of your posts and the prose, and I get the ocasional laugh as with the post you answered a few days ago about the damaged logix processor.

Really humbled to know my posts can help you. So I try to add further help to this question.

I do use licensed Codesys PLC because I develop firmware for EtherNet/IP, Profinet and EtherCAT field devices, so my company has 5 licenses for RaspberryPy and one for Windows.

The Windows version is a bit pricey but the RaspberryPI not so much, and I do recommend you get it if you will be doing serious development with Codesys.

With regards to your inquiry, did you try to create a boot application and then perform a multiple download? I do have one Codesys RaspberryPI without the license which we use ocasionaly for one particular program. The PLC program always starts at power on without the need to download the PLC program with the Codesys engineering environment. Hope this is helpful.
 
I can certainly afford a CoDeSys license for Raspberry Pi, so I'm buying one tonight. I've been furloughed so I'm poking around with things I, um, borrowed from the office.

I did make a Boot Application, and to a "Full Download". I SSH'ed into the Raspberry Pi and verified that the timestamp on /var/opt/codesys/PlcLogic/Application was recent.

But when I reboot the Raspberry Pi either with a true power cycle, a Cold Restart, or a command-line "sudo reboot now", CoDeSys restarts in Run mode with a faulted EtherNet/IP scanner device. It says that no adapters are configured, and the Adapter status just says it has not started.

The error message is not very helpful: "IoDrvEthernetIP: Load Parameters Failed"

I will keep fiddling with it.

CDS_ethernet_fault.png
 
That is very strange. Please see the screenshot. I took this after powering up the Raspi "without" Codesys usb dongle. I cleared all the entries and put the engineering tool online with the Raspi. If you want, I can have a look at your project, load it on mine and try to figure out why it does not do what mine does. Please note the EtherNet/IP scanner is starting.

Codesys_Start.jpg
 
Ken, another thing, you really intrigued me with your inquiry about being able to have multiple configurations without having to load the PLC application every time, but this would require some serious hacking which is out of my league. Please see the screenshot below. Maybe it would be possible to have like a number of configurations for the PLC application stored somewhere in the Debian file system for this "3SA.dat" file in the root. By enabling the web server function in Codesys, you may be able to develop a web server application(this is totally out of my league, by the way) that selects the desired configuration, and then develop a button that can somehow call a script that stops the root task "codesyscontrol.bin" and then restarts the task again, after the script has managed to replace the previuously active 3S.dat file for the desired one. Not sure how this can be done as the script would need administrator privileges. But since you mention you can SSH the Raspian, which means you must be a superb typist (which I am not) and a Linux guru (which I am definitively not), then you may not even need to bother with the web server, unless you need something for shop floor machine operators. Anyways, it sounds a bit nerdy and I am not 100% if it is possible, but I mention this just to give you some more ideas.

CodesysHACK1.png
 
Last edited:
Thank you... I think this is an Ethernet port configuration issue, not a license issue. They send those USB dongles UPS 2-Day from Chicago so I guess I will know soon !

There is a detailed text log similar to your screenshot which can be accessed via the "Update Raspberry Pi" utility and the "System Info" button.

When I do the restart from that utility, it correctly knows about my static IP address, 192.168.21.15.

2020-07-14T08:27:59Z, 0x00000007, 1, 0, 6, Network interface: <ipaddress>192.168.21.15</ipaddress>, subnetmask <subnetmask>255.255.255.0</subnetmask>
2020-07-14T08:27:59Z, 0x00000018, 1, 0, 4, Network interface <interface>ether 1</interface> at router <instance>0</instance> registered
2020-07-14T08:27:59Z, 0x00000007, 1, 0, 6, Network interface: <ipaddress>192.168.21.16</ipaddress>, subnetmask <subnetmask>255.255.255.0</subnetmask>
2020-07-14T08:27:59Z, 0x00000018, 1, 0, 4, Network interface <interface>ether 2</interface> at router <instance>1</instance> registered

But when I actually reboot, the CoDeSys runtime apparently thinks that only the Loopback adapter is active by the time it starts.

2020-07-14T09:00:21Z, 0x00000007, 1, 0, 6, Network interface: <ipaddress>127.0.0.1</ipaddress>, subnetmask <subnetmask>255.255.255.0</subnetmask>
2020-07-14T09:00:21Z, 0x00000018, 1, 0, 4, Network interface <interface>ether local</interface> at router <instance>0</instance> registered

So when it tries to configure the EtherNet/IP scanner it fails.

2020-07-14T09:00:23Z, 0x000010f0, 2, 0, 4, !!!! Warning: <Network>eth0</Network><Comp>IoDrvEthernet</Comp>
2020-07-14T09:00:23Z, 0x000010f0, 1, 0, 7, <Comp>IoDrvEthernet</Comp>
2020-07-14T09:00:23Z, 0x00001014, 1, 1, 16777229, <ConnectorID>1989427576</ConnectorID><Component>IoDrvEthernetIP</Component>
2020-07-14T09:00:23Z, 0x00001014, 4, 1, 16777231, **** ERROR: <Component>IoDrvEthernetIP</Component>
2020-07-14T09:00:23Z, 0x00000012, 4, 2, 1, **** ERROR: Update configuration failed from driver <iodriver>IoDrvEtherNetIP</iodriver>


I set up my static IP in the very ordinary way, by editing the /etc/dhcpcd.conf file. This should be all I need for Debian Buster; you don't use /etc/network/interfaces anymore.

I am going to get some sleep and see if the same issue occurs when I use DHCP.
 
Solution

I added "ip=192.168.21.15" to the end of the line in /boot/cmdline.txt

When I reboot, the Raspberry Pi happily boots up and starts CoDeSys correctly, and all the lights go green and blinky.

I'm not sure why. cmdline.txt is one of the very first things that Linux looks at when it starts up, to configure the serial debug console. Just adding that one line doesn't set up the netmask or the gateway or the DNS servers.

Thanks for spending the time to compare your installations to mine !

Once I figure out why it's behaving that way, I will add something to the CoDeSys Forge forum.

Now I'm gonna make a cup of coffee and go look at the NEOWISE comet; the skies are clear here in Seattle and it won't come back around for 6,000 years.
 
you may be able to develop a web server application(this is totally out of my league, by the way) that selects the desired configuration, and then develop a button that can somehow call a script that stops the root task "codesyscontrol.bin" and then restarts the task again, after the script has managed to replace the previuously active 3S.dat file for the desired one. Not sure how this can be done as the script would need administrator privileges ...


It's Linux so summat like this is certainly possible.


Back in ancient times I had NAT router running on a Linux box in the basement, the WAN ethernet card of the linux box was connected to the ISP (Road Runner, IIRC); the LAN ethernet card to the house network. The kids were gamers, and occasionally needed to forward a port from their machines onto the NAT router. It was straightforward to set up in the Linux box (iptables, IIRC), but a pain to switch on the fly, they were not yet at the point where they could go around messing with iptables commands or scripts. This was before we thought much about web APIs, so I set up an inetd service that triggered a BASH script. So if host on the house network connected to it (e.g. telnet nat 55555), the BASH script would determine the IP of the client and reset the necessary ports in iptables to forward from that IP to the ISP/RoadRunner/'net.



That's a long way around to say, yes, this kind of thing is definitely possible; you could even use the same technique to have the running program connect to a port on localhost (127.0.0.1; i.e. the RPi running itself), and the port chosen (50000 is program A; 50001 is program B), would determine what was run next.
 

Similar Topics

Codesys Ethernet IP Scanner - Won't connect to a Wago 750-353. The Ethernet device and the Ethernet IP Scanner are both running. but then I go...
Replies
2
Views
1,711
Hello. I need to connect an EtherNet/IP adapter to CODESYS RTE. I have confirmed that the adapter works with Rockwell Logix, and not only the...
Replies
7
Views
2,526
Hi everyone, I am using Codesys for the first time (V. 3.5 SP16 Patch 3) and I have used only Allen Bradley before this. I am struggling to...
Replies
17
Views
4,730
Hello everyone, I'm currently working on a project where I have the RPi set up as an Adapter with Codesys and the Allen-Bradley PLC as Scanner...
Replies
6
Views
3,362
Hi, I would like help if possible with a little problem. I'm using a TM251MESE from schneider electric with Somachine 4.1 sp2. I'm trying to...
Replies
0
Views
2,061
Back
Top Bottom