In my previous post on this topic I successfully managed to get LinuxCNC with EtherCat running on a Beckhoff CX2040. That was over a year ago and since then I didn’t have the time to dig deeper into the matter. Until now, and a lot has changed in the meantime …
Last weekend I attended DDos at the Odenwilusenz Hackerspace in Beringen, Switzerland. In the days before that, I planned to reactivate my setup and bring it along.
When I started the system, everything worked exactly like when I left it. So I added a Beckhoff EL1804 and as Beckhoff EL2828 just to find out that the used version of the linuxcnc-ethercat does not sopport these two types.
An attempt to update to the latest version failed. So I looked at the LinuxCNC website to check out what’s the latest version. I ran 2.8.4 and the latest release was 2.9.3 which, to my surprise now comes from a debian repo along withthe latest version of linuxcn-ethercat. And that also includes the CCAT driver which I had to build from source the last time.
So I decided to start all over and install the 2.9.3 ISO on a new CF card.
Installation ๐
The installation was straight forward as expected. After booting the system for the first time, I got an error at the attempt to do a system update.
The reason is a missing or wrong GPG key in the sources.list
However, the recommended solution from the LinuxCNC forum didn’t work for me, but I was able to use the instructions from the Etherlab website
|
|
This adds a new file called etherlab.list
to /etc/apt/sources.list.d/
, which requires that the original .list file is deleted.
After that I was able ti update and upgrade with
|
|
I installed LinuxCNC and linuxcnc-ethercat from the repo
|
|
Then I enabled and started the EtherCat Master
|
|
That failed because I was missing configuration in /etc/ethercat.conf
.
The config file requires two settings MASTER0_DEVICE
and DEVICE_MODULES
.
To get the MAC of eth0
which is the CCAT simply run ip a
and read the MAC address from there.
I set MASTER0_DEVICE="00:01:05:1e:6b:8e"
and DEVICE_MODULES="ccat"
Luckily the Etherlab master comes with prebuild ccat drivers.
After a reboot there was still no /dev/EtherCAT
device 🤔
So I ran sudo systemctl restart ethercat.service
and that worked.
The LinuxCNC forum recommends to add a udev rule for correct permissions, so I added /etc/udev/rules.d/99-ethercat.rules
with this content:
|
|
After another reboot /dev/EtherCAT
was gone again. sudo systemctl restart ethercat.service
brought it back.
At the time of writing this I was not able to figure out whats causing this and how to fix it other than running a sudo systemctl restart ethercat.service
after every system start.
Testing EtherCat ๐
I quickly checked if the master was running
|
|
Nice 😎
Creating a test config ๐
I started LinuxCNC with the sim.axis config to have a template to start with.
In the [HAL]
section of axis.ini
I added a HALFILE = ethercat.hal
.
Next I created two new files in the same folder, ethercat.hal
and ethercat-config.xml
.
The first looks like this:
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
addf lcec.read-all servo-thread
addf lcec.write-all servo-thread
The later like this
|
|
I switched my setup back to the old EL1018 and EL2008 terminals because I knew they were working in the old setup.
After starting LinuxCNC with this config I was able to see inputs in the Show HAL configuration menu under Pins -> lcec -> Master0
.
Overall a very easy setup compared to what I had to do last time.
Nice work from the people at LinuxCNC , Etherlab/IgH and linuxcnc-ethercat