** Installation guide for Ethercat with Debian10.
It's done in 4 stages.
1. Install debian 10 (includes linuxcnc)
2. Install etherlab software
3. Install ec-debianize (is etherlab, configured linuxcnc compatible)
4. Install linuxcnc-ethercat (lcec driver for linuxcnc)
$ are user terminal commands, # as root.
-- Download & install the iso cd :
www.linuxcnc.org/iso/linuxcnc-2.8.0-buster.iso
-- Install missing buster kernel headers
$ sudo apt install linux-headers-$(uname -r)
-- Install some dependencies
$ sudo apt-get install debhelper dkms gettext autoconf automake libtool quilt mercurial git
-- Get the ethercat software
$ hg clone
hg.code.sf.net/p/etherlabmaster/code
ethercat-hg
$ cd ethercat-hg
$ hg update stable-1.5
-- Install the ethercat software
$ ./bootstrap
$ ./configure --disable-8139too --with-linux-dir=/usr/src/linux-headers-4.19.0-11-rt-amd64/
$ make all modules
$ sudo make modules_install install
$ sudo depmod
**x**
-- Retrieve mac adres
$ ip link show
-- Copy some files around. Use $ sudo thunar
copy from etherlab-hg directory "script/init.d/ethercat" to /etc/init.d/ -->> change permissions to user
copy from etherlab-hg directory "script/sysconfig/ethercat" to /etc/sysconfig -->> change permissions to user
-- Edit ethercat file in /etc/sysconfig/:
MASTER0_DEVICE="your mac adres"
DEVICE_MODULES="generic"
**x**
-- Start Ethercat bus
$ sudo /etc/init.d/ethercat start
-- Check if your ethercat bus is running :
$ sudo /etc/init.d/ethercat status
-- At this stage we have no ec-debianize patches done to the ethercat software.
-- Install ec-debianize
edit file :
/etc/mercurial/hgrc
add to file :
[extensions]
mq =
$ git clone
github.com/sittner/ec-debianize.git
$ cd ec-debianize
$ ./get_source.sh
$ cd etherlabmaster && dpkg-checkbuilddeps (and install missing deps by : sudo apt-get instal ..)
$ dpkg-buildpackage
-- Install deb packages
$ sudo dpkg -i /home/user/ec-debianize/etherlabmaster_1.5.2+20190904hg33b922p8ea394-1_amd64.deb
$ sudo dpkg -i /home/user/ec-debianize/etherlabmaster-dbgsym_1.5.2+20190904hg33b922p8ea394-1_amd64.deb
$ sudo dpkg -i /home/user/ec-debianize/etherlabmaster-dev_1.5.2+20190904hg33b922p8ea394-1_amd64.deb
edit file : /etc/default/ethercat -> see steps section **x** above
$ sudo update-ethercat-config
-- Install linuxcnc-ethercat
$ git clone
github.com/sittner/linuxcnc-ethercat.git
$ cd linuxcnc-ethercat
$ sudo apt-get install libexpat1-dev
$ make
Restart pc. Ethercat bus will now start by itself. Don't forget to attach cat cable.
-- Test Linuxcnc with ethercat
1. Start linuxcnc choose axis config, create desktop icon.
2. Edit : /home/user/linuxcnc/configs/sim.axis/axis.ini
Add : POSTGUI_HALFILE = postgui.hal
3. Create postgui.hal file in the axis.ini directory.
Add :
loadusr -W /home/user/linuxcnc-ethercat/src/lcec_conf /home/user/linuxcnc/configs/sim.axis/ethercat-conf.xml
loadrt lcec
addf lcec.read-all servo-thread
addf lcec.write-all servo-thread
4. Create ethercat-conf.xml file in the axis.ini directory.
my file looks like :
<masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1000">
<slave idx="0" type="EK1100" name="Terminal"/>
<slave idx="1" type="EL2124" name="Dig_out0"/>
<slave idx="2" type="EL2124" name="Dig_out1"/>
</master>
</masters>
5. Copy the lcec_conf file from /home/user/linuxcnc-ethercat/src/ to your linuxcnc axis.ini directory
6. Copy the lcec.so file from /home/user/linuxcnc-ethercat/src/ to /usr/lib/linuxcnc/modules/
7. Open /dev/Ethercat0 --> set all permissions to read/write.
Open /etc/udev/rules.d/00-ethercat.rules -> to stop complaining Ethercat0 rules i modified to : KERNEL=="EtherCAT[0-9]*", MODE="0660", GROUP="your user group name"
8. Restart linuxcnc. Open machine -> hal configuration -> Pins -> lcec
your slave pin's will show up.
9. Test Hal command : setp lcec.0.Dig_out0.dout-0 true
10. Oke that's all. Application restart tested ok.