ethercat

failed to obtain number of masters: failed to open master device /dev/ethercat0: no such file or directory?


I compiled IGH(version 1.6.0) using the 6.4.0 kernel on the debian12 operating system, and then packaged the compiled results onto another x86 system (kernel version 6.4.0). After decompressing, I executed the following command:

# cd etherlab
# cp ec_master.ko  /lib/modules/6.4.0-rt8+/
# cp ec_generic.ko /lib/modules/6.4.0-rt8+/
# cp /lib/modules/6.4.0-rt8+/
# depmod -a
# cp etc/init.d/ethercat /etc/init.d/
# cp bin/ethercat /bin/
# mkdir /etc/sysconfig
# cp etc/sysconfig/ethercat /etc/sysconfig/
# echo KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\" > /etc/udev/rules.d/99-EtherCAT.rules
# modprobe ec_master
# insmod /lib/modules/6.4.0-rt8+/ec_generic.ko

When I start Ethercat, it prompts done, but when I execute ethercat master, it says I can't find /dev/EtherCAT0. What's going on? Thanks in advance for your help.

# /etc/init.d/ethercat start
Starting EtherCAT master 1.6.0  done
# ethercat master
Failed to obtain number of masters: Failed to open master device /dev/EtherCAT0: No such file or directory

Doubt point 1, Both ec_master and ec_generic have been loaded.

# lsmod | grep ec_generic
ec_generic 12288 0 - Live 0xffffffffc0677000 (O)
ec_master 446464 1 ec_generic, Live 0xffffffffc0689000 (O)

Doubt point 2: ethercat.conf has configured the corresponding network card name.

# grep eth0  etc/ethercat.conf
MASTER0_DEVICE="eth0"

Solution

  • When installing the ec_master module, it is necessary to specify main_devices, as follows:

    modprobe ec_master main_devices=90:E4:68:02:01:54
    

    90:E4:68:02:01:54 is the MAC address of the Ethernet communication network card.