官网下载地址:
https://etherlab.org/download/ethercat/  (可list查看文件列表)
https://etherlab.org/download/ethercat/ethercat-1.5.2.pdf (pdf doc手册)

===============================================
本人操作环境:树莓派 3B+
pi@ProfinetPI:~ $ uname -a
Linux ProfinetPI 4.19.71-rt24-v8 #1 SMP PREEMPT RT Wed Jan 26 01:35:13 CST 2022 aarch64 GNU/Linux

ethercat代码版本为: 1.5.2-master-3ee5e50a
(注意:1.5.2 release包,在内核>4.15.x时会编译make modules出错,因为从4.15开始内核timer使用方式更改。)

==============================================
1. 编译ethercat master和安装:

$ git clone https://gitlab.com/etherlab.org/ethercat.git

$ cd ethercat (进入clone的源码主目录)

$ ./bootstrap (若下载的是tar.bz包,其中带有m4子目录,则不需此步骤; git clone的才需要)

$ ./configure --prefix=/opt/etherlab --with-linux-dir=/usr/src/linux --enable-8139too=no --enable-generic=yes  (提前准备好内核源码,已编译)

$ make -j 4 (4个线程加快)

$ make modules (需要有Modules.symvers和 System.map文件)(分别是编译内核,编译内核模块后产生)
(此命令执行的结尾会运行depmod, 注意不能skip, 否则安装时 modprobe会有问题)

# make install
# make modules_install //注意 depmod是否执行了. 安装到了 /lib/modules/<uname -r>/ethercat/ 目录下

2. 开始与系统集成【二选1】
//【方案1】 如果要用 init.d脚本, 那么用下面3行:
$ sudo mkdir /etc/sysconfig
$ sudo cp /opt/etherlab/etc/sysconfig/ethercat /etc/sysconfig/ethercat //这是配置文件
$ sudo cp /opt/etherlab/etc/init.d/ethercat /etc/init.d/ethercat //这是启动脚本,特别要注意修改其中 -c 的配置文件位置!!!
$ insserv ethercat (安装为开机自启动服务)
// 方案1启停 master内核主站的命令为: # /etc/init.d/ethercat start| stop| reload (或 #service ethercat start|stop)

//【方案2】 如果是用的 systemd管理服务, 则运行如下命令:
# cp /opt/etherlab/etc/ethercat.conf /etc/ethercat.conf (配置文件的位置)
# nano /usr/lib/systemd/system/ethercat.service (如果没有,照着pdf doc 第7.4节拷贝一个.)
         (这里特别要修改其中的命令!!!! 显式自己手动写上配置文件位置 -c /path/to/conf_file 再 start) (坑:不会如pdf所说默认去找/etc/ethercat.conf作为配置文件)
# systemctl enable ethercat.service (设置开机启动服务)
// 方案2启停 master内核主站的命令为: # systemctl start| stop| status ethercat.service

其实这两种系统集成方案,都是用了ethercat提供的最基础的命令来启停 内核模块,
也可以直接运行基础命令来启停【方案3】, 指令如下:
# /opt/etherlab/sbin/ethercatctl -c /path/to/conf_file start|stop 【注意配置文件路径要正确

3.启动EtherCAT主站内核模块

三种方案不管用哪种, 在启动前都要修改自己的配置文件

启动前一定要确保对应配置文件中加入了 网卡mac 和 内核模块类型
$ sudo vi /etc/sysconfig/ethercat //更改配置文件:(填入MAC地址或"eth0",以及网卡类型 "generic"

正式开始启动Master主站 (三种方法选一种即可,以方案1为例)
# /etc/init.d/ethercat start|stop //注意配置文件中路径是否对.

启动后,检查是否已经载入了内核模块:
# lsmod | grep ec_ (会输出两行, ec_generic 和 ec_master, 说明已装载)

4.使用tools工具

tools工具为:/opt/etherlab/bin/ethercat, 连接符号到/usr/bin/下以方便使用:
$ sudo ln -s /opt/etherlab/bin/ethercat /usr/bin/ethercat //软连接

tools的使用(/opt/etherlab/bin/ethercat为tools工具)参见 pdf doc 第7章,简单命令如下:
# ethercat slave (显示挂载在主站上的从站信息)
0 0:0 PREOP + SV660_1Axis_00913  (显示出了挂在主站网络上的 汇川 SV660N伺服)

pi@ProfinetPI:~ $ ethercat -h (帮助信息)
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.

#安装IgH EtherCAT主站部分完结, 之后就是如何使用主站来控制 伺服点击转圈圈了。#

【实操填坑】在树莓派上编译 EtherCAT IgH Master 主站程序的更多相关文章

  1. 【填坑】树莓派4B上运行Bullseye版本系统,不能登录xrdp的问题~~

    以前使用 buster,安装xrdp后 pi用户xrdp登录正常, 可自从使用了 bullseye系统,pi登录xrdp后,出现黑屏不能登录现象. 网上搜寻解决方案,一种方法是: 登录树莓派后,打开这 ...

  2. 在树莓派上运行 .net core 2.1 程序 并实现开机启动

    本篇文章完整的说明如和在树莓派上运行 .net core2.1程序,当然也参考了其他的博客,此处结合我自己的经验,再写一篇完整的博客,方便大家,还有我自己进行查阅. https://blog.csdn ...

  3. 【实操日记】使用 PyQt5 设计下载远程服务器日志文件程序

    最近通过 PyQt5 设计了一个下载服务器指定日期日志文件的程序,里面有些有意思的技术点,现在做一些分享. PyQt5 是一套 Python 绑定 Digia Qt5 应用的框架,是最强大的 GUI ...

  4. 树莓派上编译安装python3.6

    1.更新树莓派系统 sudo apt-get update sudo apt-get upgrade -y 2.安装python依赖环境 sudo apt-get install build-esse ...

  5. Termux中安装gcc-7/gfortran-7实操过程,安装成功可以编译Fortran,c/c++

    最近计算材料学的老师需要我们运行Fortran,又不想带电脑去教室.所以想起Termux了,于是就试试看这个宝贝能不能帮我的忙, 但是经过测试以后发现,clang只能编译c/c++那一类语言,不能编译 ...

  6. 【待填坑】bzoj上WC的题解

    之前在bzoj上做了几道WC的题目,现在整理一下 bzoj2115 去膜拜莫队的<高斯消元解xor方程组> bzoj2597 LCT维护MST bzoj1758 分数规划+树分治+单调队列 ...

  7. 【IDEA填坑】xml不编译

    今天在maven编译Springboot项目的时候,发现src/main/resources下的配置文件编译失败(就是war包中没有放入xml配置文件导致程序启动失败),经查询资料,发现新版本的IDE ...

  8. 填坑!线上Presto查询Hudi表异常排查

    1. 引入 线上用户反馈使用Presto查询Hudi表出现错误,而将Hudi表的文件单独创建parquet类型表时查询无任何问题,关键报错信息如下 40931f6e-3422-4ffd-a692-6c ...

  9. 在树莓派上编译安装golang环境

    请看我在掘金的文章

随机推荐

  1. 手摸手,带你实现移动端H5瀑布流布局

    移动端瀑布流布局是一种比较流行的网页布局方式,视觉上来看就是一种像瀑布一样垂直落下的排版.每张图片并不是显示的正正方方的,而是有的长有的短,呈现出一种不规则的形状.但是它们的宽度通常都是相同的 因为移 ...

  2. 容器内的Linux诊断工具0x.tools

    原创:扣钉日记(微信公众号ID:codelogs),欢迎分享,转载请保留出处. 简介 Linux上有大量的问题诊断工具,如perf.bcc等,但这些诊断工具,虽然功能强大,但却需要很高的权限才可以使用 ...

  3. 关于扑克牌的一些讨论——《Fluent Python 2》读书笔记

    一.说明 参考资料为维基百科的 Playing Card 词条,非严肃性论证,只是对代码为什么这么写做讨论. 二.扑克牌的起源 import collections Card = collection ...

  4. netty系列之:netty对marshalling的支持

    目录 简介 netty中的marshalling provider Marshalling编码器 Marshalling编码的另外一种实现 总结 简介 在之前的文章中我们讲过了,jboss marsh ...

  5. 110_Power Pivot特殊结算日期及财年日期

    博客:www.jiaopengzi.com 焦棚子的文章目录 请点击下载附件 1.背景 前几天看到群里有朋友在搞特殊结算日期,主要不是按照正常日期里的整月,按照比如:上月21号至本月20号作为结算周期 ...

  6. Fail2ban 运维管理 服务控制

    启动监禁 启动所有或者单个监禁项目. # 语法:fail2ban-client start [监禁名称] root@ubuntu:~# fail2ban-client start sshd 停止监禁 ...

  7. 使用 Vite 插件开发构建 Tampermonkey 用户脚本

    起因 一直以来,我都是直接在浏览器 Tampermonkey 扩展页面直接新建用户脚本来开发的: 对于一些简单的脚本,这没有什么问题,即改即看.但当代码多了以后问题就来了,自带编辑器开发体验确实不太舒 ...

  8. ABP框架之——数据访问基础架构

    大家好,我是张飞洪,感谢您的阅读,我会不定期和你分享阅读心得,希望我的文章能成为你成长路上的一块垫脚石,我们一起精进. 几乎所有的业务应用程序都要适用一种数据库基础架构,用来实现数据访问逻辑,以便从数 ...

  9. CSS中html的标签元素分类

    在CSS中,html中的标签元素大体被分为三种不同的类型: 块状元素.内联元素(又叫行内元素)和内联块状元素.    常用的块状元素有:  <div>.<p>.<h1&g ...

  10. pip国内源配置

    Python 的一大优点就是丰富的类库,所以我们经常会用 pip 来安装各种库,所以对于Python开发用户来讲,PIP安装软件包是家常便饭.但国外的源下载速度实在太慢,浪费时间.而且经常出现下载后安 ...