This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62A-LP: Issue with Native EtherCAT Driver Installation on AM62A with IGH Stack

Part Number: SK-AM62A-LP
Other Parts Discussed in Thread: SYSCONFIG, TFP410

Tool/software:

Hi Experts,

I am currently working on integrating the EtherCAT native driver on a AM62Ax platform using the EtherCAT IGH master stack.

During the configuration process, I encountered the following issue:

I compiled the IGH EtherCAT master with the native driver support by using the --enable-am65cpsw flag and --disable-generic to select the native driver path. Based on the ( https://gitlab.com/npitre/ethercat/-/commits/master?ref_type=HEADS ) commit by IGH. branch:master commit:(Support for ti-am65-cpsw-nuss with v6.6 kernel).

However, I faced a problem related to load the native EtherCAT driver. It was succesfully installed but when i tried to start the systemctl command it was seem some error related to driver


cmd : /etc/init.d/ethercat restart

Shutting down EtherCAT master 1.6.1 done
Starting EtherCAT master 1.6.1 [ 72.193952] ec_master: loading out-of-tree module taints kernel.
[ 72.205165] EtherCAT: Master driver 1.6.1 1.6-alpha-176-gdb48d9b0
[ 72.211744] EtherCAT: 1 master waiting for devices.
[ 72.257645] Error: Driver 'am65-cpsw-nuss' is already registered, aborting...
modprobe: ERROR: could not insert 'ec_ti_am65_cpsw_nuss': Device or resource busy
failed
root@am62ax:/# uname -a
Linux am62ax 6.6.58-g7a2fa4c23070-dirty #2 SMP Thu May 1 16:07:13 IST 2025 aarch64 aarch64 aarch64 GNU/Linux

Regards,
Debashis

  • Hi Debashis, 

    modprobe: ERROR: could not insert 'ec_ti_am65_cpsw_nuss': Device or resource busy
    failed

    When you check "lsmod" before running IgH Ethernet master on your AM62Ax platform, do you see the "ec_ti_am65_cpsw_nuss" module already loaded? 

    I'm currently out of office and won't be able to look your issue closely until I'm back in office next week, there might be some delay in my responses on this thread.

    -Daolin

  • Hi Daolin,

    Yes, we saw the module(ec_master) is inserted but not used.

    root@mitysom-am62ax:/# lsmod | grep ec
    ec_master             299008  0
    ecdh_generic           16384  1 bluetooth
    ecc                    36864  1 ecdh_generic
    display_connector      12288  0
    drm_kms_helper        200704  4 drm_dma_helper,display_connector,tidss,ti_tfp410
    drm                   643072  6 drm_kms_helper,drm_dma_helper,display_connector,tidss,ti_tfp410



    Both interfaces are linked to the same bus address (8000000.ethernet), which I understand represents a single CPSW Ethernet controller.

    To illustrate the architecture:
    -------------------------

    Linux Network Interface (eth0, eth1)
    -------------------------
    Ethernet Driver (e.g., am65-cpsw-nuss)
    -------------------------
    Ethernet Hardware Block (Controller inside SoC(8000000.ethernet))
    -------------------------
    Physical Ethernet PHY (External transceiver chip)
    -------------------------
    Ethernet Cable

    Initially, I attempted to unbind the CPSW driver and restart the EtherCAT master. However, the same error persisted.

    Upon further investigation, I found that both Ethernet ports (eth0 and eth1) are controlled by the same Ethernet hardware block. The ethtool output confirms this:

    root@mitysom-am62ax:/# ethtool -i eth0
    driver: am65-cpsw-nuss
    version: 6.6.58-g7a2fa4c23070-dirty
    firmware-version:
    expansion-rom-version:
    bus-info: 8000000.ethernet
    supports-statistics: yes
    supports-test: no
    supports-eeprom-access: no
    supports-register-dump: yes
    supports-priv-flags: yes
    root@mitysom-am62ax:/# ethtool -i eth1
    driver: am65-cpsw-nuss
    version: 6.6.58-g7a2fa4c23070-dirty
    firmware-version:
    expansion-rom-version:
    bus-info: 8000000.ethernet
    supports-statistics: yes
    supports-test: no
    supports-eeprom-access: no
    supports-register-dump: yes
    supports-priv-flags: yes

    Summary of My Understanding:
    Both eth0 and eth1 are logical ports of the same CPSW Ethernet hardware block.
    The native EtherCAT driver requires exclusive access to the Ethernet controller.
    It appears I cannot assign one port for EtherCAT and another for regular Linux networking, as both are tied to the same controller.

    Rectify me if I am wrong.

    Regards,
    Debashis

  • Hi Debashis, 

    Yes, we saw the module(ec_master) is inserted but not used.

    Just for clarification, what was your network setup/topology when you observed this issue? Were both ports (EtherCAT and non-EtherCAT port) connected to devices prior to running the EtherCAT master? How did you specify which port is used for EtherCAT in the IgH configuration?

    It appears I cannot assign one port for EtherCAT and another for regular Linux networking, as both are tied to the same controller.

    From a brief test that I did a while back with IgH native driver running on AM62x I remember not encountering an issue with this though I may not have tested with the non-EtherCAT port connected to another device.

    I used the instructions in https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1409114/faq-how-do-i-build-the-native-igh-ethercat-stack-for-ti-microprocessors to setup IgH native driver. Did you use the steps in this FAQ? Specifically, there is a step to setup up the kernel so that the CPSW driver is not built into the kernel but rather built as a module.

    -Daolin

  • Hi Daolin,

    How did you specify which port is used for EtherCAT in the IgH configuration?

    we followed the igh doc and the path is /etc/sysconfig/ethercat.

    All commands are same except this 

    sudo sed -e '/^DEVICE_MODULES=/s/""/"ti_am65_cpsw_nuss"/' \
    -e '/^MASTER0_DEVICE=/s/""/"ff:ff:ff:ff:ff:ff"/' \
    -i /usr/local/etc/ethercat.conf

    But i have written the same in this file as well.


    When starting the EtherCAT service using: /etc/init.d/ethercat start
    it shows that driver is already loaded.

    root@mitysom-am62ax:/ethercat_master_native/ethercat/sncn_installer# /etc/init.d/ethercat start
    Starting EtherCAT master 1.6.1 [ 3095.840544] EtherCAT: Master driver 1.6.1 1.6-alpha-176-gdb48d9b0
    [ 3095.847682] EtherCAT: 1 master waiting for devices.
    [ 3095.890494] Error: Driver 'am65-cpsw-nuss' is already registered, aborting...
    modprobe: ERROR: could not insert 'ec_ti_am65_cpsw_nuss': Device or resource busy
    failed

    when i check the dmesg:

    [ 3095.840544] EtherCAT: Master driver 1.6.1 1.6-alpha-176-gdb48d9b0
    [ 3095.847682] EtherCAT: 1 master waiting for devices.
    [ 3095.890494] Error: Driver 'am65-cpsw-nuss' is already registered, aborting...


    Regards,
    Debashis

  • Hi Debashis, 

    sudo sed -e '/^DEVICE_MODULES=/s/""/"ti_am65_cpsw_nuss"/' \
    -e '/^MASTER0_DEVICE=/s/""/"ff:ff:ff:ff:ff:ff"/' \
    -i /usr/local/etc/ethercat.conf

    Thanks for clarifying how you specified which ports should be used for EtherCAT in the IgH configuration.

    Just for clarification, what was your network setup/topology when you observed this issue? Were both ports (EtherCAT and non-EtherCAT port) connected to devices prior to running the EtherCAT master?

    Can you confirm on these two questions?

    I used the instructions in https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1409114/faq-how-do-i-build-the-native-igh-ethercat-stack-for-ti-microprocessors to setup IgH native driver. Did you use the steps in this FAQ? Specifically, there is a step to setup up the kernel so that the CPSW driver is not built into the kernel but rather built as a module.

    Can you try out the instructions in this FAQ if you haven't done so yet? This FAQ is a resource for people who want to try out IgH EtherCAT stack using CPSW ethernet native driver and is separate from the IgH documentation (though some steps may be sourced from the IgH documentation).

    -Daolin

  • Hi Daolin,


    Can you confirm on these two questions?

    Master Processor(Ethernet 1)------>Ti Sitara(EtherCAT master) ---------> Motor

    This is our network topology but i have tried with out Master Processor as well we face the same issue as previous.

    For your Information we have already build the kernel for our Processor to make docker work based on TI suggestion. So, I have checked this flag on .config file. It was enabled. 
    CONFIG_TI_K3_AM65_CPSW_NUSS=y

    This is our script to install ethercat which is almost same with some extra add-ons to make life easier. 



    # Setup parameters
    ETHERCAT_USER_GROUP="$(whoami)"
    UDEV_RULES_FILE="/etc/udev/rules.d/99-EtherCAT.rules"
    SCRIPT_DIR="$(cd "$( dirname "$0" )" && pwd)"
    WORK_DIR="${SCRIPT_DIR}/.."
    SYSCONFIG_DIR="/etc/sysconfig/"
    ETHERCAT_SYSCONFIG="/etc/sysconfig/ethercat"
    ETHERCAT_INSTALL_PREFIX="/opt/etherlab"
    CONFIGURE_FLAGS="--enable-sii-assign --disable-8139too --enable-hrtimer --enable-cycles --enable-generic --disable-eoe"

    do_configure() {
      cd ${WORK_DIR}

      echo -n "char* gitlog = \"" > master/gitlog.h && \
        git log | head -1 | awk '{printf "%s", substr($2,1,8)}' >> master/gitlog.h && \
        echo "\";" >> master/gitlog.h

      ./bootstrap
      ./configure ${CONFIGURE_FLAGS} --prefix=${ETHERCAT_INSTALL_PREFIX}

      if [[ -f "/etc/init.d/ethercat" ]]; then
        sudo /etc/init.d/ethercat stop
      elif [[ -f "${ETHERCAT_INSTALL_PREFIX}/etc/init.d/ethercat" ]]; then
        sudo ${ETHERCAT_INSTALL_PREFIX}/etc/init.d/ethercat stop
      fi
    }

    do_compile () {
      make clean
      make all modules
    }

    do_install () {
      sudo make modules_install install
      sudo ldconfig
      sudo depmod

      # Link the service
      if [[ -f "/etc/init.d/ethercat" ]]; then
        sudo rm /etc/init.d/ethercat
      fi
      sudo ln -s ${ETHERCAT_INSTALL_PREFIX}/etc/init.d/ethercat /etc/init.d/ethercat

      # Link the binary
      if [[ -f "/usr/bin/ethercat" ]]; then
        sudo rm /usr/bin/ethercat
      fi
      sudo ln -s ${ETHERCAT_INSTALL_PREFIX}/bin/ethercat /usr/bin/ethercat
    }

    do_setup_interfaces () {
      # Add udev rule
      sudo rm -rf ${UDEV_RULES_FILE}
      echo "KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\", GROUP=\"${ETHERCAT_USER_GROUP}\"" | sudo tee --append ${UDEV_RULES_FILE}

      # Link the sysconfig EtherCAT file
      if [[ -f "${ETHERCAT_SYSCONFIG}" ]]; then
        sudo rm ${ETHERCAT_SYSCONFIG}
      else
        sudo mkdir -p ${SYSCONFIG_DIR}
      fi
      sudo ln -s ${ETHERCAT_INSTALL_PREFIX}${ETHERCAT_SYSCONFIG} ${ETHERCAT_SYSCONFIG}

      # Add detected interfaces and delete old ones
      sudo sed -i --follow-symlinks '/MASTER[^0].*_DEVICE/d' ${ETHERCAT_SYSCONFIG}

      # Intel Up square 2
      # 2nd ethernet is used for this board
      if [[ -n $(lscpu | sed '13q;d' | grep "Intel(R) Pentium(R) CPU N4200 @ 1.10GHz") ]];then
        MAC=$(cat /sys/class/net/enp3s0/address)
      else
      # Standard laptop
        if [[ -n "${1}" ]];then
          # Use interface passed as parameter if it is passed
          iface="${1}"
          MAC=$(cat /sys/class/net/${iface}/address)
        else
          # Takes the first interface randomly if not passed
          interfaces=$(ip link show  | grep -oP "(^\d*: )\K(e[tn][a-z0-9]*)")
          iface=$(echo ${interfaces} | head -n1 | cut -d " " -f1)
          MAC=$(cat /sys/class/net/${iface}/address)
        fi
      fi
      sudo sed -i --follow-symlinks "s/MASTER0_DEVICE=\"\"/MASTER0_DEVICE=\"${MAC}\"/g" ${ETHERCAT_SYSCONFIG}
      sudo sed -i --follow-symlinks 's/DEVICE_MODULES=\"\"/DEVICE_MODULES=\"generic\"/g' ${ETHERCAT_SYSCONFIG}
    }

    do_start() {
      if [[ -f "/etc/init.d/ethercat" ]]; then
        sudo /etc/init.d/ethercat start
      elif [[ -f "${ETHERCAT_INSTALL_PREFIX}/etc/init.d/ethercat" ]]; then
        sudo ${ETHERCAT_INSTALL_PREFIX}/etc/init.d/ethercat start
      fi
    }

    do_configure
    do_compile
    do_install
    do_setup_interfaces $1
    do_start

    echo "Done"



    Regards,
    Debashis

  • Hi,

    This is my updated flag to install ethercat don't consider the above.
    CONFIGURE_FLAGS="--enable-sii-assign --disable-8139too --enable-hrtimer --enable-cycles --disable-generic --disable-eoe --enable-am65cpsw"

  • Hi Debashis, 

    Below is the result of what I see when I start EtherCAT when both ports of my AM62x EVM were connected, eth0 port to EtherCAT network and eth1 to a 1Gbps Ethernet switch. I used the steps specified in the FAQ. Perhaps you can try "ethercatctl start"?

    Yes, we saw the module(ec_master) is inserted but not used.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    root@mitysom-am62ax:/# lsmod | grep ec
    ec_master 299008 0
    ecdh_generic 16384 1 bluetooth
    ecc 36864 1 ecdh_generic
    display_connector 12288 0
    drm_kms_helper 200704 4 drm_dma_helper,display_connector,tidss,ti_tfp410
    drm 643072 6 drm_kms_helper,drm_dma_helper,display_connector,tidss,ti_tfp410
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    The fact that you see "ec_master" rather than "ec_ti_am65_cpsw_nuss" as the module seems to imply that you didn't fully setup the native driver since the native driver should be named "ec_ti_am65_cpsw_nuss" but you see the module as "ec_master" (this seems to me to be the generic IgH driver).

    For your Information we have already build the kernel for our Processor to make docker work based on TI suggestion. So, I have checked this flag on .config file. It was enabled. 
    CONFIG_TI_K3_AM65_CPSW_NUSS=y

    This is our script to install ethercat which is almost same with some extra add-ons to make life easier. 

    I understand that your steps may be similar to the FAQ steps but I still suggest trying to follow the steps in the FAQ step-by-step, at least as a sanity check, especially given that I don't currently see the same issue with starting EtherCAT master.

    -Daolin