Problems integrating EtherCAT and LinuxCNC

More
14 Dec 2023 15:34 #288132 by smal
I would like to make LinuxCNC work with my EK1100 and subsequent EL1809 and EL2008 modules.
For that I have installed EtherCAT following this instructions:

forum.linuxcnc.org/ethercat/45336-etherc...step-by-step?start=0 (#237098)

and the functionality works according to my expectations. I can see the modules:
smal@linuxCNC:~/linuxcnc-ethercat$ ethercat slaves
0  0:0  PREOP  +  EK1100 EtherCAT-Koppler (2A E-Bus)
1  0:1  PREOP  +  EL1809 16K. Dig. Eingang 24V, 3ms
2  0:2  PREOP  +  EL2008 8K. Dig. Ausgang 24V, 0.5A

and the EtherCAT communication is running as soon Linux Bookworm 12.1 is active.
Thank you very much to Rod Webster for his work done here.

Now I would like to integrate EtherCAT modules to my LinuxCNC project. For the start I have included:

loadusr -W /bin/lcec_conf ethercat-conf.xml
loadrt lcec

into my hal file. When I start my LinuxCNC project I get following message:
Note: Using POSIX realtime
lcec: dlopen: /home/smal/linuxcnc-dev/rtlib/lcec.so: cannot open shared object file: No such file or directory
./smal3D_CNC_machine.hal:20: waitpid failed /home/smal/linuxcnc-dev/bin/rtapi_app lcec
./smal3D_CNC_machine.hal:20: /home/smal/linuxcnc-dev/bin/rtapi_app exited without becoming ready
./smal3D_CNC_machine.hal:20: insmod for lcec failed, returned -1

I assume a part of EtherCAT driver should be added to LinuxCNC and then recompiled which was not done with EtherCAT installation. I already have an /linuxcnc-ethercat folder on my home folder but when I try it to recompile I get the message:
mal@linuxCNC:~/linuxcnc-ethercat$ make
configure.mk:8: *** halcompile/comp executable not found or set.  Stop.
make: *** [Makefile:17: config.mk] Error 2


I have also tried this way - Ethercat build from source - full instructions (#277900):
forum.linuxcnc.org/ethercat/49771-etherc...instructions?start=0
but while trying to get code from repositories:
smal@linuxCNC:~$ git clone gitlab.com/etherlab.org/ethercat.git ethercat-master
fatal: repository 'gitlab.com/etherlab.org/ethercat.git' does not exist
smal@linuxCNC:~$ git clone github.com/LinuxCNC/linuxcnc.git   linuxcnc-dev
fatal: repository 'github.com/LinuxCNC/linuxcnc.git' does not exist

What to do to get the missing /home/smal/linuxcnc-dev/rtlib/lcec.so file or what to do to get the things done properly?








 

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

More
14 Dec 2023 17:52 #288144 by TimP
have you tried?
loadusr -W lcec_conf ethercat-conf.xml
instead of
loadusr -W /bin/lcec_conf ethercat-conf.xml
The following user(s) said Thank You: smal

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

More
14 Dec 2023 21:21 #288169 by smal
With
loadusr -W lcec_conf ethercat-conf.xml
instead of
loadusr -W /bin/lcec_conf ethercat-conf.xml
I get the same error:
lcec: dlopen: /home/smal/linuxcnc-dev/rtlib/lcec.so: cannot open shared object file: No such file or directory
./smal3D_CNC_machine.hal:20: waitpid failed /home/smal/linuxcnc-dev/bin/rtapi_app lcec
./smal3D_CNC_machine.hal:20: /home/smal/linuxcnc-dev/bin/rtapi_app exited without becoming ready
./smal3D_CNC_machine.hal:20: insmod for lcec failed, returned -1

When I grep for lcec_conf I found it in smal@linuxCNC:/bin$
In this folder is no lcec to be found. Anyway why there is a problem when I try to recompile the linuxcnc-ethercat? I guess I should be able to compile my own lcec.so and in worst case put it in linuxcnc-dev/rtlib/ folder manually.

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

More
14 Dec 2023 21:42 #288172 by smal
Problem solved:
I have found the lcec.so file in this folder:
/usr/lib/linuxcnc/modules/lcec.so
and the I have copied to this folder:
/home/smal/linuxcnc-dev/rtlib/

Reference post: Beckhoff ethercat 64 with bit linuxcnc, How to install.(#123873)
forum.linuxcnc.org/ethercat/35591-beckho...-to-install?start=10

After that there was a problem finding ethercat-conf.xml. As you proposed it should be: loadusr -W lcec_conf ethercat-conf.xml

Now my linuxcnc loads without problems and I hope to be able to add nets to I/O pins.

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

More
15 Dec 2023 08:35 #288201 by rodw
Sorry you had some issues here. There have been a few changes. I'm not sure if the linuxcnc  installer has been updated to the 2.9.1a patch but.
1. The ethercat guys now have their own repository
2. They also started to hosted the Linuxcnc ethercat driver in that repository.
3. The 2.9.1 installer already has the ethercat repositories installed
4. There is therefore no need to compile anything from source to get ethercat installed

You simply need to type
sudo apt update
sudo apt install ethercat-master libethercat-dev  linuxcnc-ethercat

Then continue with my sticky instructions in the sticky you linked to.
You should not have issues being unable to find the .so file because it is installed in the correct system folder and it should be in the search path. I'm not sure what happened there. Maybe its not being set properly by the installer.
The following user(s) said Thank You: smal

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

More
15 Dec 2023 08:49 #288203 by rodw
EDIT:
to permananetly add the modules folder to your path you can edit .bashrc in your home folder and add this at the end. (geany .bashrc)

export PATH="/usr/lib/linuxcnc/modules:$PATH"

But it should resolve when running linuxcnc as all of the standard components live there too.
The following user(s) said Thank You: smal

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

Time to create page: 0.071 seconds
Powered by Kunena Forum