Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Question... Multiple Ethercat Master in project, but only one active.

  • mondinmr

    mondinmr - 2022-03-31

    Is it possible keep multiple master configured in different mode (multiple slave configurations) and turn on only one at application boot?

    I'm developing a new application, on POU side OOP and polymorphism let me create a runtime configurable modular software, but on device side is hard to find a solution.

    Mapping on a structure field objects of a slave and use references in software is very useful, but a good solution should be dispose 20-30 master configuration in different hardware to select right configuration in runtime.

    In a lathe machine we are using multiple device configuration, but this solution require a full download.

  • struccc

    struccc - 2022-04-01

    Wow... Interesting topic :)

    I assume we're talking about Ethercat...
    As a first guess I'd try to use the xStopBus input of the individual master instances:

    I wonder if this can work...


    Last edit: struccc 2022-04-01
  • mondinmr

    mondinmr - 2022-04-04

    I tested but it's not working.
    Also hot enable/disable a slave is not possible.
    Disable a slave in editor move all adderessing space of next device back so it's not possible hot reenable it.

    • struccc

      struccc - 2022-04-04

      Now I tested it briefly, but couldn't get it alive - the problem is that the Master instance tries to get an exclusive lock on the ethernet adapter at program startup (independent from xBusStop)...

      But I tried something else, and seems to work. Maybe this is an option for you:
      - Configure single master, and multiple slaves
      - Set all slaves as optional
      - This requires to assign a station address for each of the slaves
      (Actually the station address(-es) can identify your configuration)
      - Define the common input / output data for all the possible configurations in structures (this might be well planned)
      - Create a separate instance of these structures for possible configurations
      - Map the I/O data of the optional slaves to the individual instances. You must do mapping, cannot use %IW-%QW for this.
      - Scan trough the instances for sign of life (actual I/O data)
      - Set a reference in the control application to the selected instance


      This is standard functionality, should work fine...

      If... you want to do it more sophisticated, you can use COE messaging to check presence of individual stations (configurations), read their hardware configuration (slots)... and even to configure station address...

      You can turn off checking of module and vendor ids, module configuration, and also use advanced PDU configuration...

      Please let me know about your progress...
      It's an interesting topic, I will have some similar tasks in the near future, so looking forward a proper solution...

  • kut69

    kut69 - 2022-07-06

    Hi, my question is related to that topic. Is it possible to use 2 "instances" of the EtherCAT master library simultanuous to access 2 different ports for 2 different fieldbus rings?

    • struccc

      struccc - 2022-07-06

      Yes, it's quite common.
      Note that the library is naturally referenced once in the library manager, however you can add multiple EtherCAT masters and underlying topology in the device tree - each of them has to be bounded to one physical or virtual ethernet adapter by MAC address or device ID.

    • struccc

      struccc - 2022-07-06

      Last edit: struccc 2022-07-06

Log in to post a comment.