Beckhoff ethercat 64 with bit linuxcnc, How to install.

More
6 years 3 weeks ago #184955 by hozte
it requiered more time, but it works!

Many thanks

Please Log in or Create an account to join the conversation.

More
6 years 3 weeks ago #184991 by Grotius
** 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.
The following user(s) said Thank You: tommylight, Nico2017

Please Log in or Create an account to join the conversation.

More
6 years 3 weeks ago #185002 by Mduran
good, I new to this group and i want to install ethercat on my machines as show in your instructions, when executing the "dpkg-buildpackage" instruction inside the etherlabmaster directory, it throws me this error, you know why:

dpkg-source --before-build etherlabmaster
debian/rules clean
dh clean --with autoreconf,dkms
dh_testdir
dh_auto_clean
dh_autoreconf_clean
debian/rules override_dh_clean
make[1]: Entering directory '/home/lion/ec-debianize/etherlabmaster'
rm -f ChangeLog
dh_clean
make[1]: Leaving directory '/home/lion/ec-debianize/etherlabmaster'
dpkg-source -b etherlabmaster
dpkg-source: error: can't build with source format '3.0 (quilt)': no upstream tarball found at ../etherlabmaster_1.5.2+20190904hg33b922p8ea394.orig.tar.{bz2,gz,lzma,xz}
dpkg-buildpackage: error: dpkg-source -b etherlabmaster gave error exit status 255

Please Log in or Create an account to join the conversation.

More
6 years 3 weeks ago - 6 years 3 weeks ago #185006 by Grotius
Hi, I know your error. I could fix that quite quickly. It's solution is at --Install ec-debianize next line.

Just to help you a little bit more :

First be sure you have a mercurial install.
$ sudo apt-get install mercurial (mercurial is just as github, mercurial has a config file we have to edit to solve your issue).

Open file : c:/etc/mercurial/hgrc (use "sudo thunar" in terminal to edit the file as root)
Add to file hgrc file the following 2 lines of text :

[extensions]
mq =


save file.

reference 1 : forum.linuxcnc.org/24-hal-components/223...ver?start=870#166516
reference 2 : stackoverflow.com/questions/8360471/how-...xtensions-such-as-mq

If your error keeps the same. restart pc.
Last edit: 6 years 3 weeks ago by Grotius.
The following user(s) said Thank You: Nico2017, Mduran

Please Log in or Create an account to join the conversation.

More
6 years 3 weeks ago #185019 by Mduran
Grotius, thanks for your quick answer, it worked for me but at the moment of wanting to run an ini file from linuxcnc I get the following error in terminal:

# I already copied the lcec_conf file in the file where the ini are, so if the error I do not think is because of that

Note: Using POSIX realtime
LinuxCNC terminated with an error. You can find more information in the log:
/home/lion/linuxcnc_debug.txt
and
/home/lion/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

Please Log in or Create an account to join the conversation.

More
6 years 3 weeks ago - 6 years 3 weeks ago #185057 by Grotius
Hi Mike,

You forgot to send the debug output of linuxcnc. Or make a screenshot of the relevant debug info.
Start your linuxcnc config step by step. And be sure about correct path's.

In my postgui.hal file the search path is :
loadusr -W /home/user/linuxcnc-ethercat/src/lcec_conf /home/user/linuxcnc/configs/sim.axis/ethercat-conf.xml

For your postgui.hal file the path is :
1**. loadusr -W /youpath/lcec_conf .. .. .. .. .. /yourpath/ethercat-conf.xml (delete the dots)
2. loadrt lcec
3. addf lcec.read-all servo-thread
addf lcec.write-all servo-thread


In fact you could directly link to the orginal lcec_conf folder, in above example without making a copy of the
lcec_conf file to your linuxcnc config directory, where your axis.ini file is located.

You could start linuxcnc with only line 1**. Only load the lcec_conf file. If linuxcnc starts normal, add line 2, etc.
Check the message output of linuxcnc and anticipate on this. If you can't solve it. Just ask over here.

I mentioned Debian buster 10 will not provide usb-tetering from a clean install.
To enable Ethernet over USB :

in terminal :
$ ip link show --> look for the output number other then enp0s25 or lo, in my case :
3: enp0s26f7u5: <BROADCAST,MULTICAST,UP,LOWER_UP>

goto :
c:/etc/modules-load.d/modules.conf --> add:
g_ether

c:/etc/network/interfaces --> add :
allow-hotplug enp0s26f7u5
iface enp0s26f7u5 inet dhcp


done !
restart pc.

Reference : unix.stackexchange.com/questions/574640/...-using-ethernet-over
Last edit: 6 years 3 weeks ago by Grotius.
The following user(s) said Thank You: Mduran

Please Log in or Create an account to join the conversation.

Time to create page: 0.517 seconds
Powered by Kunena Forum