我是靠谱客的博主 悲凉哈密瓜,最近开发中收集的这篇文章主要介绍igh主站搭建过程:e1000e / generic,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

目录

专用网卡e1000e + xenomai 3.2.1

通用网卡generic + preempt_rt

gitlab下载主站的源代码


专用网卡e1000e + xenomai 3.2.1

2022年6月13日更新

今天装了xenomai内核,然后发现自己的工控机的网卡是 e1000e的,可以使用专用网卡的安装方式,下载地址:https://gitlab.com/etherlab.org/ethercat/-/tree/e1000e-5.10​

具体指令:

cd ~/Downloads
sudo tar xf ethercat-e1000e-5.10.tar.gz
sudo cp -r ethercat-e1000e-5.10 ~/xenomai
cd ~/xenomai/ethercat-e1000e-5.10
# 编译igh
sudo ./bootstrap
sudo ./configure --with-module-dir=/lib/modules/5.10.76-xenomai --enable-generic --enable-8139too=no --enable-e1000e --enable-cycles --enable-hrtimer --with-xenomai-dir=/usr/xenomai --prefix=/opt/etherlab
sudo make
#编译
sudo make modules
#编译模块
sudo make install
#安装
sudo make modules_install
#安装模块
# 配置
sudo mkdir /etc/sysconfig
#创建文件夹
sudo cp /opt/etherlab/etc/sysconfig/ethercat /etc/sysconfig/
#复制配置文件
sudo cp /opt/etherlab/etc/init.d/ethercat /etc/init.d/
#复制启动脚本
sudo chmod a+x /etc/init.d/ethercat
sudo update-rc.d ethercat defaults
# 使能
sudo ln -s /opt/etherlab/bin/ethercat /usr/local/bin/ethercat
# 配置用户权限
sudo gedit /etc/udev/rules.d/99-EtherCAT.rules
# 输入下列内容
KERNEL=="EtherCAT[0-9]*", MODE="0664", GROUP="users"
# 把相关模块放进系统目录,如果使用通用网卡是这样的
# sudo cp devices/ec_generic.ko /lib/modules/$(uname -r)
# sudo cp master/ec_master.ko /lib/modules/$(uname -r)
# 这边用的是专用网卡
sudo cp devices/e1000e/ec_e1000e.ko /lib/modules/$(uname -r)
sudo cp master/ec_master.ko /lib/modules/$(uname -r)
# 执行
sudo depmod
# 查看网卡MAC地址和类型
ifconfig
# 得到ethercat通信的地址为
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>
mtu 1500
inet6 fe80::fbe:4e35:95d4:4056
prefixlen 64
scopeid 0x20<link>
ether 00:e8:4c:68:30:de
txqueuelen 1000
(Ethernet)
RX packets 0
bytes 0 (0.0 B)
RX errors 0
dropped 0
overruns 0
frame 0
TX packets 19
bytes 3183 (3.1 KB)
TX errors 0
dropped 0 overruns 0
carrier 0
collisions 0
device interrupt 19
memory 0xf7d00000-f7d20000
# 配置网卡
sudo gedit /etc/sysconfig/ethercat
#
在大约27行和60行处填入自己的网卡信息
MASTER0_DEVICE="00:e8:4c:68:30:de"
# mac 地址
DEVICE_MODULES="e1000e"
# 通用网卡填generic
# 启动主站
sudo /etc/init.d/ethercat start
# 查看帮助 或者 pdo信息
sudo ethercat --h
ethercat pdos
# 确认ethercat没有问题后,配置系统,让应用程序可以使用 /opt/etherlab/lib 到你的 /etc/ld.so.conf(/opt/ethercatlab前缀实在前面配置ethercat是选定的,默认是/opt/ethercatlab)
sudo gedit /etc/ld.so.conf
# 添加
/opt/etherlab/lib
# 执行
sudo ldconfig
# 测试是否安装,若成功,最后一行会显示 libethercat.so.1 -> libethercat.so.1.1.0
sudo ldconfig -v | grep libether*

通用网卡generic + preempt_rt

mkdir ec_igh
cd ec_igh/
git clone http://gitlab.com/etherlab.org/ethercat.git
cd ethercat/
./bootstrap
./configure --enable-8139too=no
sudo make
sudo make modules
sudo make install
sudo make modules_install
ifconfig
cd /opt/etherlab
sudo gedit /etc/sysconfig/ethercat
MASTER0_DEVICE="00:e8:4c:68:30:cd"
DEVICE_MODULES="generic"
sudo cp etc/sysconfig/ethercat /etc/sysconfig/
sudo ln -s /opt/etherlab/etc/init.d/ethercat /etc/init.d/
sudo /etc/init.d/ethercat start
gedit ~/.bashrc
PATH=$PATH:/opt/etherlab/bin
source ~/.bashrc
sudo depmod

gitlab下载主站的源代码

ifconfig 查看网卡信息

cd /opt/etherlab
cd /opt/etherlab
MASTER0_DEVICE="00:e8:4c:68:30:cd"
DEVICE_MODULES="generic"

然后

sudo cp etc/sysconfig/ethercat /etc/sysconfig/
sudo ln -s /opt/etherlab/etc/init.d/ethercat /etc/init.d/

启动主站

robotarm@robotarm:/opt/etherlab$ sudo /etc/init.d/ethercat start
Starting EtherCAT master 1.5.2
done

添加命令行工具

gedit ~/.bashrc
把下面这行加进入
PATH=$PATH:/opt/etherlab/bin
保存,然后
source ~/.bashrc
sudo depmod
robotarm@robotarm:/opt/etherlab$ ethercat
Please specify a command!
Usage: ethercat <COMMAND> [OPTIONS] [ARGUMENTS]
Commands (can be abbreviated):
alias
Write alias addresses.
config
Show slave configurations.
crc
CRC error register diagnosis.
cstruct
Generate slave PDO information in C language.
data
Output binary domain process data.
debug
Set the master's debug level.
domains
Show configured domains.
download
Write an SDO entry to a slave.
eoe
Display Ethernet over EtherCAT statictics.
foe_read
Read a file from a slave via FoE.
foe_write
Store a file on a slave via FoE.
graph
Output the bus topology as a graph.
ip
Set EoE IP parameters.
master
Show master and Ethernet device information.
pdos
List Sync managers, PDO assignment and mapping.
reg_read
Output a slave's register contents.
reg_write
Write data to a slave's registers.
rescan
Rescan the bus.
sdos
List SDO dictionaries.
sii_read
Output a slave's SII contents.
sii_write
Write SII contents to a slave.
slaves
Display slaves on the bus.
soe_read
Read an SoE IDN from a slave.
soe_write
Write an SoE IDN to a slave.
states
Request application-layer states.
upload
Read an SDO entry from a slave.
version
Show version information.
xml
Generate slave information XML.
Global options:
--master
-m <master>
Comma separated list of masters
to select, ranges are allowed.
Examples: '1,3', '5-7,9', '-3'.
Default: '-' (all).
--force
-f
Force a command.
--quiet
-q
Output less information.
--verbose -v
Output more information.
--help
-h
Show this help.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
Call 'ethercat <COMMAND> --help' for command-specific help.
Send bug reports to fp@igh-essen.com.

扫描从站

robotarm@robotarm:/opt/etherlab$ sudo ethercat slave
0
0:0
PREOP
+
AEM-090-30
1
0:1
PREOP
+
AEM-090-30
2
0:2
PREOP
+
AEM-090-30
3
0:3
PREOP
+
AEM-090-30
4
255:0
PREOP
+
AEM-090-30
5
255:0
PREOP
+
AEM-090-30
6
255:0
PREOP
+
AEM-090-30
7
255:1
PREOP
+
F7ETHSLAVE_V4.1

最后

以上就是悲凉哈密瓜为你收集整理的igh主站搭建过程:e1000e / generic的全部内容,希望文章能够帮你解决igh主站搭建过程:e1000e / generic所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(38)

评论列表共有 0 条评论

立即
投稿
返回
顶部