robert-burger / libethercat

EtherCAT master library. This library is used to build a deterministic fieldbus network with EtherCAT components.
https://www.dlr.de/rm
Other
29 stars 6 forks source link

How to setup libethercat for only user space, #9

Open monishekar518 opened 5 months ago

monishekar518 commented 5 months ago

I would like to use libethercat as master and connect it to a virtual interface to scan and configure the slaves.

would this be possible ?

robert-burger commented 5 months ago

As libethercat is a user space library i don't understand your question and the relation to a virtual interface.

In principle libethercat doesn't care if the provided interface is virtual. How should this be configured? What slaves attached to where? How does your setup look like?

monishekar518 commented 5 months ago

So I want a set up a network like shown below. Libethercat master <--> virtual nic <--> physical nic <--> slave

i am able to initalize but the master is not able to read the slaves and configure the slave on the network. virtual interface is created as below.

sudo modprobe dummy

sudo ip link add eth0 type dummy

sudo ip link set eth0 up

the binding between virtual to physical nic is operated using raw sockets. I have created 2 threads, thread 1 > binding function with 2 sockets, source as virtual nic and destination as physical nic, then forward frames thread 2 > binding function with 2 sockets, source as physical nic and destination as virtual nic, then forward frames

Physical connection is connected to Beckhoff slave.

Could you please tell me why the master doesn't detect slaves with above setup.

robert-burger commented 5 months ago

In this case i don't think that the dummy driver is the right choice. As the name implies the dummy devices are not really working.

I think you should better have a look at tun/tap devices. For EtherCAT (layer 2 ethernet) a tap device should be the best choice here.

monishekar518 commented 5 months ago

But, I am able to capture the frames from master using raw sockets.

robert-burger commented 4 months ago

sorry that i come back to this that late.

did you resolve the issue in the meantime?

So you have wireshark/tcpdump logs and can see the EtherCAT frames in both direction captured at the physical nic AND the virtual nic?