Parallel port stepper control and etherCAT I/O

More
25 Oct 2022 19:08 #255054 by O.R
I installed ethercat master again and now ethercat.conf is not empty.
sorvi@debian:~$ sudo apt-get install ethercat-dkms libethercat libethercat-dev ethercat-master
[sudo] password for sorvi:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  dkms linux-headers-4.19.0-22-amd64 linux-headers-4.19.0-22-common
  linux-headers-amd64
Suggested packages:
  python3-apport menu
The following NEW packages will be installed:
  dkms ethercat-dkms ethercat-master libethercat libethercat-dev
  linux-headers-4.19.0-22-amd64 linux-headers-4.19.0-22-common
  linux-headers-amd64
0 upgraded, 8 newly installed, 0 to remove and 42 not upgraded.
Need to get 11.0 MB of archives.
After this operation, 127 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
WARNING: The following packages cannot be authenticated!
  ethercat-dkms libethercat ethercat-master libethercat-dev
Install these packages without verification? [y/N] y
Get:1 http://deb.debian.org/debian buster/main amd64 dkms all 2.6.1-4 [74.4 kB]
Get:2 http://security.debian.org/debian-security buster/updates/main amd64 linux-headers-4.19.0-22-common all 4.19.260-1 [8,582 kB]
Get:3 https://download.opensuse.org/repositories/home:/bone11111:/branches:/science:/EtherLab/Debian_10 ./ ethercat-dkms 1.5.2-34 [1,058 kB]
Get:4 https://download.opensuse.org/repositories/home:/bone11111:/branches:/science:/EtherLab/Debian_10 ./ libethercat 1.5.2-34 [20.8 kB]
Get:5 https://download.opensuse.org/repositories/home:/bone11111:/branches:/science:/EtherLab/Debian_10 ./ ethercat-master 1.5.2-34 [138 kB]
Get:6 https://download.opensuse.org/repositories/home:/bone11111:/branches:/science:/EtherLab/Debian_10 ./ libethercat-dev 1.5.2-34 [19.5 kB]
Get:7 http://security.debian.org/debian-security buster/updates/main amd64 linux-headers-4.19.0-22-amd64 amd64 4.19.260-1 [1,107 kB]
Get:8 http://security.debian.org/debian-security buster/updates/main amd64 linux-headers-amd64 amd64 4.19+105+deb10u17 [7,012 B]
Fetched 11.0 MB in 5s (2,368 kB/s)        
Selecting previously unselected package dkms.
(Reading database ... 136195 files and directories currently installed.)
Preparing to unpack .../0-dkms_2.6.1-4_all.deb ...
Unpacking dkms (2.6.1-4) ...
Selecting previously unselected package ethercat-dkms.
Preparing to unpack .../1-ethercat-dkms_1.5.2-34_all.deb ...
Unpacking ethercat-dkms (1.5.2-34) ...
Selecting previously unselected package libethercat.
Preparing to unpack .../2-libethercat_1.5.2-34_amd64.deb ...
Unpacking libethercat (1.5.2-34) ...
Selecting previously unselected package ethercat-master.
Preparing to unpack .../3-ethercat-master_1.5.2-34_amd64.deb ...
Unpacking ethercat-master (1.5.2-34) ...
Selecting previously unselected package libethercat-dev.
Preparing to unpack .../4-libethercat-dev_1.5.2-34_amd64.deb ...
Unpacking libethercat-dev (1.5.2-34) ...
Selecting previously unselected package linux-headers-4.19.0-22-common.
Preparing to unpack .../5-linux-headers-4.19.0-22-common_4.19.260-1_all.deb ...
Unpacking linux-headers-4.19.0-22-common (4.19.260-1) ...
Selecting previously unselected package linux-headers-4.19.0-22-amd64.
Preparing to unpack .../6-linux-headers-4.19.0-22-amd64_4.19.260-1_amd64.deb ...
Unpacking linux-headers-4.19.0-22-amd64 (4.19.260-1) ...
Selecting previously unselected package linux-headers-amd64.
Preparing to unpack .../7-linux-headers-amd64_4.19+105+deb10u17_amd64.deb ...
Unpacking linux-headers-amd64 (4.19+105+deb10u17) ...
Setting up dkms (2.6.1-4) ...
Setting up linux-headers-4.19.0-22-common (4.19.260-1) ...
Setting up ethercat-dkms (1.5.2-34) ...
Loading new ethercat-dkms-1.5.2 DKMS files...
Building for 4.19.0-21-rt-amd64
Module build for kernel 4.19.0-21-rt-amd64 was skipped since the
kernel headers for this kernel does not seem to be installed.
Adding Module to DKMS build system
Error! DKMS tree already contains: ethercat-dkms-1.5.2
You cannot add the same module/version combo more than once.
Doing initial module build
Error! Your kernel headers for kernel 4.19.0-21-rt-amd64 cannot be found.
Please install the linux-headers-4.19.0-21-rt-amd64 package,
or use the --kernelsourcedir option to tell DKMS where it's located
Installing initial module
Error! Your kernel headers for kernel 4.19.0-21-rt-amd64 cannot be found.
Please install the linux-headers-4.19.0-21-rt-amd64 package,
or use the --kernelsourcedir option to tell DKMS where it's located
Done.
Setting up linux-headers-4.19.0-22-amd64 (4.19.260-1) ...
Setting up libethercat (1.5.2-34) ...
Setting up libethercat-dev (1.5.2-34) ...
Setting up ethercat-master (1.5.2-34) ...

Configuration file '/etc/ethercat.conf'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** ethercat.conf (Y/I/N/O/D/Z) [default=N] ? y
Installing new version of config file /etc/ethercat.conf ...
ethercat.service is a disabled or a static unit, not starting it.
Setting up linux-headers-amd64 (4.19+105+deb10u17) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10+deb10u1) ...
sorvi@debian:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 00:27:0e:14:35:a7 brd ff:ff:ff:ff:ff:ff
3: wlx1caff76aebba: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 1c:af:f7:6a:eb:ba brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.90/24 brd 192.168.1.255 scope global dynamic noprefixroute wlx1caff76aebba
       valid_lft 85092sec preferred_lft 85092sec
    inet6 fe80::4114:2ffa:3d45:136e/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
sorvi@debian:~$ sudo geany /etc/ethercat.conf

Not sure what is a correct MAC address for MASTER0 device.
#------------------------------------------------------------------------------
#
#  EtherCAT master configuration file for use with ethercatctl.
#
#  $Id$
#
#  vim: spelllang=en spell tw=78
#
#------------------------------------------------------------------------------

#
# Main Ethernet devices.
#
# The MASTER<X>_DEVICE variable specifies the Ethernet device for a master
# with index 'X'.
#
# Specify the MAC address (hexadecimal with colons) of the Ethernet device to
# use. Example: "00:00:08:44:ab:66"
#
# Alternatively, a network interface name can be specified. The interface
# name will be resolved to a MAC address using the 'ip' command.
# Example: "eth0"
#
# The broadcast address "ff:ff:ff:ff:ff:ff" has a special meaning: It tells
# the master to accept the first device offered by any Ethernet driver.
#
# The MASTER<X>_DEVICE variables also determine, how many masters will be
# created: A non-empty variable MASTER0_DEVICE will create one master, adding a
# non-empty variable MASTER1_DEVICE will create a second master, and so on.
#
# Examples:
# MASTER0_DEVICE="00:00:08:44:ab:66"
# MASTER0_DEVICE="eth0"
#
MASTER0_DEVICE=""
#MASTER1_DEVICE=""

#
# Backup Ethernet devices
#
# The MASTER<X>_BACKUP variables specify the devices used for redundancy. They
# behaves nearly the same as the MASTER<X>_DEVICE variable, except that it
# does not interpret the ff:ff:ff:ff:ff:ff address.
#
#MASTER0_BACKUP=""

#
# Ethernet driver modules to use for EtherCAT operation.
#
# Specify a non-empty list of Ethernet drivers, that shall be used for
# EtherCAT operation.
#
# Except for the generic Ethernet driver module, the init script will try to
# unload the usual Ethernet driver modules in the list and replace them with
# the EtherCAT-capable ones. If a certain (EtherCAT-capable) driver is not
# found, a warning will appear.
#
# Possible values: 8139too, e100, e1000, e1000e, r8169, generic, ccat, igb.
# Separate multiple drivers with spaces.
#
# Note: The e100, e1000, e1000e, r8169, ccat and igb drivers are not built by
# default. Enable them with the --enable-<driver> configure switches.
#
# Attention: When using the generic driver, the corresponding Ethernet device
# has to be activated (with OS methods, for example 'ip link set ethX up'),
# before the master is started, otherwise all frames will time out.
#
DEVICE_MODULES=""

#
# Flags for loading kernel modules.
#
# This can usually be left empty. Adjust this variable, if you have problems
# with module loading.
#
#MODPROBE_FLAGS="-b"

#------------------------------------------------------------------------------

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

More
25 Oct 2022 21:48 - 25 Oct 2022 23:51 #255060 by CORBETT
Ok good deal....

Now just do a "ip addr" from the command line and record your MAC address
It should be in the "eth0" section

Then back in the ethercat cofig file under the section with 
MASTER0_DEVICE=""
add your address you saw with "ip addr" (buster)  or "ifconfig" (Wheezy)

Here is an example of one of my old computers.  Sometimes it will be Letters mixed in with the numbers.
MASTER0_DEVICE="03:36:4b:c4:52:66"

*EDIT*
Also, you need to fill in for the device module section
In the ethercat config file, scroll down to the part with
 DEVICE_MODULES=""
Add e1000e to start with and see if it works.  I usually always get e1000 or e1000e to work most always.  May need to put "generic"

it will look like this
DEVICE_MODULES="e1000e"


You may need to do a restart after adding the address.  Don't forget to save the file after you put in the MAC address and device name.


*EDIT*
Don't forget to finish out the commands after doing the above mentioned

sudo systemctl enable ethercat.service
sudo systemctl start ethercat.service
sudo systemctl status ethercat.service
sudo chmod 666 /dev/EtherCAT0

EtherCAT should be running after the above... just do a "ethercat master" and you should see it pop up.
Last edit: 25 Oct 2022 23:51 by CORBETT. Reason: make it clearer

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

More
26 Oct 2022 04:54 #255076 by rodw
Corbet has things well covered

when you type:
ip a, (or ip addr)
look for a line that looks something like this
link/ether 00:0c:29:11:47:23 brd ff:ff:ff:ff:ff:ff
the MAC address is 00:0c:29:11:47:23 in this example

But also I noticed that you were getting an error about linux-headers not being found. Ethercat is fussy about kernel versions. Thats why in the sticky in a subsequent post we said to install them by typing
sudo apt install -y linux-headers-$(uname -r)
The following user(s) said Thank You: CORBETT

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

More
26 Oct 2022 18:54 #255122 by O.R
I installed headers again and "generic" device module worked after restart, i can now see installed slave modules
sorvi@debian:~$ ethercat slaves
0  0:0  PREOP  +  EK1100 EtherCAT-Koppler (2A E-Bus)
1  0:1  PREOP  +  EL2004 4K. Dig. Ausgang 24V, 0.5A
2  0:2  PREOP  +  EL1004 4K. Dig. Eingang 24V, 3ms
3  0:3  PREOP  +  EL1124 4K. Dig. Eingang 5V, 2.2�s, Sensorversorgung
sorvi@debian:~$
The following user(s) said Thank You: rodw

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

More
26 Oct 2022 23:34 #255156 by CORBETT
Good deal...  It's always an awesome feeling when you finally get something working.  
 

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

More
27 Oct 2022 00:51 #255159 by rodw
Great work!

It seems that your problems mostly came from not following the process we mapped out and skipping a few key steps.
But sharing your console results allowed us to drill into the issues.. :)
I will say  though that it is not a trivial exercise and its hard to see the error reports sometimes among other data.
I spent many hurs sorting it out too.
 

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

More
27 Oct 2022 17:52 #255213 by O.R
Yes, thanks for the help so far. Now i am stuck at "git command not found", i tried restart system, but that did not help.
Also i get " Wired connection 1 lost" notification occasionally.
sorvi@debian:~$ sudo apt install expat libexpat1 libexpat1-dev
[sudo] password for sorvi:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
expat is already the newest version (2.2.6-2+deb10u5).
libexpat1 is already the newest version (2.2.6-2+deb10u5).
libexpat1 set to manually installed.
libexpat1-dev is already the newest version (2.2.6-2+deb10u5).
0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.
sorvi@debian:~$ cd dev
sorvi@debian:~/dev$ git clone https://github.com/sittner/linuxcnc-ethercat.git
bash: git: command not found
sorvi@debian:~/dev$

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

More
27 Oct 2022 17:59 #255216 by tommylight
sudo apt install git

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

More
28 Oct 2022 17:23 #255316 by O.R
Ok, i think ethercat driver is now installed:
sorvi@debian:~/dev/linuxcnc-ethercat$ sudo make install
make[1]: Entering directory '/home/sorvi/dev/linuxcnc-ethercat/src'
mkdir -p /usr/lib/linuxcnc/modules
make[2]: Entering directory '/home/sorvi/dev/linuxcnc-ethercat/src'
mkdir -p /usr/bin
cp lcec_conf /usr/bin/
make[2]: Leaving directory '/home/sorvi/dev/linuxcnc-ethercat/src'
make[2]: Entering directory '/home/sorvi/dev/linuxcnc-ethercat/src'
gcc -o lcec_main.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_main.c
gcc -o lcec_class_enc.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_class_enc.c
gcc -o lcec_class_ax5.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_class_ax5.c
gcc -o lcec_generic.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_generic.c
gcc -o lcec_ax5100.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_ax5100.c
gcc -o lcec_ax5200.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_ax5200.c
gcc -o lcec_el1xxx.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el1xxx.c
gcc -o lcec_el1252.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el1252.c
gcc -o lcec_el1859.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el1859.c
gcc -o lcec_el2521.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el2521.c
gcc -o lcec_el2xxx.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el2xxx.c
gcc -o lcec_el2202.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el2202.c
gcc -o lcec_el31x2.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el31x2.c
gcc -o lcec_el31x4.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el31x4.c
gcc -o lcec_el3255.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el3255.c
gcc -o lcec_el40x1.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el40x1.c
gcc -o lcec_el40x2.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el40x2.c
gcc -o lcec_el40x8.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el40x8.c
gcc -o lcec_el41x2.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el41x2.c
gcc -o lcec_el41x4.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el41x4.c
gcc -o lcec_el5101.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el5101.c
gcc -o lcec_el5151.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el5151.c
gcc -o lcec_el5152.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el5152.c
gcc -o lcec_el6900.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el6900.c
gcc -o lcec_el1918_logic.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el1918_logic.c
gcc -o lcec_el1904.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el1904.c
gcc -o lcec_el2904.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el2904.c
gcc -o lcec_ax5805.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_ax5805.c
gcc -o lcec_el7041_1000.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el7041_1000.c
gcc -o lcec_el70x1.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el70x1.c
gcc -o lcec_el7211.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el7211.c
gcc -o lcec_el7342.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el7342.c
gcc -o lcec_el7411.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el7411.c
gcc -o lcec_el95xx.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_el95xx.c
gcc -o lcec_em7004.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_em7004.c
gcc -o lcec_stmds5k.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_stmds5k.c
gcc -o lcec_deasda.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_deasda.c
gcc -o lcec_dems300.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_dems300.c
gcc -o lcec_omrg5.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_omrg5.c
gcc -o lcec_ph3lm2rm.o -Os -g -I. -I/build/linuxcnc-2.8.4.1.gb7824717b/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -DSIM -fPIC -Os -c lcec_ph3lm2rm.c
gcc -shared -o lcec.so lcec_main.o lcec_class_enc.o lcec_class_ax5.o lcec_generic.o lcec_ax5100.o lcec_ax5200.o lcec_el1xxx.o lcec_el1252.o lcec_el1859.o lcec_el2521.o lcec_el2xxx.o lcec_el2202.o lcec_el31x2.o lcec_el31x4.o lcec_el3255.o lcec_el40x1.o lcec_el40x2.o lcec_el40x8.o lcec_el41x2.o lcec_el41x4.o lcec_el5101.o lcec_el5151.o lcec_el5152.o lcec_el6900.o lcec_el1918_logic.o lcec_el1904.o lcec_el2904.o lcec_ax5805.o lcec_el7041_1000.o lcec_el70x1.o lcec_el7211.o lcec_el7342.o lcec_el7411.o lcec_el95xx.o lcec_em7004.o lcec_stmds5k.o lcec_deasda.o lcec_dems300.o lcec_omrg5.o lcec_ph3lm2rm.o -Wl,-rpath,/lib -L/lib -llinuxcnchal -lethercat -lrt
mkdir -p /usr/lib/linuxcnc/modules
cp lcec.so /usr/lib/linuxcnc/modules/
make[2]: Leaving directory '/home/sorvi/dev/linuxcnc-ethercat/src'
make[1]: Leaving directory '/home/sorvi/dev/linuxcnc-ethercat/src'
make[1]: Entering directory '/home/sorvi/dev/linuxcnc-ethercat/examples'
mkdir -p /usr/share/linuxcnc-ethercat/examples
cp -R generic-complex swm-fm45a /usr/share/linuxcnc-ethercat/examples
make[1]: Leaving directory '/home/sorvi/dev/linuxcnc-ethercat/examples'
sorvi@debian:~/dev/linuxcnc-ethercat$

Do i need to install anything else or is it time to configurate LinuxCNC and  test etherCAT I/O. Is there some tutorial for these Beckhoff modules how to configurate LinuxCNC?

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

More
28 Oct 2022 20:34 #255332 by rodw
Great. I have not used any of the beckhoff modules.
You need to build your config by hand. Look for some examples here on the forum.
You need to create a XML file listing your modules. SOmebody else can help with that for Beckhoff.

The hal file will have something like this:
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W ./lcec_conf ethercat-conf.xml
loadrt lcec


addf lcec.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread

#add other addf's here

addf lcec.write-all servo-thread
The order of the addf's is important. You need to addf the read-all before adfing any commnads that affect motion, then place 
write-all at the end. \This means you get the ethercat data, change it then send it back to ethercat.

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

Time to create page: 0.095 seconds
Powered by Kunena Forum