本文介绍了如何将IGH EtherCAT主站移植到米尔NXP i.MX 91开发板上并运行。
https://bbs.elecfans.com/jishu_2499768_1_1.html

米尔基于NXP i.MX91的核心板及开发板,搭载新一代入门级NXP i.MX91处理器,内核Cortex-A55,主频高达1.4 GHz ;支持 LPDDR4 增强可靠性和平台寿命,支持双千兆以太网和双 USB 端口等丰富外设。
前面我们介绍了怎么让开发板运行在高实时性的系统环境下,让它满足工业自动化、汽车电子应用要求;米尔NXP i.MX91开发板上面集成了2路RGMII千兆以太网接口,我们可以用它来运行工业以太网通信应用。
1. 拉取开源IGH EtherCAT仓库
git clone https://gitlab.com/etherlab.org/ethercat.git cd ethercat source ~/myd-lmx91-toolchain/environment-setup-armv8a-poky-linux
2. 配置用户空间程序
# 运行bootstrap脚本 ./bootstrap # 配置用户空间程序 ./configure \ --host=aarch64-poky-linux \ --with-linux-dir=/home/hywing/workspace/myir-imx-linux \ --enable-8139too=no \ --enable-e100=no \ --enable-e1000=no \ --enable-e1000e=no \ --enable-igb=no \ --enable-usb=no \ --enable-generic=yes \ --enable-cycles=yes \ --enable-tool=yes \ --enable-script=yes \ --enable-rtdm=no \ --prefix=/usr/local
3. 编译驱动模块
# 编译主驱动模块:ec_generic.ko cd ../master make -C /home/hywing/workspace/myir-imx-linux M=$(pwd) modules
# 编译通用驱动模块:ec_master.ko cd ../devices make -C /home/hywing/workspace/myir-imx-linux M=$(pwd) modules
4. 安装验证
ethercat libethercat.so libethercat.a ec_generic.ko ec_master.ko ethercat.conf
MASTER0_DEVICE="eth0" MASTER0_BACKUP_DEVICE="eth1" MASTER0_BACKUP="eth1" MASTER0_UPDATE_MS="1" MASTER0_VIRTUAL="no"
# 加载主驱动模块 sudo modprobe ec_master # 加载通用驱动模块 sudo modprobe ec_generic
3. 设置开发板为主站状态
./ethercat master
4. 获取ESC从站配置信息

从站的配置信息跟上面是一致的,说明EtherCAT通信成功了

1. 命令行使能ESC从站LED亮灭。
while true; do ethercat cstruct 0x7010 0x00 0x00 0x00 0x02; sleep 0.5; ethercat cstruct 0x7010 0x00 0x00 0x00 0x00; sleep 0.5; done;
全部0条评论
快来发表一下你的评论吧 !