pysoem
pysoem copied to clipboard
Is EOE not implemented or am i initializing incorrectly?
Hi i am using Twin CAT to configure the EtherCAT master to use EOE , but when in run the Pysoem script to read the data, the EOE-configurations made from TWINCAT are being removed. can anyone suggest a solution or workaround for this issue
import pysoem
import binascii
class Master:
def __init__(self, adapter):
self.adapter = adapter
self.adapters = None
self.slave = None
self.config = None
self.devices = None
self.adapter = adapter
self.master = pysoem.Master()
self.master.open(self.adapter)
self.master.config_map()
self.config = self.master.config_init()
self.master.config_map()
self.master.receive_processdata()
self.slave = self.master.slaves[0]
def scan_slaves(self):
for index, dev in enumerate(self.master.slaves):
print(f'Found Device {dev.name} at index {index}')
def run(self):
while 1:
try:
self.master.send_processdata()
rec = self.master.receive_processdata()
recv_data = self.slave.input
print(binascii.rledecode_hqx(recv_data))
except Exception as exception:
print(exception)
def main():
master = Master('\\Device\\NPF_{AEBE3560-01DF-4EF8-A2B6-CB39176E4010}')
# master.scan_slaves()
# master.init_slave(0)
master.run()
if __name__ == '__main__':
main()
Currently EoE is not supported in any way by PySOEM, and it is not possible to run TwinCAT and PySOEM in parallel using the same network adapter. Even if the EoE related SOEM functions would be exposed by PySOEM, rerouting the Ethernet to a virtual Windows network adapter, like TwinCAT is doing this, is probably not an easy task.
@bnjmnp Thanks for the reply. are there any plans to support EoE on Pysoem ?
It is not planned yet. I cannot oversea the effort, and I don't have a good idea on how to test it. Again, don't expect a virtual Ethernet port in your OS, you will only get something like a read and write function where you need route your Ethernet frames to.