0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

瑞萨RZ/G2L开发板在工控领域的应用-基于SOEM的EtherCAT主站

米尔电子 2023-07-31 22:09 次阅读

本篇测评由优秀测评者“qinyunti”提供。

前言

本文介绍【米尔MYD-YG2LX开发板】在工控领域的应用,实现基于SOEM的EtherCAT主站。开发环境基于WSL2。

下载代码

git clone‍https://github.com/OpenEtherCATsociety/SOEM‍

PC端

编译

cd SOEM/export CC=gccmkdir build_pccd build_pc/ cmake ..

lhj@lhj:~/SOEM/build_pc$ cmake ..-- The C compiler identification is GNU 9.4.0-- Check for working C compiler: /usr/bin/gcc-- Check for working C compiler: /usr/bin/gcc -- works-- Detecting C compiler ABI info-- Detecting C compiler ABI info - done-- Detecting C compile features-- Detecting C compile features - done-- OS is linux-- LIB_DIR: lib-- Configuring done-- Generating done-- Build files have been written to: /home/lhj/SOEM/build_pclhj@lhj:~/SOEM/build_pc$

make

lhj@lhj:~/SOEM/build_pc$ makeScanning dependencies of target soem[ 4%] Building C object CMakeFiles/soem.dir/soem/ethercatbase.c.o[ 9%] Building C object CMakeFiles/soem.dir/soem/ethercatcoe.c.o[ 14%] Building C object CMakeFiles/soem.dir/soem/ethercatconfig.c.o[ 19%] Building C object CMakeFiles/soem.dir/soem/ethercatdc.c.o[ 23%] Building C object CMakeFiles/soem.dir/soem/ethercateoe.c.o[ 28%] Building C object CMakeFiles/soem.dir/soem/ethercatfoe.c.o[ 33%] Building C object CMakeFiles/soem.dir/soem/ethercatmain.c.o[ 38%] Building C object CMakeFiles/soem.dir/soem/ethercatprint.c.o[ 42%] Building C object CMakeFiles/soem.dir/soem/ethercatsoe.c.o[ 47%] Building C object CMakeFiles/soem.dir/osal/linux/osal.c.o[ 52%] Building C object CMakeFiles/soem.dir/oshw/linux/nicdrv.c.o[ 57%] Building C object CMakeFiles/soem.dir/oshw/linux/oshw.c.o[ 61%] Linking C static library libsoem.a[ 61%] Built target soemScanning dependencies of target simple_ng[ 66%] Building C object test/simple_ng/CMakeFiles/simple_ng.dir/simple_ng.c.o[ 71%] Linking C executable simple_ng[ 71%] Built target simple_ngScanning dependencies of target slaveinfo[ 76%] Building C object test/linux/slaveinfo/CMakeFiles/slaveinfo.dir/slaveinfo.c.o[ 80%] Linking C executable slaveinfo[ 80%] Built target slaveinfoScanning dependencies of target eepromtool[ 85%] Building C object test/linux/eepromtool/CMakeFiles/eepromtool.dir/eepromtool.c.o[ 90%] Linking C executable eepromtool[ 90%] Built target eepromtoolScanning dependencies of target simple_test[ 95%] Building C object test/linux/simple_test/CMakeFiles/simple_test.dir/simple_test.c.o[100%] Linking C executable simple_test[100%] Built target simple_testlhj@lhj:~/SOEM/build_pc$

部署生成的文件如下其中libsoem.a为库文件test/linux/下的simple_test,slaveinfo,eepromtool为测试Demo。

lhj@lhj:~/SOEM/build_pc$ tree ..|-- CMakeCache.txt|-- CMakeFiles| |-- 3.16.3| | |-- CMakeCCompiler.cmake| | |-- CMakeDetermineCompilerABI_C.bin| | |-- CMakeSystem.cmake| | `-- CompilerIdC| | |-- CMakeCCompilerId.c| | |-- a.out| | `-- tmp| |-- CMakeDirectoryInformation.cmake| |-- CMakeOutput.log| |-- CMakeTmp| |-- Export| | `-- share| | `-- soem| | `-- cmake| | |-- soemConfig-noconfig.cmake| | `-- soemConfig.cmake| |-- Makefile.cmake| |-- Makefile2| |-- TargetDirectories.txt| |-- cmake.check_cache| |-- progress.marks| `-- soem.dir| |-- C.includecache| |-- DependInfo.cmake| |-- build.make| |-- cmake_clean.cmake| |-- cmake_clean_target.cmake| |-- depend.internal| |-- depend.make| |-- flags.make| |-- link.txt| |-- osal| | `-- linux| | `-- osal.c.o| |-- oshw| | `-- linux| | |-- nicdrv.c.o| | `-- oshw.c.o| |-- progress.make| `-- soem| |-- ethercatbase.c.o| |-- ethercatcoe.c.o| |-- ethercatconfig.c.o| |-- ethercatdc.c.o| |-- ethercateoe.c.o| |-- ethercatfoe.c.o| |-- ethercatmain.c.o| |-- ethercatprint.c.o| `-- ethercatsoe.c.o|-- Makefile|-- cmake_install.cmake|-- libsoem.a`-- test |-- linux | |-- eepromtool | | |-- CMakeFiles | | | |-- CMakeDirectoryInformation.cmake | | | |-- eepromtool.dir | | | | |-- C.includecache | | | | |-- DependInfo.cmake | | | | |-- build.make | | | | |-- cmake_clean.cmake | | | | |-- depend.internal | | | | |-- depend.make | | | | |-- eepromtool.c.o | | | | |-- flags.make | | | | |-- link.txt | | | | `-- progress.make | | | `-- progress.marks | | |-- Makefile | | |-- cmake_install.cmake | | `-- eepromtool | |-- simple_test | | |-- CMakeFiles | | | |-- CMakeDirectoryInformation.cmake | | | |-- progress.marks | | | `-- simple_test.dir | | | |-- C.includecache | | | |-- DependInfo.cmake | | | |-- build.make | | | |-- cmake_clean.cmake | | | |-- depend.internal | | | |-- depend.make | | | |-- flags.make | | | |-- link.txt | | | |-- progress.make | | | `-- simple_test.c.o | | |-- Makefile | | |-- cmake_install.cmake | | `-- simple_test | `-- slaveinfo | |-- CMakeFiles | | |-- CMakeDirectoryInformation.cmake | | |-- progress.marks | | `-- slaveinfo.dir | | |-- C.includecache | | |-- DependInfo.cmake | | |-- build.make | | |-- cmake_clean.cmake | | |-- depend.internal | | |-- depend.make | | |-- flags.make | | |-- link.txt | | |-- progress.make | | `-- slaveinfo.c.o | |-- Makefile | |-- cmake_install.cmake | `-- slaveinfo `-- simple_ng |-- CMakeFiles | |-- CMakeDirectoryInformation.cmake | |-- progress.marks | `-- simple_ng.dir | |-- C.includecache | |-- DependInfo.cmake | |-- build.make | |-- cmake_clean.cmake | |-- depend.internal | |-- depend.make | |-- flags.make | |-- link.txt | |-- progress.make | `-- simple_ng.c.o |-- Makefile |-- cmake_install.cmake `-- simple_ng29 directories, 100 fileslhj@lhj:~/SOEM/build_pc$

开发板端

编译

cd SOEM/export CC=aarch64-linux-gnu-gccmkdir build cd build/ cmake ..

lhj@lhj:~/SOEM/build$ cmake ..-- The C compiler identification is GNU 9.4.0-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc -- works-- Detecting C compiler ABI info-- Detecting C compiler ABI info - done-- Detecting C compile features-- Detecting C compile features - done-- OS is linux-- LIB_DIR: lib-- Configuring done-- Generating done-- Build files have been written to: /home/lhj/SOEM/buildlhj@lhj:~/SOEM/build$

make

lhj@lhj:~/SOEM/build$ makeScanning dependencies of target soem[ 4%] Building C object CMakeFiles/soem.dir/soem/ethercatbase.c.o[ 9%] Building C object CMakeFiles/soem.dir/soem/ethercatcoe.c.o[ 14%] Building C object CMakeFiles/soem.dir/soem/ethercatconfig.c.o[ 19%] Building C object CMakeFiles/soem.dir/soem/ethercatdc.c.o[ 23%] Building C object CMakeFiles/soem.dir/soem/ethercateoe.c.o[ 28%] Building C object CMakeFiles/soem.dir/soem/ethercatfoe.c.o[ 33%] Building C object CMakeFiles/soem.dir/soem/ethercatmain.c.o[ 38%] Building C object CMakeFiles/soem.dir/soem/ethercatprint.c.o[ 42%] Building C object CMakeFiles/soem.dir/soem/ethercatsoe.c.o[ 47%] Building C object CMakeFiles/soem.dir/osal/linux/osal.c.o[ 52%] Building C object CMakeFiles/soem.dir/oshw/linux/nicdrv.c.o[ 57%] Building C object CMakeFiles/soem.dir/oshw/linux/oshw.c.o[ 61%] Linking C static library libsoem.a[ 61%] Built target soemScanning dependencies of target simple_ng[ 66%] Building C object test/simple_ng/CMakeFiles/simple_ng.dir/simple_ng.c.o[ 71%] Linking C executable simple_ng[ 71%] Built target simple_ngScanning dependencies of target slaveinfo[ 76%] Building C object test/linux/slaveinfo/CMakeFiles/slaveinfo.dir/slaveinfo.c.o[ 80%] Linking C executable slaveinfo[ 80%] Built target slaveinfoScanning dependencies of target eepromtool[ 85%] Building C object test/linux/eepromtool/CMakeFiles/eepromtool.dir/eepromtool.c.o[ 90%] Linking C executable eepromtool[ 90%] Built target eepromtoolScanning dependencies of target simple_test[ 95%] Building C object test/linux/simple_test/CMakeFiles/simple_test.dir/simple_test.c.o[100%] Linking C executable simple_test[100%] Built target simple_testlhj@lhj:~/SOEM/build$

部署cp libsoem.a /mnt/dcp test/linux/simple_test/simple_test /mnt/dcp test/linux/slaveinfo/slaveinfo /mnt/d将上述文件rz导入开发板chmod +x simple_test slaveinfo
运行

root@myir-yg2lx:~# ./slaveinfo eth0SOEM (Simple Open EtherCAT Master)SlaveinfoStarting slaveinfoec_init on eth0 succeeded.No slaves found!End slaveinfo, close socketEnd program

root@myir-yg2lx:~# ./simple_test eth0SOEM (Simple Open EtherCAT Master)Simple testStarting simple testec_init on eth0 succeeded.No slaves found!End simple test, close socketEnd programroot@myir-yg2lx:~#

总结

本开发板接口资源丰富,性能强,特别适合工控领域的应用,比如作为EtherCAT主站。由于没有从站,所以暂时未能演示和从站通讯的功能。

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 瑞萨
    +关注

    关注

    35

    文章

    22296

    浏览量

    86129
  • 工控
    +关注

    关注

    6

    文章

    226

    浏览量

    28189
  • 开发板
    +关注

    关注

    25

    文章

    4979

    浏览量

    97273
  • soem
    +关注

    关注

    0

    文章

    3

    浏览量

    16
收藏 人收藏

    评论

    相关推荐

    RZ/G2L高速虚拟串口方案 基于RZ/G2L SMARC开发板的虚拟(Virtual UART)实现方案

    RZ/G2L具有丰富的外设,比如千兆以太网,CANFD以及丰富的UART接口,可以满足工业数据收集处理相关的应用。本文主要介绍基于RZ/
    发表于 11-20 14:41 256次阅读
    <b class='flag-5'>RZ</b>/<b class='flag-5'>G2L</b>高速虚拟串口方案 基于<b class='flag-5'>瑞</b><b class='flag-5'>萨</b><b class='flag-5'>RZ</b>/<b class='flag-5'>G2L</b> SMARC<b class='flag-5'>开发板</b>的虚拟(Virtual UART)实现方案

    RZ/G2L串口SCI的使用(下)

    RZ/G2L串口SCI的使用
    的头像 发表于 08-03 08:06 484次阅读
    <b class='flag-5'>RZ</b>/<b class='flag-5'>G2L</b>串口SCI的使用(下)

    RZ/G2L串口SCI的使用(上)

    RZ/G2L串口SCI的使用
    的头像 发表于 07-25 08:06 496次阅读
    <b class='flag-5'>RZ</b>/<b class='flag-5'>G2L</b>串口SCI的使用(上)

    【昉·星光 2 高性能RISC-V单板计算机体验】EtherCAT

    的以太网控制器,具有良好的兼容性,任何具有网络接口卡的计算机和具有以太网控制的嵌入式设备都可以作为EtherCAT。对于PC计算机而言,
    发表于 07-14 20:33

    【米尔-米派兼容树莓派扩展模块-试用体验】值得拥有的米尔-米派兼容树莓派生态

    今天为大家介绍一块米尔出的精致生态开发板-米尔-米派兼容树莓派扩展模块。 超高性价比的RZ/G2L工业级处理器 RZ/
    发表于 05-13 11:28

    【米尔-米派兼容树莓派扩展模块-试用体验】米尔-米派兼容树莓派初次做上电测试

    先为大家简单介绍一下这块生态: 超高性价比的RZ/G2L工业级处理器 RZ/G2L
    发表于 05-11 16:35

    【米尔-米派兼容树莓派扩展模块-试用体验】初始开发板_米尔-米派兼容树莓派扩展模块

    开发板,他兼顾了严肃产品开发和爱好者创意实现两种需要。告诉你,选择它的五大理由: 1.工业芯片:采用RZ/
    发表于 04-29 11:42

    【米尔-RZ/G2UL开发板】6.基于SOEMEtherCat

    使用标准的以太网控制器,具有良好的兼容性,任何具有网络接口卡的计算机和具有以太网控制的嵌入式设备都可以作为EtherCAT。对于PC计算机而言,
    发表于 03-31 16:22

    【米尔-RZ/G2UL开发板】3.杂项测试

    【米尔-RZ/G2UL开发板】3.杂项测试 不知道为啥我这板子好多奇奇怪怪的调试信息蹦出来,临时抑制办法 echo 1 4 1 7 &g
    发表于 02-28 15:25

    【米尔-RZ/G2UL开发板】1.开箱

    【米尔-RZ/G2UL开发板】1.开箱 开箱视频 开箱也许会迟到,但是绝对不会缺席。今天开箱的是米尔-
    发表于 02-04 23:38

    米尔RZ/G2L开发板米派双核A55Remi Pi学习兼容树莓派扩展模块

    RemiPi第一款MPU生态板卡兼容树莓派扩展模块RZ/G2L工业级处理器,便于企业客户
    发表于 01-29 17:05 4次下载

    RZ/G2L串口SCI的使用(上)

    RZ/G2L的串口简称SCI,全称Serial Communication Interface。
    的头像 发表于 01-17 12:19 1470次阅读
    <b class='flag-5'>瑞</b><b class='flag-5'>萨</b><b class='flag-5'>RZ</b>/<b class='flag-5'>G2L</b>串口SCI的使用(上)

    【米尔-RZ/G2UL开发板开发板开箱与接口介绍

    开发板简介 MYC-YG2UL核心开发板基于RZ/G2UL处理器,通用64位工业MPU
    发表于 01-14 13:25

    RZ/G2L RZ/G2LC RZ/G2UL RZ/G3S灵活软件包应用说明

    电子发烧友网站提供《RZ/G2L RZ/G2LC RZ/G2UL
    发表于 01-14 10:46 1次下载
    <b class='flag-5'>RZ</b>/<b class='flag-5'>G2L</b> <b class='flag-5'>RZ</b>/<b class='flag-5'>G2</b>LC <b class='flag-5'>RZ</b>/<b class='flag-5'>G2</b>UL <b class='flag-5'>RZ</b>/<b class='flag-5'>G</b>3S灵活软件包应用说明

    RZ系列开发板6折,米尔将助力研讨会

    展出RZ/G2LRZ/G2UL系列核心开发,并进行demo演示,将围绕“嵌入式CPU模组助力
    的头像 发表于 12-07 08:14 436次阅读
    <b class='flag-5'>RZ</b>系列<b class='flag-5'>开发板</b>6折,米尔将助力<b class='flag-5'>瑞</b><b class='flag-5'>萨</b>研讨会