ubuntu20.04 LTS安装Igh EtherCAT Master

ubuntu20.04 LTS安装Igh EtherCAT Master

内核版本:Linux star-A 5.4.28-rt19

rt版本的内核为实时内核,Igh EtherCAT Master对系统的实时性有要求。

首先需要给内核打实时补丁,参考:2021-04-24_2333的博客-CSDN博客

Igh EtherCAT Master官方下载链接:EtherLab EtherCAT Master / Code / [33b922]

Igh EtherCAT Master百度网盘链接(本文作者使用的版本): https://pan.baidu.com/s/1gqYkP01tbHY4zx-DUAArTA

密码: r4e8

注意,ubuntu内核版本为5.4.28,其他版本可能会出问题。

1.intel E1G42ET双口82576芯片网卡驱动安装

因为作者的PC上网卡驱动没有安装,这里先进行网卡驱动安装。

intel网卡驱动到intel官网下载即可。

ubuntu下安装intel网卡驱动:

#解压驱动
star@star-A:~/Downloads$ tar zxvf igb-5.5.2
#root
star@star-A:~$ su
#安装驱动
root@star-A:/home/star# cd Downloads/
root@star-A:/home/star/Downloads/igb-5.5.2/src# make install
#安装module
root@star-A:/home/star/Downloads/igb-5.5.2/src# modprobe igb
#查看是否安装上
root@star-A:/home/star/Downloads/igb-5.5.2/src# dmesg | grep igb
[  235.947890] igb: loading out-of-tree module taints kernel.
root@star-A:/home/star/Downloads/igb-5.5.2/src# lsmod 
Module                  Size  Used by
igb                   200704  0
dca                    16384  1 igb
rfcomm                 73728  4
#退出root
root@star-A:/home/star/Downloads/igb-5.5.2/src# exit
exit
star@star-A:~$ 

realtek网卡驱动安装参考链接 :https://segmentfault.com/a/1190000037617931Ubuntu下安装RealtekRTL8125网卡驱动_hello-CSDN博客

ubuntu下安装realtek网卡驱动:

#解压缩
star@star-A:~$ cd ~/Downloads/
star@star-A:~/Downloads$ tar -jxvf r8125-9.005.01
#安装
star@star-A:~/Downloads$ cd r8125-9.005.01/
star@star-A:~/Downloads/r8125-9.005.01$ sudo ./autorun.sh 

2.安装Igh EtherCAT Master

#创建编译文件夹
star@star-A:~$ mkdir ecat_build_334
#复制etherlabmaster-code-334.zip到ecat_build_334
star@star-A:~/ecat_bulid_334$ cp ~/Downloads/etherlabmaster-code-334.zip ./
#解压
star@star-A:~/ecat_bulid_334$ unzip etherlabmaster-code-334.zip
#到etherlabmaster-code-334文件目录下
star@star-A:~/ecat_bulid_334$ cd etherlabmaster-code-334/
#生成configure脚本
star@star-A:~/ecat_bulid_334/etherlabmaster-code-334$ ./bootstrap
star@star-A:~/ecat_bulid_334/etherlabmaster-code-334$ ./configure --enable-cycles  --enable-8139too=no
#编译
star@star-A:~/ecat_bulid_334/etherlabmaster-code-334$ make -j$(nproc) all modules
#安装,请切换到root用户下
root@star-A:/home/star/ecat_bulid_334/etherlabmaster-code-334# make modules_install install
root@star-A:/home/star/ecat_bulid_334/etherlabmaster-code-334# depmod
root@star-A:/home/star/ecat_bulid_334/etherlabmaster-code-334# ln -s /usr/local/etc/init.d/ethercat /etc/init.d/ethercat
root@star-A:/home/star/ecat_bulid_334/etherlabmaster-code-334# mkdir /etc/sysconfig
root@star-A:/home/star/ecat_bulid_334/etherlabmaster-code-334# cp /usr/local/etc/sysconfig/ethercat /etc/sysconfig/ethercat
root@star-A:/home/star/ecat_bulid_334/etherlabmaster-code-334# echo KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\" > /etc/udev/rules.d/99-EtherCAT.rules
#退出root用户
root@star-A:/home/star/ecat_bulid_334/etherlabmaster-code-334# exit
exit

3.配置EtherCAT

#查看ip
star@star-A:~$ ifconfig 
enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether f0:2f:74:f4:fb:d0  txqueuelen 1000  (以太网)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 531  bytes 90066 (90.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 128  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (本地环回)
        RX packets 4754  bytes 472797 (472.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4754  bytes 472797 (472.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlo1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.107  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::eeeb:38ac:2449:f63f  prefixlen 64  scopeid 0x20<link>
        ether 40:1c:83:00:1a:2c  txqueuelen 1000  (以太网)
        RX packets 59412  bytes 26183717 (26.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 37948  bytes 43499316 (43.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
% f0:2f:74:f4:fb:d0就是ip地址

修改/etc/sysconfig/ethercat,如下

MASTER0_DEVICE="f0:2f:74:f4:fb:d0"
DEVICE_MODULES="generic"

4.Igh EtherCAT Master测试

star@star-A:~$ sudo /etc/init.d/ethercat start
[sudo] star 的密码: 
Starting EtherCAT master 1.5.2  done
star@star-A:~$ ethercat master
Master0
  Phase: Idle
  Active: no
  Slaves: 1
  Ethernet devices:
    Main: f0:2f:74:f4:fb:d0 (attached)
      Link: UP
      Tx frames:   2901
      Tx bytes:    212396
      Rx frames:   2900
      Rx bytes:    212336
      Tx errors:   0
      Tx frame rate [1/s]:    123    167     44
      Tx rate [KByte/s]:      7.2   12.0    3.1
      Rx frame rate [1/s]:    123    167     44
      Rx rate [KByte/s]:      7.2   12.0    3.1
    Common:
      Tx frames:   2901
      Tx bytes:    212396
      Rx frames:   2900
      Rx bytes:    212336
      Lost frames: 0
      Tx frame rate [1/s]:    123    167     44
      Tx rate [KByte/s]:      7.2   12.0    3.1
      Rx frame rate [1/s]:    123    167     44
      Rx rate [KByte/s]:      7.2   12.0    3.1
      Loss rate [1/s]:          0      0      0
      Frame loss [%]:         0.0    0.0    0.0
  Distributed clocks:
    Reference clock:   Slave 0
    DC reference time: 0
    Application time:  0
                       2000-01-01 00:00:00.000000000


版权声明:本文为qq_34539334原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。