主站源码下载 https://github.com/OpenEtherCATsociety/SOEM
从站源码下载 https://github.com/OpenEtherCATsociety/SOES
主站部分随便找一台带网络的linux主机就可以
从站部分需要cpu spi接口和lan9252和lan9253连接,移植驱动。
测试结果 从站(SOES) linux_lan9252demo 测试结果。
root@ht:~/SOES/applications/linux_lan9252demo# ./demo
Hello Main
Hello Main
测试结果 主站(SOEM)
eeprom 烧写内容slave.bin
[root@iHT-C2224 ~/SOEM/test/linux/eepromtool]$ ls
CMakeFiles eepromtool linsheng-gai.bin test2.hex
cmake_install.cmake eepromtool.c Makefile test.bin
CMakeLists.txt linsheng.bin slave.bin
[root@iHT-C2224 ~/SOEM/test/linux/eepromtool]$
slaveinfo 测试结果
[root@iHT-C2224 ~/SOEM/test/linux/slaveinfo]$ ./slaveinfo lan1 -sdo
SOEM (Simple Open EtherCAT Master)
Slaveinfo
Starting slaveinfo
ec_init on lan1 succeeded.
1 slaves found and configured.
Calculated workcounter 3
Slave:1
Name:evb9252_dig
Output size: 16bits
Input size: 8bits
State: 4
Delay: 0[ns]
Has DC: 1
DCParentport:0
Activeports:1.0.0.0
Configured address: 1001
Man: 00001337 ID: 000004d2 Rev: 00000000
SM0 A:1000 L: 128 F:00010026 Type:1
SM1 A:1080 L: 128 F:00010022 Type:2
SM2 A:1100 L: 2 F:00010024 Type:3
SM3 A:1180 L: 1 F:00010020 Type:4
FMMU0 Ls:00000000 Ll: 2 Lsb:0 Leb:7 Ps:1100 Psb:0 Ty:02 Act:01
FMMU1 Ls:00000002 Ll: 1 Lsb:0 Leb:7 Ps:1180 Psb:0 Ty:01 Act:01
FMMUfunc 0:1 1:2 2:0 3:0
MBX length wr: 128 rd: 128 MBX protocols : 0c
CoE details: 13 FoE details: 01 EoE details: 00 SoE details: 00
Ebus current: 0[mA]
only LRD/LWR:0
CoE Object Description found, 13 entries.
0x1000 "Device Type" [VAR]
0x00 "Device Type" [UNSIGNED32 R_R_R_] 0x01901389 / 26219401
0x1008 "Device Name" [VAR]
0x00 "Device Name" [VISIBLE_STR(88) R_R_R_] "evb9252_dig"
0x1009 "Hardware Version" [VAR]
0x100a "Software Version" [VAR]
0x1018 "Identity Object" [RECORD maxsub(0x04 / 4)]
0x00 "Max SubIndex" [UNSIGNED8 R_R_R_] 0x04 / 4
0x01 "Vendor ID" [UNSIGNED32 R_R_R_] 0x00001337 / 4919
0x02 "Product Code" [UNSIGNED32 R_R_R_] 0x000004d2 / 1234
0x03 "Revision Number" [UNSIGNED32 R_R_R_] 0x00000000 / 0
0x04 "Serial Number" [UNSIGNED32 R_R_R_] 0x00000000 / 0
0x1600 "LEDs" [RECORD maxsub(0x02 / 2)]
0x00 "Max SubIndex" [UNSIGNED8 R_R_R_] 0x02 / 2
0x01 "LED0" [UNSIGNED32 R_R_R_] 0x70000108 / 1879048456
0x02 "LED1" [UNSIGNED32 R_R_R_] 0x70000208 / 1879048712
0x1a00 "Buttons" [RECORD maxsub(0x01 / 1)]
0x00 "Max SubIndex" [UNSIGNED8 R_R_R_] 0x01 / 1
0x01 "Button1" [UNSIGNED32 R_R_R_] 0x60000108 / 1610613000
0x1c00 "Sync Manager Communication Type" [ARRAY maxsub(0x04 / 4)]
0x00 "Max SubIndex" [UNSIGNED8 R_R_R_] 0x04 / 4
0x01 "Communications Type SM0" [UNSIGNED8 R_R_R_] 0x01 / 1
0x02 "Communications Type SM1" [UNSIGNED8 R_R_R_] 0x02 / 2
0x03 "Communications Type SM2" [UNSIGNED8 R_R_R_] 0x03 / 3
0x04 "Communications Type SM3" [UNSIGNED8 R_R_R_] 0x04 / 4
0x1c12 "Sync Manager 2 PDO Assignment" [ARRAY maxsub(0x01 / 1)]
0x00 "Max SubIndex" [UNSIGNED8 R_R_R_] 0x01 / 1
0x01 "PDO Mapping" [UNSIGNED16 R_R_R_] 0x1600 / 5632
0x1c13 "Sync Manager 3 PDO Assignment" [ARRAY maxsub(0x01 / 1)]
0x00 "Max SubIndex" [UNSIGNED8 R_R_R_] 0x01 / 1
0x01 "PDO Mapping" [UNSIGNED16 R_R_R_] 0x1a00 / 6656
0x6000 "Buttons" [RECORD maxsub(0x01 / 1)]
0x00 "Max SubIndex" [UNSIGNED8 R_R_R_] 0x01 / 1
0x01 "Button1" [UNSIGNED8 R_R_R_] 0x00 / 0
0x7000 "LEDs" [RECORD maxsub(0x02 / 2)]
0x00 "Max SubIndex" [UNSIGNED8 R_R_R_] 0x02 / 2
0x01 "LED0" [UNSIGNED8 R_R_R_] 0x00 / 0
0x02 "LED1" [UNSIGNED8 R_R_R_] 0x00 / 0
0x8000 "Parameters" [RECORD maxsub(0x01 / 1)]
0x00 "Max SubIndex" [UNSIGNED8 R_R_R_] 0x01 / 1
0x01 "Multiplier" [UNSIGNED32 RWRWRW] 0x00000000 / 0
End slaveinfo, close socket
End program
[root@iHT-C2224 ~/SOEM/test/linux/slaveinfo]$