当前位置:   article > 正文

jetson nano igh ethercat_jetson nano ethercat

jetson nano ethercat

下载源代码

git clone https://gitlab.com/etherlab.org/ethercat.git
  • 1
cd ethercat 
  • 1
./bootstrap
  • 1

配置
把r8169-4.4-ethercat.c和r8169-4.4-orig.c 复制重命名成 r8169-4.9-ethercat.c 和r8169-4.9-orig.c

./configure --prefix=/opt/etherlab --with-linux-dir=/usr/src/kernel/kernel-4.9  --enable-8139too=no --enable-e1000e=no  --enable-generic=no  --enable-r8169=yes
  • 1

可能出现错误 去kernel源代码目录 执行make scripts

make -j 4 
  • 1
make modules
  • 1
 sudo make install
  • 1
 sudo make modules_install
  • 1
sudo depmod
  • 1

建立二进制链接

sudo ln -fs /opt/etherlab/etc/init.d/ethercat /etc/init.d/
sudo ln -fs /opt/etherlab/bin/ethercat /usr/local/bin/
sudo mkdir /etc/sysconfig
sudo ln -fs /opt/etherlab/etc/sysconfig/ethercat /etc/sysconfig/
sudo su
sudo echo KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\" > /etc/udev/rules.d/99-EtherCAT.rules
sudo gedit  /opt/etherlab/etc/ethercat.conf
sudo gedit /opt/etherlab/etc/sysconfig/ethercat 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

MASTER0_DEVICE=“”#写上你的eth0的mac
DEVICE_MODULES=“r8169”#这里写r8169

sudo gedit /opt/etherlab/etc/init.d/ethercat
  • 1

在180行

if [ "${MODULE}" != "generic" ]; then
  • 1

下面写

output2=$(lspci -v  | grep r8168)
        if [ -n "$output2" ]; then
            echo 0000:02:00.0  > /sys/bus/pci/drivers/r8168/unbind 
            sleep 3
        fi
  • 1
  • 2
  • 3
  • 4
  • 5
    # check for modules to replace
    for MODULE in ${DEVICE_MODULES}; do
        ECMODULE=ec_${MODULE}
        if ! ${MODINFO} "${ECMODULE}" > /dev/null; then
            continue # ec_* module not found
        fi
        if [ "${MODULE}" != "generic" ]; then
            #添加部分---------------------------------------------------------start
            output2=$(lspci -v  | grep r8168)#添加部分
            if [ -n "$output2" ]; then
	        echo 0000:02:00.0  > /sys/bus/pci/drivers/r8168/unbind 
	        sleep 3
	        #添加部分---------------------------------------------------------end
            fi
            if ${LSMOD} | grep "^${MODULE} " > /dev/null; then
                if ! ${RMMOD} "${MODULE}"; then
                    exit_fail
                fi
            fi
        fi
        if ! ${MODPROBE} ${MODPROBE_FLAGS} "${ECMODULE}"; then
            if [ "${MODULE}" != "generic" ]; then
                ${MODPROBE} ${MODPROBE_FLAGS} "${MODULE}" # try to restore
            fi
            exit_fail
        fi
    done

    exit_success
    ;;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

在 /boot/extlinux/extlinux.config
APPEND 行后面 添加 isolcpus=3
类似如下:

APPEND ${cbootargs} quiet root=/dev/sda1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 isolcpus=3
  • 1

把核心4(下标0 所以参数3)隔离出来

参考这个
把master进程绑定在核心4上面
/etc/init.d/ethercat start

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/543937
推荐阅读
相关标签
  

闽ICP备14008679号