Etherrcat Master does not start automatically

More
03 Sep 2024 08:32 #309270 by Bouni
Hi,

a bit more than a year ago I got linuxcnc + ethercat running on a Beckhoff CX2040, back then version 2.8.4 and everything built from source (details in my blog post )

For various reasons I sat the project aside. Last Friday I finally started to work at it agiain. I was astonished to see that its now possible to simply install everything via apt without the need to build it from source.

So I grabed a new CF card and installed the latest iso. a year a go I had to build the ccat driver from source as well but now its bunled with the ethercat master. I simply had to enable it in /etc/ethercat.conf

After a bit of trial and error eveything works as expected excpet for one last thing: If I start the CX2040 there is no /dev/EtherCAT

I can't find anything suspicious:
sudo systemctl status ethercat.service

● ethercat.service - EtherCAT Master Kernel Modules
     Loaded: loaded (/lib/systemd/system/ethercat.service; enabled; preset: enabled)
     Active: active (exited) since Tue 2024-09-03 04:00:40 EDT; 24min ago
    Process: 528 ExecStart=/usr/sbin/ethercatctl start (code=exited, status=0/SUCCESS)
   Main PID: 528 (code=exited, status=0/SUCCESS)
        CPU: 21ms

Sep 03 04:00:40 cx2040-lcec systemd[1]: Starting ethercat.service - EtherCAT Master Kernel Modules...
Sep 03 04:00:40 cx2040-lcec systemd[1]: Finished ethercat.service - EtherCAT Master Kernel Modules.
sudo dmesg | grep -E 'ec_|eth0|EtherCAT'

[    1.848464] e1000e 0000:02:00.0 eth0: (PCI Express:2.5GT/s:Width x1) 00:01:05:25:a9:c2
[    1.848468] e1000e 0000:02:00.0 eth0: Intel(R) PRO/1000 Network Connection
[    1.848625] e1000e 0000:02:00.0 eth0: MAC: 3, PHY: 8, PBA No: FFFFFF-0FF
[    2.330142] e1000e 0000:02:00.0 enp2s0: renamed from eth0
[    3.633351] ec_master: loading out-of-tree module taints kernel.
[    3.633620] ec_master: module verification failed: signature and/or required key missing - tainting kernel
[    3.652282] EtherCAT: Master driver 1.6.1 1.6.1
[    3.652304] EtherCAT: 0 masters waiting for devices.
[    3.660096] ec_ccat: DMA0 mem initialized
[    3.660111] ec_ccat: DMA1 mem initialized
[    3.660484] ec_ccat: registered eth0 as network device.
[    3.660600] ec_ccat: registered ccat_update0.
[    3.660657] ec_ccat: ccat_sram_probe: 0x0016 rev: 0x0000
[    3.660738] ec_ccat: registered ccat_sram0.
[    5.430826] eth0: NIC Link is Up
[    5.430996] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

If I however do a sudo systemctl restart ethercat.service the master starts and works as expected.

The output of sudo systemctl status ethercat.service stays exactly the same.

dmesg gives a bit more:
sudo dmesg | grep -E 'ec_|eth0|EtherCAT'

[    1.848464] e1000e 0000:02:00.0 eth0: (PCI Express:2.5GT/s:Width x1) 00:01:05:25:a9:c2
[    1.848468] e1000e 0000:02:00.0 eth0: Intel(R) PRO/1000 Network Connection
[    1.848625] e1000e 0000:02:00.0 eth0: MAC: 3, PHY: 8, PBA No: FFFFFF-0FF
[    2.330142] e1000e 0000:02:00.0 enp2s0: renamed from eth0
[    3.633351] ec_master: loading out-of-tree module taints kernel.
[    3.633620] ec_master: module verification failed: signature and/or required key missing - tainting kernel
[    3.652282] EtherCAT: Master driver 1.6.1 1.6.1
[    3.652304] EtherCAT: 0 masters waiting for devices.
[    3.660096] ec_ccat: DMA0 mem initialized
[    3.660111] ec_ccat: DMA1 mem initialized
[    3.660484] ec_ccat: registered eth0 as network device.
[    3.660600] ec_ccat: registered ccat_update0.
[    3.660657] ec_ccat: ccat_sram_probe: 0x0016 rev: 0x0000
[    3.660738] ec_ccat: registered ccat_sram0.
[    5.430826] eth0: NIC Link is Up
[    5.430996] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 1825.385150] EtherCAT: Master module cleaned up.
[ 1826.509197] EtherCAT: Master driver 1.6.1 1.6.1
[ 1826.509424] EtherCAT: 1 master waiting for devices.
[ 1826.518490] ec_ccat: DMA0 mem initialized
[ 1826.518506] ec_ccat: DMA1 mem initialized
[ 1826.518519] EtherCAT: Accepting 00:01:05:1E:6B:8E as main device for master 0.
[ 1826.518522] EtherCAT 0: Starting EtherCAT-IDLE thread.
[ 1826.518761] EtherCAT 0: Link state of ecm0 changed to UP.
[ 1826.518925] ec_ccat: registered ccat_update0.
[ 1826.518964] ec_ccat: ccat_sram_probe: 0x0016 rev: 0x0000
[ 1826.519688] ec_ccat: registered ccat_sram0.
[ 1826.526190] EtherCAT WARNING 0: 1 datagram UNMATCHED!
[ 1826.526232] EtherCAT 0: 9 slave(s) responding on main device.
[ 1826.526234] EtherCAT 0: Slave states on main device: PREOP.
[ 1826.526284] EtherCAT 0: Scanning bus.
[ 1827.763458] EtherCAT 0: Bus scanning completed in 1236 ms.
[ 1827.763462] EtherCAT 0: Using slave 0 as DC reference clock.

Does anybody know what stops the master from starting automatically?

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

More
03 Sep 2024 13:07 #309286 by scottlaird
Replied by scottlaird on topic Etherrcat Master does not start automatically
Try `sudo systemctl enable ethercat.service`. That should tell it to start automatically on boot. I'm not sure why that wasn't set up on install, but it sounds like it'll fix the problem.

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

  • rodw
  • rodw's Avatar
  • Away
  • Platinum Member
  • Platinum Member
More
04 Sep 2024 03:23 #309324 by rodw
I think fom memory you need to set a udev rule for it to persist on a restart. Its covered in the sticky.

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

More
04 Sep 2024 04:53 #309327 by Bouni
The service is already enabled:
sudo systemctl status ethercat.service
[sudo] password for user:
● ethercat.service - EtherCAT Master Kernel Modules
     Loaded: loaded (/lib/systemd/system/ethercat.service; enabled; preset: enabled)
     Active: active (exited) since Tue 2024-09-03 08:50:22 EDT; 15h ago
    Process: 3800 ExecStart=/usr/sbin/ethercatctl start (code=exited, status=0/SUCCESS)
   Main PID: 3800 (code=exited, status=0/SUCCESS)
        CPU: 46ms

Sep 03 08:50:22 cx2040-lcec systemd[1]: Starting ethercat.service - EtherCAT Master Kernel Modules...
Sep 03 08:50:22 cx2040-lcec systemd[1]: Finished ethercat.service - EtherCAT Master Kernel Modules.

and the udev rule is set:
cat /etc/udev/rules.d/99-ethercat.rules
KERNEL=="EtherCAT[0-9]", MODE="0777"

I have a feeling that its more like a timing issue or has something to do with the IPV6 message in the dmesg logs:
[    5.551029] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

If I do an ip a right after the start of the system I geth this output:
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 noprefixroute
       valid_lft forever preferred_lft forever
2: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 00:01:05:25:a9:c2 brd ff:ff:ff:ff:ff:ff
3: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:01:05:25:a9:c3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.3.118/24 brd 192.168.3.255 scope global dynamic noprefixroute enp3s0
       valid_lft 3591sec preferred_lft 3591sec
    inet6 fe80::201:5ff:fe25:a9c3/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:01:05:1e:6b:8e brd ff:ff:ff:ff:ff:ff

But if I then restart the service, the eth0 is gone from the list:
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 noprefixroute
       valid_lft forever preferred_lft forever
2: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 00:01:05:25:a9:c2 brd ff:ff:ff:ff:ff:ff
3: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:01:05:25:a9:c3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.3.118/24 brd 192.168.3.255 scope global dynamic noprefixroute enp3s0
       valid_lft 3503sec preferred_lft 3503sec
    inet6 fe80::201:5ff:fe25:a9c3/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

Maybe network manager tries to configure eth0 (which is the CCAT interface of the CX2040)

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

Time to create page: 0.078 seconds
Powered by Kunena Forum