A few quick Ethernet/IP and ModBus questions

  • skyefire

    skyefire - 2021-02-03
    1. I need to have my CodeSys runtime act as both an EIP Scanner and a ModBus scanner. Can these run on the same Ethernet adapter, or do I need to have two different Ethernet adapters in my project? Do I need to have separate hardware Ethernet adapters?

    2. All the tutorials I've found for setting up the EIP Scanner appear to be outdated (I'm using 3.5.16). In the tutorials, the IP address of the EIP scanner has to be set up in the EIP configuration, but in my CodeSys, there's no place to do this -- the only place I can set up the "scanner" IP is in the Ethernet adapter above the EIP Scanner. The same appears to be true for my ModBus.

    3. Is there a tutorial describing how to monitor the Status variables for the Scanners and Devices? I'd like to be able to detect a communication failure and generate a module-specific error, and maybe make the module resettable from inside the application.
    4. I'm writing an application for eventual deployment to a Win32 runtime, but don't have access to it yet, so I'm "testing" using Simulation mode. Is it possible to use EIP and/or Modbus from within Sim mode? Base on my attempts so far, it seems like the answer is "no", but it never hurts to ask. (I've been trying to get EIP running on a Raspberry Pi for a "test bench", but so far, no luck).
  • sgronchi

    sgronchi - 2021-02-03

    1) It depends on the throughput you need to have, but I think they should work fine.
    2) It is so at least from Codesys 3.5.10
    3) I cannot help you ;-)
    4) AFAIK fieldbuses do not work in simulation mode, so you are out of luck. But you can start the runtime on your PC (Codesys Control Win V3) and use your PC as test device, it works for 30 minutes; after that time you can close and reopen it to make it working again.

  • skyefire

    skyefire - 2021-02-04


    3) The maddening thing is, the official (if outdated) EIP tutorial on the CodeSys Youtube channel shows the Get_Attribute function for EIP, which looks like it would give me what I need... but I can't find any details about how to use it. Argh!

    4) That would be the item in the SysTray, correct? So, right-click on it, hit Start, then turn off Simulation mode and use Device>Scan... download... that seems to work! I didn't understand the difference between that and Sim mode, I thought they were the same thing.

    ...unfortunately, I can't seem to get EIP working. I have some spare EIP modules lying around that I'm trying to use for testing. I've added the EDS files to CodeSys, added the devices below the EIP Scanner, set the IP addresses, and... nothing. The Scanner shows a yellow triangle, and the Adapters are red. I can ping the devices from this PC, as well as access their internal HTTP servers, so the hardware is good. Scanner status shows Idle communication state, and SlaveState as "Failed". I've also tried doing just one adapter at a time, with no luck. I went through and ensured that the Main Task, the EIP Scanner IO Task, and the EIP Adapters all had the same scan rate (20ms).

    I followed the official webinar (https://youtu.be/-YcEYccH88U), which makes adding EIP devices to a CodeSys project look easy. Other 3rd-party tutorials I found are the same. I have the devices set to "always update", and I also added some GLobal variables that I mapped to the devices' QX and IX addresses. The LEDs on the EIP modules show that everything is fine except that the Scanner has not "taken ownership" of the adapters.

    Are there any tutorials for troubleshooting EIP connections?

  • skyefire

    skyefire - 2021-02-04

    Addendum: I get exactly the same issue connecting these modules to my Raspberry Pi CodeSys engine, and I've checked that these modules function on a regular Allen-Bradley PLC. So there must b something I'm doing wrong in CodeSys, and doing wrong consistently.

  • sgronchi

    sgronchi - 2021-02-04

    I cannot help you about EIP because I never used it (just know something about it).

    Simulation mode works inside the IDE, and it executes 61131 code and visualizations (with some differences to the real TargetVisu). No communication with the external world.

    The other is the real Windows SoftPLC, which needs a license to work, full featured.

    But if you are developing for a PLC that's not x86-based (ARM, POWER, Aurix, ...) like I usually do, if you want to test your logic locally the two ways are
    1) testing in simulation;
    2) maintaining a second project or a second device in the tree targeting Windows SoftPLC replicating your logic;
    The second one is time-consuming.

  • skyefire

    skyefire - 2021-02-15

    So, a few updates, for posterity. :P

    My production Ethernet/IP connection worked instantly, just by importing the EDS file. It was for a complex Numatics G3 valve&I/O setup. So my test-bench problems with the much simpler Turck adapters remains a mystery.

    My ModBus connection, OTOH... I've had no luck connecting to my two ModBus I/O modules:
    The ModBus log just shows "socket error." Nothing more. I've confirmed I can ping the modules from my CodeSys runtime computer. And I spent hours playing with the Connection settings, without any luck -- I couldn't even get a different error!

    And I was informed that this CodeSys will also be running ProfiNet. So now I may have three bus protocols running on the same ethernet port. All fairly low-traffic, so hopefully it will work, but....

    I've been told that the "free" 2hr runtime will do all the FieldBusses except Profinet, for some odd reason (probably Siemens Licensing, I would guess). I have yet to try this for myself.

    • Morberis

      Morberis - 2021-02-17

      Heh, it's probably too late to switch your modbus TCP/IP acromag modules to profinet module? Are you using the module with i20?

      Unfortunately the few times I've used modbus tcp/ip it's just worked so I don't have much advice for you. Have you tried the modbus communication with the EIP communication removed?

      If you're spending hours trying to get it to run if you have the authority or can get permission I would recommend buying a support ticket.

      Edit: Random question, you have different IP addresses for the modbus master and the EIP scanner right?


      Last edit: Morberis 2021-02-17
  • skyefire

    skyefire - 2021-02-18

    The plot thickens...

    The two "production" ModBus modules I've been trying to connect to are proving to be very stubborn (despite working fine on an RS-Logix PLC) -- my customer is looking into replacing them with EIP modules instead. EIP on this CodeSys PC (Win64, non-RTE) has been working effortlessly (so far) on a big Numatics G3 valve/input module stack.

    In the meantime, I've been using a Turck TBEN multi-protocol I/O module on my lab bench to experiment with. I've been completely unable to get CodeSys to connect to this module via EIP. But when I switched the module to ModBus, I was able to connect with no trouble at all. Is CodeSys's FieldBus implementation just really finicky? I've confirmed with Turck that I'm using the correct EDS file for this module.

    This TBEN module will also do ProfiNet -- I guess I'll try that next.


    Last edit: skyefire 2021-02-18
  • skyefire

    skyefire - 2021-02-19

    It occurs to me that, so far, all my successes with EIP and ProfiNet have been on a licensed runtime -- my failures have been on my desk machine, running the "demo" mode 2hrs at a time.

    The demo mode does ModBus fine, but is it limited on EIP or PN? I've heard elsewhere that the demo mode can't run PN, but will run EIP, but I haven't found a definitive answer.

    Does anyone know where there might be an official CodeSys document that details just what the "demo" mode can/can't do? (aside from the 2hr run time limit)

  • eschwellinger

    eschwellinger - 2021-02-20

    if you read the product description for Control Win:
    you see what is included (and licensed)
    Fieldbus support

    With the delivery of the Runtime Package the following fieldbuses are supported:

    CODESYS CANopen Manager / Device
    CODESYS EtherCAT Master
    CODESYS EtherNet/IP Scanner / Adapter
    CODESYS J1939
    CODESYS Modbus TCP Master / Slave
    CODESYS Modbus Serial Master / Slave
    CODESYS PROFINET Controller / Device

    extra license is needed for:
    Product options

    The product can be extended by the following chargeable product options:

    CODESYS SoftMotion SL
    CODESYS SoftMotion CNC+Robotics SL
    CODESYS TargetVisu
    CODESYS WebVisu

    Last edit: eschwellinger 2021-02-20
  • hence.persson

    hence.persson - 2021-02-20

    Regarding win runtime.

    From what I remember modbus tcp works out of the box. Profinet needs to install a free software don't remember the name. Maybe the same is true for ethernet ip ?

    I have tested profinet in the demo runtime and that worked but ad I said needed to install some software first.

  • hence.persson

    hence.persson - 2021-02-21

    Winpcap was it.. Needed for control win runtime not needed for rte. Needed at least for profinet unsure about ethernet/ip

  • skyefire

    skyefire - 2021-02-22

    Hm... I have Winpcap installed (as part of WireShark) already.

    If I lacked some critical component, would CodeSys generate any warnings? B/c so far, I only get "device not found" in the EIP Scanner Log.

    As a test, I connected the module as an EIP Adapter to a Fanuc robot. This doesn't use an EDS file, just basic settings: Product Code, Manufacturer Code, Major/Minor Revs, and number of Bytes In/Out. It worked fine.

    So I went back to CodeSys, and tried creating a Generic EIP Adapter under the Scanner, using the same "generic" settings that worked on the robot. Still no luck.

    I've also tried connecting this module to my Raspberry Pi running CodeSys, and get the same failure.

    This is really frustrating. I can't figure out what I'm doing wrong here.


Log in to post a comment.