【实操填坑】在树莓派上编译 EtherCAT IgH Master 主站程序
官网下载地址:
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 主站程序的更多相关文章
- 【填坑】树莓派4B上运行Bullseye版本系统,不能登录xrdp的问题~~
以前使用 buster,安装xrdp后 pi用户xrdp登录正常, 可自从使用了 bullseye系统,pi登录xrdp后,出现黑屏不能登录现象. 网上搜寻解决方案,一种方法是: 登录树莓派后,打开这 ...
- 在树莓派上运行 .net core 2.1 程序 并实现开机启动
本篇文章完整的说明如和在树莓派上运行 .net core2.1程序,当然也参考了其他的博客,此处结合我自己的经验,再写一篇完整的博客,方便大家,还有我自己进行查阅. https://blog.csdn ...
- 【实操日记】使用 PyQt5 设计下载远程服务器日志文件程序
最近通过 PyQt5 设计了一个下载服务器指定日期日志文件的程序,里面有些有意思的技术点,现在做一些分享. PyQt5 是一套 Python 绑定 Digia Qt5 应用的框架,是最强大的 GUI ...
- 树莓派上编译安装python3.6
1.更新树莓派系统 sudo apt-get update sudo apt-get upgrade -y 2.安装python依赖环境 sudo apt-get install build-esse ...
- Termux中安装gcc-7/gfortran-7实操过程,安装成功可以编译Fortran,c/c++
最近计算材料学的老师需要我们运行Fortran,又不想带电脑去教室.所以想起Termux了,于是就试试看这个宝贝能不能帮我的忙, 但是经过测试以后发现,clang只能编译c/c++那一类语言,不能编译 ...
- 【待填坑】bzoj上WC的题解
之前在bzoj上做了几道WC的题目,现在整理一下 bzoj2115 去膜拜莫队的<高斯消元解xor方程组> bzoj2597 LCT维护MST bzoj1758 分数规划+树分治+单调队列 ...
- 【IDEA填坑】xml不编译
今天在maven编译Springboot项目的时候,发现src/main/resources下的配置文件编译失败(就是war包中没有放入xml配置文件导致程序启动失败),经查询资料,发现新版本的IDE ...
- 填坑!线上Presto查询Hudi表异常排查
1. 引入 线上用户反馈使用Presto查询Hudi表出现错误,而将Hudi表的文件单独创建parquet类型表时查询无任何问题,关键报错信息如下 40931f6e-3422-4ffd-a692-6c ...
- 在树莓派上编译安装golang环境
请看我在掘金的文章
随机推荐
- BottomNavigationView点击刷新问题
BottomNavigationView点击刷新问题 问题: 项目中使用了BottomNavigationView作为底部导航栏. 点击item切换的时候发现会有闪烁现象出现. 原因: BottomN ...
- nginx1.1 nginx介绍和反向代理
1.什么是nginx nginx是一个高性能的http和反向代理的web服务器,所占内存小,高并发 nginx默认端口:80端口 命令存放目录:cd /usr/local/nginx/sbin 配置文 ...
- 利用ArcEngine开发地图发布服务,将mxd文档一键发布成wmts,并根据需要对地图进行空间查询,返回客户端geojson
一直想开发一个软件取代ArcGIS Server,该软件使用ArcEngine开发,以Windows Service形式发布,部署在服务端上,解决wmts地图服务发布和空间查询的问题,经过不断的研究. ...
- 429. N-ary Tree Level Order Traversal - LeetCode
Question 429. N-ary Tree Level Order Traversal Solution 题目大意: N叉树,返回每层的值,从上到下,从左到右 思路: 利用队列遍历这个N叉树 J ...
- 好客租房57-props深入(4props的默认值)
1给props设置默认值 //导入react import React from 'react' import ReactDOM from 'react-dom' import ...
- 133_Power BI 报表服务器2020年1月版本更新亮点
博客:www.jiaopengzi.com 焦棚子的文章目录 请点击下载附件 一个很长的春节假期后,居家办公. 升级了Power BI 报表服务器(2020年1月版本). 具体的升级内容见官网博客: ...
- Web 前端实战(三):雷达图
前言 在<Canvas 线性图形(五):多边形>实现了绘制多边形的函数.本篇文章将记录如何绘制雷达图.最终实现的效果是这样的: 绘制雷达图 雷达图里外层 如动图中所示,雷达图从里到外一共有 ...
- vue-property-decorator
vue-property-decorator使我们能在vue组件中写TypeScript语法,依赖于vue-class-component 装饰器:@Component.@Prop.@PropSync ...
- mybatis-plus分页插件
package com.tanhua.server.config; import com.baomidou.mybatisplus.extension.plugins.PaginationInterc ...
- Docker容器(centos)安装zabbix
zabbix是一个基于WEB界面提供分布式系统监视以及网络监视功能的企业级的开源解决方案.--百度百科 zabbix介绍 zabbix主要有zabbix-server及zabbix-agent组成,z ...