bnjmnp / pysoem

Cython wrapper for the Simple Open EtherCAT Master Library
MIT License
96 stars 37 forks source link

Cann't connect with network adapters ID #98

Open SukritMachineTools opened 1 year ago

SukritMachineTools commented 1 year ago

`import pysoem

master = pysoem.Master()

master.open('Your network adapters ID')

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

master.close()`

Shows error : ConnectionError: could not open interface 00-E0-4C-16-C4-58

I had replaced network adapters ID with every mac address and ip address of my PC (in Raspberry Pi Os & Linuxcnc), but Things doesn't work.

Please guide me how to use this code in my application ??

bnjmnp commented 1 year ago

Hi. you could simply use the find_adapters.py script to print out all available IDs and then copy the right one into you code.

SukritMachineTools commented 1 year ago

Your method works in Windows 10 but It doesn't work in Raspberry Pi Os and Linuxcnc os.

In that os, by find_adapters.py it show eth0 as adapter name but when i put it in place of Your network adapters ID. It doesn't work .

there it shows error: ConnectError : could not open interface eth0 .

bnjmnp commented 1 year ago

It is not nice but did you try running you Python code with administrator privileges? Could be that it will work then. SOEM uses lower level OS drivers and Linux limits the access to this stuff.

SukritMachineTools commented 1 year ago

Yes I have given excitable privileges to Python code. It can execute python files and PymodbusTcp modules easily. But It show error when use pysoem master.open('eth0').

there it shows error: ConnectError : could not open interface eth0 .