-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ethernet over ecat #60
Conversation
Thanks for the PR! This time I will need a little bit longer for review. I think I have a EL6601 terminal available to test it. |
I have now gone through the PR and everything I could test works as expected (except one issue which is maybe caused by SOEM). So thanks again for your PR, it is really helpful. I have only very minor changes which I will apply before merge, I hope you don't mind. I would like to document here my test results. I did my tests with a EL6601 on a Windows system, so I was not able to test the TAP adapter part on Linux but I have checked the code and found nothing to disagree. The test setup was: PC (NIC 1) -> EK1100 -> EL6601 (with 1 Ethernet Port) -> PC (NIC 2) Test results:
After reboot and without calling Both does not work, i.e. the EL6601 is not sending any DHCP_DISCOVER messages when setting the IP to 0.0.0.0 and it also does not respond with "DHCP not supported". The datasheet of the EL6601, which is in my opinion not following the specs, contains the following about the TwinCAT EoE settings page: "die Checkbox 'DHCP' ist nicht zu benutzen - die Checkbox 'IP-Address' aktiviert die DHCP/BootP-Funktion in der EL66xx." If I use the DHCP check box, TwinCAT only sets the MAC address of the EL6601 and according to the spec the slave should either accept it and enable the DHCP client or respond with "DHCP not supported". So the documentation of EL6601 is right, the button "DHCP" should not be used, but that does not fit to the EtherCAT specs. Finally, when configuring the EL6601 correctly with IP, subnet mask, gateway, dns etc .. then according to the documentation, the EL6601 should serve as an DHCP server to a single device connected to the EL6601's RJ45 port. This works: |
Implemented EoE support in order to tunnel ethernet frames through EtherCAT. For this purpose a virtual network device is used (in linux: TAP device). Data written to the virtual network device is forwarded to an Ethernet-Switchport slave (e.g.: Beckhoff EL6601). The Ethernet-Switchport directs the frames to the target. The received data from Ethernet-Switchport slave is written to the TAP interface which injects the data to the network stack.
Virtual network device was only implemented for linux. To keep the master open for extensions the virtDev sub project was introduced. To add virtual device support (network / serial ...) for other platforms the default stub.c implementation, which does nothing, could be replaced with platform dependent code.
It was necessary to modify ScanDevices in order to get EL6601 reliably into PRE OP state.
Added implementation for serial (RS485) handshake communication (Bechhoff EL6021) to serial.h/c.
Added code to create virtual master / slave terminal pair, so any application can connect to a pseudoterminal slave in order to communicate with serial EtherCAT slave in both dircetions.