did anyone success install linuxcnc-ethercat on rpi4?

More
26 Mar 2021 04:24 #203668 by thang
To install linuxcnc-ethercat it requires install etherlabmaster, etherlabmaster-dev, linuxcnc-dev then linuxcnc-ethercat.
Following tutorial is written by Grotius: forum.linuxcnc.org/27-driver-boards/3559...uxcnc-how-to-install. I success to build etherlabmaster.deb and etherlabmaster-dev.deb for rpi4 but stucked when installing etherlabmaster, it return error "Error! Bad return status for module build on kernel:"
I'm using kernel linux-image-4.19.71-rt24-v7l+ for rpi 4

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

More
26 Mar 2021 07:01 - 26 Mar 2021 07:32 #203673 by Hakan
I did earlier this week. Follow these instructions, they work. I can at least switch on and off digital outputs on the EL2008.
I tried the instructions you link to and didn't succeed either.
forum.linuxcnc.org/24-hal-components/223...er?limit=6&start=882

Actually there is a step missing and that is to apply the linuxcnc-ethercat/patches/add-task-pll-functions-2.8.patch to linuxcnc-dev sources. Also, start with the rt kernel that comes from linuxcnc.
Last edit: 26 Mar 2021 07:32 by Hakan.

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

More
26 Mar 2021 10:51 #203689 by thang
I did a fresh install following your post.
1. Install linuxcnc official iso image for rpi4: www.linuxcnc.org/iso/linuxcnc-2.8.1-pi4.zip
2. Install linux-header correspond realtime kernel
3. following ur link, i success install etherlabmaster
4. Installing linuxcnc-dev 2.8
5. Download linuxcnc-ethercat and make but i get error:
lcec_conf.h:22:10: fatal error: ecrt.h: No such file or directory
What did i miss?
The error above seem relate to etherlabmaster-dev, also the add-task-pll-functions-2.8.patch seem already be in linuxcnc 2.8

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

More
26 Mar 2021 12:51 - 26 Mar 2021 12:58 #203701 by Hakan
I just redid the compile of linuxcnc-ethercat. Here is what I did - after ". ~/linuxcnc-dev/scripts/rip-environment"
Check the include-directories "-I." etc, you may need to add them to config.mk and realtime.mk , I don't remember the details but there were some mod needed there.


Edit: Also needed to add -L/opt/etherlab/lib to the LDFLAGS line of realtime.mk for it to find libethercat.so
Attachments:
Last edit: 26 Mar 2021 12:58 by Hakan.

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

More
26 Mar 2021 12:56 - 26 Mar 2021 13:01 #203702 by Grotius
I repaired some stuff.

Try this.

You have to set your includepath in the /configure.mk file to point to halcompile if you use the methode below :
For example /usr/include/halcompile
That's all.

$ git clone github.com/grotius-cnc/linuxcnc-ethercat
$ cd linxucnc-ethercat
$ make
$ make install

This will also install the lcec.so in the correct linuxcnc rt dir. Etc.
Last edit: 26 Mar 2021 13:01 by Grotius.

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

More
26 Mar 2021 20:56 - 26 Mar 2021 20:57 #203751 by Hakan
@thang did you get it to work? I checked a bit more and the problem arises because etherlab is installed all under /opt/etherlab. Include files and libraries are not found in the usual places, thus one need to add paths to include files and libraries during build. Unfortunately.

After etherlab is built, an ugly fix is to create links from the common places to /opt/etherlab.
sudo ln -s /opt/etherlab/include/*.h /usr/include/linuxcnc/
sudo ln -s /opt/etherlab/lib/lib* /usr/lib/

After this, linuxcnc-ethercat build cleanly without modification. Linux with ethercat starts up without further mod as well. It is enough to use linuxcnc-uspace-dev package, it is not necessary to build linuxcnc from source.
Last edit: 26 Mar 2021 20:57 by Hakan.
The following user(s) said Thank You: virencq

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

More
27 Mar 2021 03:07 #203768 by thang
Nice guys, Linuxcnc-ethercat now is built, I will start test it on my driver and write a short tutorial

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

More
29 Mar 2021 10:50 - 30 Mar 2021 09:24 #204011 by thang
Here is a short tutorial to install linuxcnc ethercat, thank Hakan and Grotius for making my life easier :laugh:

1. Installing linuxcnc image:
Download official image: www.linuxcnc.org/iso/linuxcnc-2.8.1-pi4.zip
Flash SD card.
setting up system

2. Installing etherlab master
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install bison flex libssl-dev
sudo apt-get install linux-headers-4.19.71-rt24-v7l+
sudo wget -P /usr/include/tools/ https://raw.githubusercontent.com/raspberrypi/linux/rpi-4.19.y/tools/include/tools/be_byteshift.h
sudo wget -P /usr/include/tools/ https://raw.githubusercontent.com/raspberrypi/linux/rpi-4.19.y/tools/include/tools/le_byteshift.h 
cd /usr/src/linux-headers-4.19.71-rt24-v7l+/
sudo make -i modules_prepare
sudo apt install -y build-essential libtool automake tree dkms git mercurial
cd 
mkdir ethercat 
cd ethercat
git clone http://github.com/icshwi/etherlabmaster
make init
echo "ENABLE_CYCLES = NO" > configure/CONFIG_OPTIONS.local
make build
make install
echo "ETHERCAT_MASTER0=eth0" > ethercatmaster.local
make dkms_add
make dkms_build
make dkms_install
make setup
# Reboot or start manually by
sudo systemctl start ethercat
# Checking ethercat
sudo systemctl status ethercat.service

3. Installing linuxcnc-ethercat
sudo apt-get install linuxcnc-uspace-dev
sudo ln -s /opt/etherlab/include/*.h /usr/include/linuxcnc/
sudo ln -s /opt/etherlab/lib/lib* /usr/lib/
git clone http://github.com/sittner/linuxcnc-ethercat.git
cd linuxcnc-ethercat
make

4. You are now can use lcec_conf and lcec.so in linuxcnc-ethercat/src folder
Copy lcec_conf to config folder
Copy lcec.so to usr/lib/linuxcnc/modules

5. If you are using linuxcnc-dev
git clone github.com/grotius-cnc/linuxcnc-ethercat
# Set your includepath in the /configure.mk file to point to halcompile
cd linxucnc-ethercat
make
make install

Reference: forum.linuxcnc.org/10-advanced-configura...at-on-raspberry-pi-4
Last edit: 30 Mar 2021 09:24 by thang. Reason: Insert reference link
The following user(s) said Thank You: tommylight

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

More
25 Dec 2021 01:32 #229941 by virencq
One question remains, can we use EtherCat (For Servo drives) along with GPIO's (for Inputs/outputs). Mainly for cost savings.

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

More
25 Dec 2021 11:22 #229954 by rodw
Yes you can. The pin function needs to be correctly set for the purpose.

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

Time to create page: 0.130 seconds
Powered by Kunena Forum