pythonpython-3.xethercatpysoem

Connect EtherCAT Device with pysoem


I would like to communicate with an EtherCAT Device. Unfortunately, I can't even open the interface.

This is the Adapter as read out by the code provided:

Adapter 6
\Device\NPF_{1F2BE908-A7E6-4622-BE1B-64E48F18FA6C}
b'Intel(R) Ethernet Connection (11) I219-LM'

Actual Code:

import pysoem

adapters = pysoem.find_adapters()

for i, adapter in enumerate(adapters):
   print('Adapter {}'.format(i))
   print('  {}'.format(adapter.name))
   print('  {}'.format(adapter.desc))

master = pysoem.Master()

master.open("/Device/NPF_{1F2BE908-A7E6-4622-BE1B-64E48F18FA6C}")

if master.config_init() > 0:
   for device in master.slaves:
      print(f'Found Device {device.name}')
else:
   print('no device found')

master.close()

Error:

could not open interface /Device/NPF_{1F2BE908-A7E6-4622-BE1B-64E48F18FA6C}

Solution

  • I encountered the same problem on Windows 10.
    What worked out for me is:

    master.open('\\Device\\NPF_{1F2BE908-A7E6-4622-BE1B-64E48F18FA6C}')

    The \\ is the trick I guess. :)