Drumroll please... r2k presents - a working EtherCAT on rpi with OpenPLC_v3, code available at
https://github.com/r2k-in-the-vortex/OpenPLC_v3 Pay special attention to utils/ethercat_src/conf/
Need to install IgH EtherCAT master, submodule under ethercat_src/external/
XML file is obtained by scanning ethercat, command:
sudo ethercat xml > masterconf.xml (spits out ascii, but needs to be utf-8, massage manually or figure out a way to do it automatically)
all EtherCAT operations require elevation, so if EtherCAT enabled then sudo start openplc, otherwise it doesn't work
ethercat config has configonly flag available that can be used to simulate the entire config and glue module of ethercat_src, when enabled it does basically everything short of actually interacting with ethercat master, one bool var is also looped back in simulation of a output connected to input
https://github.com/r2k-in-the-vortex/ethercat_src/blob/main/src/ecat_handler/ecat_handler.c#L480 openplc platform is linux even though it's on pi
sudo ./
install.sh linux
ethercat_src also has it's own ./
install.sh so it's not needed to reinstall the entire openplc just to update ethercat_src
the commands to massage IgH master are
./bootstrap
./configure --sysconfdir=/etc --enable-8139too=no
make
make modules
sudo make install
sudo make modules_install install
sudo depmod
sudo apt-get install udev
sudo nano /etc/ethercat.conf
in here, set
DEVICE_MODULES="generic"
and master mac to whatever it is
MASTER0_DEVICE="dc:a6:32:7c:13:7a"
sudo reboot
ethercat should now be running, but if not the commands to start/stop it are
sudo systemctl start ethercat
sudo systemctl restart ethercat
sudo systemctl stop ethercat
for debugging ethercat master start with
ethercat --help