老朋友,今天的目标是在终端上调试Ethercat主站。希望对大家有点帮助,有不足之处相互讨教,谢谢。
硬件如下:
CPU:Atom E3845
网卡驱动:R8169
系统:Ubuntu 12.04 LTS
内核:3.4-9-rtai-686-pae
ECT:Igh ETHERCAT master 1.5.2
从站IO模块:ECT-MD32(上海摩习恩)
1、获取全部ETHERCAT帮助
指令帮助:ethercat
root@sinocnc-BayTrail-X64:/home/sinocnc# ethercat
Please specify a command!
Usage: ethercat [OPTIONS] [ARGUMENTS]
Commands (can be abbreviated):
alias Write alias addresses.
config Show slave configurations.
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.
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 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.
Call 'ethercat --help' for command-specific help.
Send bug reports to [email protected].
2、主站启动停止控制
指令帮助:/etc/init.d/ethercat
start启动总线
stop停止总线
restart重启总线
status获取运行状态
root@sinocnc-BayTrail-X64:/home/sinocnc# /etc/init.d/ethercat
USAGE: /etc/init.d/ethercat {start|stop|restart|status}
root@sinocnc-BayTrail-X64:/home/sinocnc# /etc/init.d/ethercat stop
Shutting down EtherCAT master 1.5.2 done
root@sinocnc-BayTrail-X64:/home/sinocnc# /etc/init.d/ethercat start
Starting EtherCAT master 1.5.2 done
root@sinocnc-BayTrail-X64:/home/sinocnc# /etc/init.d/ethercat stop
Shutting down EtherCAT master 1.5.2 done
3、读取SDO配置列表
指令帮助:ethercat sdos
root@sinocnc-BayTrail-X64:/home/sinocnc# ethercat sdos
SDO 0x1000, "Device type"
0x1000:00, r-r-r-, uint32, 32 bit, "Device type"
SDO 0x1001, "Error register"
0x1001:00, r-r-r-, uint8, 8 bit, "Error register"
SDO 0x1008, "Device name"
0x1008:00, r-r-r-, string, 96 bit, "Device name"
SDO 0x1009, "Hardware version"
0x1009:00, r-r-r-, string, 24 bit, "Hardware version"
SDO 0x100a, "Software version"
0x100a:00, r-r-r-, string, 24 bit, "Software version"
SDO 0x1010, "Store parameters"
0x1010:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1010:01, rwrwrw, uint32, 32 bit, "SubIndex 001"
SDO 0x1011, "Restore default parameters"
0x1011:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1011:01, rwrwrw, uint32, 32 bit, "SubIndex 001"
SDO 0x1018, "Identity"
0x1018:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1018:01, r-r-r-, uint32, 32 bit, "Vendor ID"
0x1018:02, r-r-r-, uint32, 32 bit, "Product code"
0x1018:03, r-r-r-, uint32, 32 bit, "Revision"
0x1018:04, r-r-r-, uint32, 32 bit, "Serial number"
SDO 0x10f0, "Backup parameter handling"
0x10f0:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x10f0:01, r-r-r-, uint32, 32 bit, "Checksum"
SDO 0x10f1, "Error Settings"
0x10f1:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x10f1:01, rwrwrw, uint32, 32 bit, "Local Error Reaction"
0x10f1:02, rwrwrw, uint16, 16 bit, "Sync Error Counter Limit"
SDO 0x10f3, "Diagnosis History"
0x10f3:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x10f3:01, r-r-r-, uint8, 8 bit, "Maximum Messages"
0x10f3:02, r-r-r-, uint8, 8 bit, "Newest Message"
0x10f3:03, rwrwrw, uint8, 8 bit, "Newest Acknowledged Message"
0x10f3:04, r-r-r-, bool, 1 bit, "New Message Available"
0x10f3:05, rwrwrw, uint16, 16 bit, "Flags"
0x10f3:06, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:07, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:08, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:09, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:0a, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:0b, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:0c, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:0d, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:0e, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:0f, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:10, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:11, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:12, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:13, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:14, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:15, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:16, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:17, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:18, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
0x10f3:19, r-r-r-, octet_string, 0 bit, "Diagnosis Message"
SDO 0x1610, "Write output 16bit process data mapping"
0x1610:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1610:01, r-r-r-, uint32, 32 bit, "SubIndex 001"
SDO 0x1a10, "Read input 16bit process data mapping"
0x1a10:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1a10:01, r-r-r-, uint32, 32 bit, "SubIndex 001"
SDO 0x1c00, "Sync manager type"
0x1c00:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1c00:01, r-r-r-, uint8, 8 bit, "SubIndex 001"
0x1c00:02, r-r-r-, uint8, 8 bit, "SubIndex 002"
0x1c00:03, r-r-r-, uint8, 8 bit, "SubIndex 003"
0x1c00:04, r-r-r-, uint8, 8 bit, "SubIndex 004"
SDO 0x1c12, "SyncManager 2 assignment"
0x1c12:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1c12:01, r-r-r-, uint16, 16 bit, "SubIndex 001"
SDO 0x1c13, "SyncManager 3 assignment"
0x1c13:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1c13:01, r-r-r-, uint16, 16 bit, "SubIndex 001"
SDO 0x1c32, "SM output parameter"
0x1c32:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1c32:01, r-r-r-, uint16, 16 bit, "Synchronization Type"
0x1c32:02, r-r-r-, uint32, 32 bit, "Cycle Time"
0x1c32:03, ------, type 0000, 32 bit, "SubIndex 003"
0x1c32:04, r-r-r-, uint16, 16 bit, "Synchronization Types supported"
0x1c32:05, r-r-r-, uint32, 32 bit, "Minimum Cycle Time"
0x1c32:06, r-r-r-, uint32, 32 bit, "Calc and Copy Time"
0x1c32:07, ------, type 0000, 32 bit, "SubIndex 007"
0x1c32:08, rwrwrw, uint16, 16 bit, "Get Cycle Time"
0x1c32:09, r-r-r-, uint32, 32 bit, "Delay Time"
0x1c32:0a, rwrwrw, uint32, 32 bit, "Sync0 Cycle Time"
0x1c32:0b, r-r-r-, uint16, 16 bit, "SM-Event Missed"
0x1c32:0c, r-r-r-, uint16, 16 bit, "Cycle Time Too Small"
0x1c32:0d, ------, type 0000, 16 bit, "Shift Time Too Short"
0x1c32:0e, ------, type 0000, 16 bit, "SubIndex 014"
0x1c32:0f, ------, type 0000, 32 bit, "SubIndex 015"
0x1c32:10, ------, type 0000, 32 bit, "SubIndex 016"
0x1c32:11, ------, type 0000, 32 bit, "SubIndex 017"
0x1c32:12, ------, type 0000, 32 bit, "SubIndex 018"
0x1c32:13, ------, type 0000, 0 bit, "SubIndex 019"
0x1c32:14, ------, type 0000, 0 bit, "SubIndex 020"
0x1c32:15, ------, type 0000, 0 bit, "SubIndex 021"
0x1c32:16, ------, type 0000, 0 bit, "SubIndex 022"
0x1c32:17, ------, type 0000, 0 bit, "SubIndex 023"
0x1c32:18, ------, type 0000, 0 bit, "SubIndex 024"
0x1c32:19, ------, type 0000, 0 bit, "SubIndex 025"
0x1c32:1a, ------, type 0000, 0 bit, "SubIndex 026"
0x1c32:1b, ------, type 0000, 0 bit, "SubIndex 027"
0x1c32:1c, ------, type 0000, 0 bit, "SubIndex 028"
0x1c32:1d, ------, type 0000, 0 bit, "SubIndex 029"
0x1c32:1e, ------, type 0000, 0 bit, "SubIndex 030"
0x1c32:1f, ------, type 0000, 0 bit, "SubIndex 031"
0x1c32:20, r-r-r-, bool, 1 bit, "Sync Error"
SDO 0x1c33, "SM input parameter"
0x1c33:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1c33:01, r-r-r-, uint16, 16 bit, "Synchronization Type"
0x1c33:02, r-r-r-, uint32, 32 bit, "Cycle Time"
0x1c33:03, ------, type 0000, 32 bit, "SubIndex 003"
0x1c33:04, r-r-r-, uint16, 16 bit, "Synchronization Types supported"
0x1c33:05, r-r-r-, uint32, 32 bit, "Minimum Cycle Time"
0x1c33:06, r-r-r-, uint32, 32 bit, "Calc and Copy Time"
0x1c33:07, ------, type 0000, 32 bit, "SubIndex 007"
0x1c33:08, rwrwrw, uint16, 16 bit, "Get Cycle Time"
0x1c33:09, r-r-r-, uint32, 32 bit, "Delay Time"
0x1c33:0a, rwrwrw, uint32, 32 bit, "Sync0 Cycle Time"
0x1c33:0b, r-r-r-, uint16, 16 bit, "SM-Event Missed"
0x1c33:0c, r-r-r-, uint16, 16 bit, "Cycle Time Too Small"
0x1c33:0d, ------, type 0000, 16 bit, "Shift Time Too Short"
0x1c33:0e, ------, type 0000, 16 bit, "SubIndex 014"
0x1c33:0f, ------, type 0000, 32 bit, "SubIndex 015"
0x1c33:10, ------, type 0000, 32 bit, "SubIndex 016"
0x1c33:11, ------, type 0000, 32 bit, "SubIndex 017"
0x1c33:12, ------, type 0000, 32 bit, "SubIndex 018"
0x1c33:13, ------, type 0000, 0 bit, "SubIndex 019"
0x1c33:14, ------, type 0000, 0 bit, "SubIndex 020"
0x1c33:15, ------, type 0000, 0 bit, "SubIndex 021"
0x1c33:16, ------, type 0000, 0 bit, "SubIndex 022"
0x1c33:17, ------, type 0000, 0 bit, "SubIndex 023"
0x1c33:18, ------, type 0000, 0 bit, "SubIndex 024"
0x1c33:19, ------, type 0000, 0 bit, "SubIndex 025"
0x1c33:1a, ------, type 0000, 0 bit, "SubIndex 026"
0x1c33:1b, ------, type 0000, 0 bit, "SubIndex 027"
0x1c33:1c, ------, type 0000, 0 bit, "SubIndex 028"
0x1c33:1d, ------, type 0000, 0 bit, "SubIndex 029"
0x1c33:1e, ------, type 0000, 0 bit, "SubIndex 030"
0x1c33:1f, ------, type 0000, 0 bit, "SubIndex 031"
0x1c33:20, r-r-r-, bool, 1 bit, "Sync Error"
SDO 0x3000, "Filter Constant"
0x3000:00, rwrwrw, uint16, 16 bit, "Filter Constant"
SDO 0x3102, "Polarity input 16bit"
0x3102:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x3102:01, rwrwrw, uint16, 16 bit, "Polarity input 1st word"
SDO 0x3302, "Polarity output 16bit"
0x3302:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x3302:01, rwrwrw, uint16, 16 bit, "Polarity output 1st word"
SDO 0x3306, "Error mode ouptut 16bit"
0x3306:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x3306:01, rwrwrw, uint16, 16 bit, "Error mode output 1st word"
SDO 0x3307, "Error value output 16bit"
0x3307:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x3307:01, rwrwrw, uint16, 16 bit, "Error value output 1st word"
SDO 0x6100, "Read input 16bit"
0x6100:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x6100:01, r-r-r-, uint16, 16 bit, "Read input 1st word"
SDO 0x7100, "Write output 16bit"
0x7100:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x7100:01, rwrwrw, uint16, 16 bit, "Write output 1st word"
4、获取总线连接的从站列表
指令帮助:ethercat slaves
root@sinocnc-BayTrail-X64:/home/sinocnc# ethercat slaves
0 0:0 PREOP + 0x0000098b:0x10011010
5、获取总站运行信息查询
指令帮助:ethercat master
root@sinocnc-BayTrail-X64:/home/sinocnc# ethercat master
Master0
Phase: Idle
Active: no
Slaves: 1
Ethernet devices:
Main: 00:15:fd:00:03:f1 (attached)
Link: UP
Tx frames: 1437901
Tx bytes: 86305388
Rx frames: 1437900
Rx bytes: 86305328
Tx errors: 0
Tx frame rate [1/s]: 250 250 250
Tx rate [KByte/s]: 14.6 14.6 14.7
Rx frame rate [1/s]: 250 250 250
Rx rate [KByte/s]: 14.6 14.6 14.7
Common:
Tx frames: 1437901
Tx bytes: 86305388
Rx frames: 1437900
Rx bytes: 86305328
Lost frames: 0
Tx frame rate [1/s]: 250 250 250
Tx rate [KByte/s]: 14.6 14.6 14.7
Rx frame rate [1/s]: 250 250 250
Rx rate [KByte/s]: 14.6 14.6 14.6
Loss rate [1/s]: 0 -0 0
Frame loss [%]: 0.0 -0.0 0.0
Distributed clocks:
Reference clock: Slave 0
Application time: 0
2000-01-01 00:00:00.000000000
6、读取/写入SDO canopen数据
指令帮助:ethercat upload 主索引 子索引
ethercat download 主索引 子索引 数值
root@sinocnc-BayTrail-X64:/home/sinocnc# ethercat upload 0x7100 0x01
0x0000 0
root@sinocnc-BayTrail-X64:/home/sinocnc# ethercat download 0x7100 0x01 0xff
root@sinocnc-BayTrail-X64:/home/sinocnc# ethercat upload 0x7100 0x01
0x00ff 255
本文启动开头作用,更多操作需要广大读者进行测试。
谢谢大家,下次再会。。。