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主站。由于没有从站,所以暂时未能演示和从站通讯的功能。

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

    关注

    32

    文章

    22214

    浏览量

    84915
  • 工控
    +关注

    关注

    6

    文章

    184

    浏览量

    27842
  • 开发板
    +关注

    关注

    25

    文章

    4429

    浏览量

    93993
收藏 人收藏

    评论

    相关推荐

    【米尔-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/G2UL开发板开发板开箱与接口介绍

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

    米尔基于瑞萨RZ/G2L开发板工控领域的应用-基于SOEMEtherCAT主站

    本文介绍【米尔MYD-YG2LX开发板】在工控领域的应用,实现基于SOEMEtherCAT主站。开发
    的头像 发表于 08-24 18:57 536次阅读
    米尔基于瑞萨<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'>领域</b>的应用-基于<b class='flag-5'>SOEM</b>的<b class='flag-5'>EtherCAT</b>主站

    【米尔RZ/G2L开发板-试用体验】认识一下米尔RZ/G2L开发板的核心

    解一下米尔RZ/G2L开发板的核心: MYC-YG2
    发表于 07-29 00:21

    【米尔RZ/G2L开发板-试用体验】米尔RZ/G2L开发板使用SSH登录

    收到的米尔RZ/G2L开发板上电测试一下SSH登录方式和其它测试! SSH登录 使用
    发表于 06-11 21:47

    150套开发板免费送!还有5G手机拿?米尔RZ/G2L开发板创意秀

    /12 05 送的是哪款开发板? 米尔MYD-YG2LX开发板,该款产品采用RZ/
    发表于 05-24 16:36

    米尔RZ/G2L开发板 触摸屏测试 #米尔开发板 #YG2LX #触摸屏

    开发板米尔
    华仔stm32
    发布于 :2023年05月24日 13:17:25

    【米尔RZ/G2L开发板-试用体验】米尔RZ/G2L开发板开箱视频

    今天刚刚收到米尔RZ/G2L开发板,拆开包裹后给人的感觉是惊艳,板卡设计真的很棒,来看看视频做个简单了解吧。 更多板卡可以登
    发表于 05-22 21:58

    【米尔RZ/G2L开发板-试用体验】米尔-RZG2L - 64位双核MPU开发板开箱测评

    刚收到米尔RZ/G2L开发板打开包装后看到的很大的一块黑色PCB,做工精美的开发板,给人眼前
    发表于 05-22 21:53

    【米尔RZ/G2L开发板-试用体验】LCD 显示测试

    实验器材 1、米尔RZ/G2L开发板 2、MY-TFT070-K显示屏 实现步骤 1、连接
    发表于 05-22 19:26

    【米尔RZ/G2L开发板-试用体验】开箱 + 开机

    感谢 感谢电子发烧友论坛、感谢米尔电子,把米尔RZ/G2L开发板试用话动的机会给了我。最近事情比较多,赶在这个空挡时间完成开箱报告。 开
    发表于 05-18 19:33

    米尔瑞萨RZ/G2L开发板-初体验

    介绍米尔RZ/G2L开发板
    的头像 发表于 05-15 09:10 699次阅读
    米尔瑞萨<b class='flag-5'>RZ</b>/<b class='flag-5'>G2L</b><b class='flag-5'>开发板</b>-初体验

    【米尔RZ/G2L开发板-试用体验】开箱

    感谢 感谢电子发烧友论坛、感谢米尔电子,把米尔RZ/G2L开发板试用话动的机会给了我。虽然周五就收到了
    发表于 05-14 19:41