一、下载EtherCAT安装包

安装包下载路径:EtherLab EtherCAT Master / Code / [334c34],打开后点击Download下载

二、安装前置依赖库

最好切换到root用户进行下列步骤

apt-get install autoconf automake libtool net-tools

三、编译安装

解压安装包,进入安装包目录

root@ubuntu:/usr/local/4412# unzip etherlabmaster-code-33b922ec1871ea835f662ac1041317e815a8fdfd/

root@ubuntu:/usr/local/4412# cd  etherlabmaster-code-33b922ec1871ea835f662ac1041317e815a8fdfd/

生成配置文件、配置

./bootstrap

./configure --enable-cycles --enable-hrtimer --enable-8139too=no --enable-generic=yes

编译,加载模块;注

Ubuntu14.04安装igH EtherCAT Master_ubuntu

make all modules

make modules_install install

depmod

注:网上看到的,如果遇到 implicit declaration of function 'signal_pending';did you mean 'timer_pending'错误;

解决办法:在master.c中加入 #include <linux/sched/signal.h>,然后重新编译

这个是网上看到的,我没遇到这个错误。

四、修改网卡地址

使用ifconfig查看机器的网卡信息

ifconfig

Ubuntu14.04安装igH EtherCAT Master_配置文件_02

 

五、修改EtherCAT配置文件

注:网上很多教程是修改/usr/local/下的etc里,是因为不同版本的安装目录不同,我这个是安装在/opt目录下的的,这个视你使用的版本修改。

gedit /opt/etherlab/etc/sysconfig/ethercat

Ubuntu14.04安装igH EtherCAT Master_配置文件_03

 六、创建连接

要使用root权限执行以下命令

ln -s /opt/etherlab/etc/init.d/ethercat /etc/init.d/ethercat

mkdir /etc/sysconfig

ln -s /opt/etherlab/etc/sysconfig/ethercat /etc/sysconfig/ethercat

ln -s /opt/etherlab/bin/ethercat /usr/bin/ethercat

echo KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\" > /etc/udev/rules.d/99-EtherCAT.rules

七、启动EtherCAT

/etc/init.d/ethercat start

ethercat master

ethercat slave