EtherCAT IGH 命令行介绍
-
在一开始学习 EtherCAT 的时候,可以直接编译 IGH,不需要一上来就去安装实时内核。因为编译 IGH 和安不安装实时内核没有什么关系,而且安装实时内核还比较麻烦。当我们只是有一两个电机或者IO模块来学习的时候,可以先不用去安装实时内核。
-
如果是在虚拟机中安装了IGH,那么为了能够扫描到从站,那么就需要在虚拟机中配置网络,利用桥接网络进行设置。这是因为虚拟机的网络地址是虚拟的IP,iP地址和实际PC上的是不一样的,所以必须固定和实际的PC的IP地址保持在同一个网段。
-
如果是使用的实体机,那么只要把PC 和 EtherCAT 从站用网线连接在一起就可以了,不需要单独设置IP地址,直接用DHCP也可以直接连接上。
1、测试环境说明
因为我购买的电机是没有带编码器和刹车的,因此就不需要接步进驱动器上面的刹车信号。
如果要跑回零模式的话,那么就需要接步进驱动器上面的限位信号。
另外步进驱动器上面的IO接口都是已经固定好了作用的,用来接限位和原点传感器的。
2、ethercat 命令行说明
EtherCAT 命令行在 《EtherCAT IGH 1.52.pdf》中的 <7.1 Command-line Tool> 也有很详细的一个介绍。在编译和安装IGH的时候,如果不修改默认的编译参数,那么就是会提供 EtherCAT 命令行工具的。
每个主站的实例都有生成一个字符设备,名字为:/dev/EtherCATx, 其中 x ∈ {0 . . . n}为主站实例的索引。
下面具体的介绍了一下各参数及命令的使用,其中 [ ] 中为必选参数,< >为可选参数。
2.1 ethercat --help
该命令行会告诉用户当前支持哪些命令行指令参数,当前总共提供了 28 个命令行指令。
@:~$ ethercat --help
alias Write alias addresses.
config Show slave configurations.
crc CRC error register diagnosis.
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.
ip Set EoE IP parameters.
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 <master> 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 <COMMAND> --help' for command-specific help.
2.2 ethercat alias
该命令行主要是用来创建 EtherCAT 从站的别名的。
ethercat alias [OPTIONS] <ALIAS>
Write alias addresses.
Arguments:
ALIAS must be an unsigned 16 bit number. Zero means
removing an alias address.
If multiple slaves are selected, the --force option
is required.
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
--force -f Acknowledge writing aliases of
multiple slaves.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
可选参数介绍:文章来源:https://www.toymoban.com/news/detail-405577.html
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –force -f:确认写入多个从站别名;
上面的-a 和 -p 参数后面很多的命令行都会用到。
例子:
sudo ethercat alias --position 0 0x3000
解析:将在bus总线上对应的从站0的别名(默认为0)为0x3000;
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.3 ethercat master
该命令行用来显示主站和以太网设备信息。
ethercat master --help
ethercat master [OPTIONS]
Show master and Ethernet device information.
Command-specific options:
--master -m <indices> Master indices. A comma-separated
list with ranges is supported.
Example: 1,4,5,7-9. Default: - (all).
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
可选参数:
- –master -m :indices为主站的索引。默认显示所有的设备信息;
例子:
@:~$ ethercat master
Master0
Phase: Idle
Active: no
Slaves: 1
Ethernet devices:
Main: 98:29:a6:56:57:ce (attached)
Link: UP
Tx frames: 5847
Tx bytes: 534212
Rx frames: 5846
Rx bytes: 534152
Tx errors: 0
Tx frame rate [1/s]: 125 307 87
Tx rate [KByte/s]: 7.3 27.4 7.8
Rx frame rate [1/s]: 125 307 87
Rx rate [KByte/s]: 7.3 27.4 7.8
Common:
Tx frames: 12089
Tx bytes: 915900
Rx frames: 6797
Rx bytes: 598380
Lost frames: 5292
Tx frame rate [1/s]: 125 353 149
Tx rate [KByte/s]: 7.3 30.3 11.5
Rx frame rate [1/s]: 125 327 99
Rx rate [KByte/s]: 7.3 28.7 8.6
Loss rate [1/s]: 0 27 50
Frame loss [%]: 0.0 7.5 33.4
Distributed clocks:
Reference clock: Slave 0
DC reference time: 0
Application time: 0
2000-01-01 00:00:00.000000000
显示所有主机的设备信息(发送帧、接收帧、参考时钟、应用时间)。
后面的 Distributed clocks 只有在启动应用程序之后才会有相应的参数值。
当给定的主站参数无效的时候,会输处如下报错信息。
@:~$ ethercat master -m 1
Failed to open master device /dev/EtherCAT1: No such file or directory
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。文章来源地址https://www.toymoban.com/news/detail-405577.html
2.4 ethercat slaves
@:~$ ethercat slaves --help
ethercat slaves [OPTIONS]
Display slaves on the bus.
If the --verbose option is not given, the slaves are
displayed one-per-line. Example:
1 5555:0 PREOP + EL3162 2C. Ana. Input 0-10V
| | | | | |
| | | | | \- Name from the SII if available,
| | | | | otherwise vendor ID and product
| | | | | code (both hexadecimal).
| | | | \- Error flag. '+' means no error,
| | | | 'E' means that scan or
| | | | configuration failed.
| | | \- Current application-layer state.
| | \- Decimal relative position to the last
| | slave with an alias address set.
| \- Decimal alias address of this slave (if set),
| otherwise of the last slave with an alias set,
| or zero, if no alias was encountered up to this
| position.
\- Absolute ring position in the bus.
If the --verbose option is given, a detailed (multi-line)
description is output for each slave.
Slave selection:
Slaves for this and other commands can be selected with
the --alias and --position parameters as follows:
1) If neither the --alias nor the --position option
is given, all slaves are selected.
2) If only the --position option is given, it is
interpreted as an absolute ring position and
a slave with this position is matched.
3) If only the --alias option is given, all slaves
with the given alias address and subsequent
slaves before a slave with a different alias
address match (use -p0 if only the slaves
with the given alias are desired, see 4)).
4) If both the --alias and the --position option are
given, the latter is interpreted as relative
position behind any slave with the given alias.
Command-specific options:
--alias -a <alias> Slave alias (see above).
--position -p <pos> Slave position (see above).
--verbose -v Show detailed slave information.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
- 如果最后的 -v 参数没有设置,显示的参数含义如下:
1 5555:0 PREOP + EL3162 2C. Ana. Input 0-10V
| | | | | |
| | | | | \- 从SII 上面读取到的从站名字(如果有设置的话)。或者
| | | | | 是 vendor ID and product code ,两个参数都是用
| | | | | 十进制表示的。
| | | | |
| | | | \- 错误标志。 '+' 意味着是没有错误,
| | | | 'E' 意味着存在配置方面的错误或者其他错误。
| | | |
| | | \- 当前从站的状态。
| | |
| | \- 十进制表示的与最后一个设置了别名地址的从站设备的相对位置。
| |
| \- 用十进制表示的一个从站别名地址(如果有进行设置的话),
| 否则为设置的最后一个从机别名的地址。
| 如果在此位置之前未遇到设置了别名的从站设备,则为零。
|
\- 代表在总线上的绝对位置.
如果设置了最后的 -v 参数,则为每一个从站输出相应的描述。
该命令行中从站的选择是通过参数 -a 和 -p 来选择的。
- 1、如果没有设置 --alias 和 --position 这两个选项参数,则会选择所有的从站设备。
- 2、如果只给出 --position 选项参数,那么总线上绝对位置为该值的从站设备会被选中。
- 3、如果只给出了–alias 选项参数,则具有给定别名地址的所有从属设备和具有不同别名地址的从属设备之前的后续从属设备都会匹配。(如果只需要具有给定别名的从机,请使用-p0,请参见4):
- 4、如果 --alias 和 --position 这个两个参数同时给定,后者被解释为相对
位于具有给定别名的任何从属设备后面。
这边关于从站的别名配置以及匹配的方法介绍,可以参照 《EtherCAT IGH 1.52.pdf》中的 < 3.1.1 Slave Configuration > 介绍。
或者阅读下面这两个文章,这两个文章介绍的也是很详细的。
Ethercat解析(十)之从站配置
IgH Master 1.5.2 Documentation 中文版 2.1从站的配置
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –verbose -v :显示从站的详细信息。
例子:
@:~$ ethercat slaves
0 0:0 PREOP + 2DM522-EC
此时表示从站已经进入了 PEROP 状态了。
@:~$ ethercat slaves
0 0:0 SAFEOP+ERROR E 2DM522-EC
此时可以看到当前的从站已经进入了 SAFEOP 的状态了。但是后面还有一个 + ERROR。这个根据 ethercat states --help 可以看到这个表示 ethercat 从站出现错误,可能是扫描错误,也有可能是配置出错了。
下面这个例子采用 -v 参数显示从站的具体信息。在打印出来的具体参数中可以看到 Vendor Id 和 Product code,这个两个参数在后面我们编写主站应用程序的时候需要用到。另外还可以看到邮箱服务中该驱动器只支持 COE 服务, 不支持 FOE、SOE、EOE等服务。
@:~$ ethercat slaves -a 0 -p 0 -v
=== Master 0, Slave 0 ===
Device: Main
State: OP
Flag: +
Identity:
Vendor Id: 0x66668888
Product code: 0x20190303
Revision number: 0x20190620
Serial number: 0x00000000
DL information:
FMMU bit operation: no
Distributed clocks: yes, 64 bit
DC system time transmission delay: 0 ns
Port Type Link Loop Signal NextSlave RxTime [ns] Diff [ns] NextDc [ns]
0 MII up open yes - 3810966012 0 0
1 MII down closed no - - - -
2 N/A down closed no - - - -
3 N/A down closed no - - - -
Mailboxes:
Bootstrap RX: 0x0000/0, TX: 0x0000/0
Standard RX: 0x1000/128, TX: 0x1200/256
Supported protocols: CoE
General:
Group: 2DM Slave
Image name:
Order number: 2DM522-EC
Device name: 2DM522-EC
CoE details:
Enable SDO: yes
Enable SDO Info: yes
Enable PDO Assign: yes
Enable PDO Configuration: yes
Enable Upload at startup: no
Enable SDO complete access: yes
Flags:
Enable SafeOp: no
Enable notLRW: no
Current consumption: 0 mA
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.5 ethercat states
该命令行用来请求从站转换状态。
@:~$ ethercat states --help
ethercat states [OPTIONS] <STATE>
Request application-layer states.
Arguments:
STATE can be 'INIT', 'PREOP', 'BOOT', 'SAFEOP', or 'OP'.
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
必选参数介绍:
- STATE:可选的参数有INIT、PREOP、BOOT、SAFEOP、OP;
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
例子:
sudo ethercat states -p 0 OP
用于将从站0的状态切换为OP;
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.6 ethercat graph
该命令行用来输出总线上连接的所有从站设备的总线拓扑图。
ethercat graph [OPTIONS]
ethercat graph [OPTIONS] <INFO>
Output the bus topology as a graph.
The bus is output in DOT language (see
http://www.graphviz.org/doc/info/lang.html), which can
be processed with the tools from the Graphviz
package. Example:
ethercat graph | dot -Tsvg > bus.svg
See 'man dot' for more information.
Additional information at edges and nodes is selected via
the first argument:
DC - DC timing
CRC - CRC error register information
例子:
以文本的信息输出从站连接拓扑图。
@:~$ ethercat graph
/* EtherCAT bus graph. Generated by 'ethercat graph'. */
strict graph bus {
rankdir="LR"
ranksep=0.8
nodesep=0.8
node [fontname="Helvetica"]
edge [fontname="Helvetica",fontsize="10"]
master [label="EtherCAT\nMaster"]
master -- slave0[label="MII"]
slave0 [shape="box",label="0 / 0:0\n2DM522-EC"]
}
将总线拓扑图输出到桌面,保存成 svg 格式的图片。
sudo ethercat graph | dot -Tsvg > ~/Desktop/bus.svg
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.7 ethercat xml
@:~$ ethercat xml --help
ethercat xml [OPTIONS]
Generate slave information XML.
Note that the PDO information can either originate
from the SII or from the CoE communication area. For
slaves, that support configuring PDO assignment and
mapping, the output depends on the last configuration.
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
例子:
@:~$ ethercat xml
<?xml version="1.0" ?>
<EtherCATInfo>
<!-- Slave 0 -->
<Vendor>
<Id>1717995656</Id>
</Vendor>
<Descriptions>
<Devices>
<Device>
<Type ProductCode="#x20190303" RevisionNo="#x20190620">2DM522-EC</Type>
<Name><![CDATA[2DM522-EC]]></Name>
<Sm Enable="1" StartAddress="#x1000" ControlByte="#x26" DefaultSize="128" />
<Sm Enable="1" StartAddress="#x1200" ControlByte="#x22" DefaultSize="256" />
<Sm Enable="1" StartAddress="#x1400" ControlByte="#x64" DefaultSize="17" />
<Sm Enable="1" StartAddress="#x1600" ControlByte="#x20" DefaultSize="31" />
<RxPdo Sm="2" Fixed="1" Mandatory="1">
<Index>#x1600</Index>
<Name>RxPdoMapping</Name>
<Entry>
<Index>#x6040</Index>
<SubIndex>0</SubIndex>
<BitLen>16</BitLen>
<Name>controlword</Name>
<DataType>UINT16</DataType>
</Entry>
<Entry>
<Index>#x6060</Index>
<SubIndex>0</SubIndex>
<BitLen>8</BitLen>
<Name>op_mode</Name>
<DataType>UINT8</DataType>
</Entry>
<Entry>
<Index>#x607a</Index>
<SubIndex>0</SubIndex>
<BitLen>32</BitLen>
<Name>target_position</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x60b8</Index>
<SubIndex>0</SubIndex>
<BitLen>16</BitLen>
<Name>Touch_probe_function</Name>
<DataType>UINT16</DataType>
</Entry>
<Entry>
<Index>#x60fe</Index>
<SubIndex>1</SubIndex>
<BitLen>32</BitLen>
<Name>physical_outputs</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x60fe</Index>
<SubIndex>2</SubIndex>
<BitLen>32</BitLen>
<Name>bit_mask</Name>
<DataType>UINT32</DataType>
</Entry>
</RxPdo>
<TxPdo Sm="3" Fixed="1" Mandatory="1">
<Index>#x1a00</Index>
<Name>TxPdoMapping</Name>
<Entry>
<Index>#x603f</Index>
<SubIndex>0</SubIndex>
<BitLen>16</BitLen>
<Name>errorcode</Name>
<DataType>UINT16</DataType>
</Entry>
<Entry>
<Index>#x6041</Index>
<SubIndex>0</SubIndex>
<BitLen>16</BitLen>
<Name>statusword</Name>
<DataType>UINT16</DataType>
</Entry>
<Entry>
<Index>#x6061</Index>
<SubIndex>0</SubIndex>
<BitLen>8</BitLen>
<Name>op_mode_display</Name>
<DataType>UINT8</DataType>
</Entry>
<Entry>
<Index>#x6064</Index>
<SubIndex>0</SubIndex>
<BitLen>32</BitLen>
<Name>actual_position</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x60b9</Index>
<SubIndex>0</SubIndex>
<BitLen>16</BitLen>
<Name>Touch_probe_status</Name>
<DataType>UINT16</DataType>
</Entry>
<Entry>
<Index>#x60ba</Index>
<SubIndex>0</SubIndex>
<BitLen>32</BitLen>
<Name>Touch_probe_pos1_pos_value</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x60bb</Index>
<SubIndex>0</SubIndex>
<BitLen>32</BitLen>
<Name>Touch_probe_pos1_neg_value</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x60bc</Index>
<SubIndex>0</SubIndex>
<BitLen>32</BitLen>
<Name>Touch_probe_pos2_pos_value</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x60bd</Index>
<SubIndex>0</SubIndex>
<BitLen>32</BitLen>
<Name>Touch_probe_pos2_neg_value</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x60fd</Index>
<SubIndex>0</SubIndex>
<BitLen>32</BitLen>
<Name>digtal_inputs</Name>
<DataType>UINT32</DataType>
</Entry>
</TxPdo>
</Device>
</Devices>
</Descriptions>
</EtherCATInfo>
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.8 ethercat debug
该命令用来设置主站的调试级别。
@:~$ ethercat debug --help
ethercat debug <LEVEL>
Set the master's debug level.
Debug messages are printed to syslog.
Arguments:
LEVEL can have one of the following values:
0 for no debugging output,
1 for some debug messages, or
2 for printing all frame contents (use with caution!).
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
在实际的调试过程中的时候,一般会和sudo dmesg -w这个命令一起配合使用。
该命令后终端不会有任何的信息输出,但是当你在另外一个终端输入sudo dmesg -w,你就会发现在这个终端这边输出了一些 ethercat 的 debug 信息,前提是你设置的参数是 1 或者 2。
参数介绍:
- –LEVEL :设置调试等级
- 0 : 无任何调试信息输出
- 1 : 输出部分调试信息
- 2 : 输出所有的帧的内容(由于输出信息较多,请谨慎使用)
例子:
sudo ethercat debug 1
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.9 ethercat version
该命令行用来输出当前主站的版本的。
@:~$ ethercat version --help
ethercat version [OPTIONS]
Show version information.
例子:
@:~$ sudo ethercat version
IGH EtherCAT master 1.6.0-rc1 unknow
注意:不连接从站也能使用此命令,不运行应用程序也可以使用。
2.10 ethercat sdos
该命令行用来输出当前驱动器支持的所有的SDO信息。
@:~$ ethercat sdos --help
ethercat sdos [OPTIONS]
List SDO dictionaries.
SDO dictionary information is displayed in two layers,
which are indented accordingly:
1) SDOs - Hexadecimal SDO index and the name. Example:
SDO 0x1018, "Identity object"
2) SDO entries - SDO index and SDO entry subindex (both
hexadecimal) followed by the access rights (see
below), the data type, the length in bit, and the
description. Example:
0x1018:01, rwrwrw, uint32, 32 bit, "Vendor id"
The access rights are specified for the AL states PREOP,
SAFEOP and OP. An 'r' means, that the entry is readable
in the corresponding state, an 'w' means writable,
respectively. If a right is not granted, a dash '-' is
shown.
If the --quiet option is given, only the SDOs are output.
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
--quiet -q Only output SDOs (without the
SDO entries).
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
该命令行中如果采用采用的默认的参数,那么会输出一下两层信息:
-
1、SDO 的索引和名字信息
SDO 0x6040, “controlword”
- 0x6040:SDO 索引值;
- “controlword”:SDO的名字,表示这是一个控制字;
-
2、显示 SDO 的内容,包括各个子索引的参数含义、访问权限等
0x6040:00, rwrwrw, uint16, 16 bit, “controlword”"
- 0x6040:00:代表子索引的地址为 0x0000;
- rwrwrw:代表着这个 SDO 的访问权限; 这个访问权限分别是针对应用层在预运行状态(PREOP)、安全运行状态(SAFEOP)和运行状态(OP)。'r’表示该条目可读,‘w’表示该条目可写。假如对访问权限不太确切,则使用’-'代替;
- uint16:代表这个子索引保存的数据类型,无符号整数数据, 16 bit;
- 16 bit:代表这个子索引数据的大小是 16 bit;
- “controlword”:用来描述这个子索引的含义;
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –quiet -q :只用来输出 PDOs,不输出 PDO 条目信息。
例子:
@:~$ 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, 72 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, 32 bit, "Software version"
SDO 0x1010, "store parameters"
0x1010:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1010:01, rwrwrw, uint32, 32 bit, "save all parameters"
0x1010:02, rwrwrw, uint32, 32 bit, "save communication parameters"
0x1010:03, rwrwrw, uint32, 32 bit, "save application parameters"
0x1010:04, rwrwrw, uint32, 32 bit, "save manufacturer defined parameters"
..............
SDO 0x6007, "Abort_connection_option_code"
0x6007:00, rwrwrw, int16, 16 bit, "Abort_connection_option_code"
SDO 0x603f, "errorcode"
0x603f:00, r-r-r-, uint16, 16 bit, "errorcode"
SDO 0x6040, "controlword"
0x6040:00, rwrwrw, uint16, 16 bit, "controlword"
SDO 0x6041, "statusword"
0x6041:00, r-r-r-, uint16, 16 bit, "statusword"
..............
添加 -q 参数,只用来输出 PDOs,不输出 PDO 条目信息。
@:~$ ethercat sdos -a 0 -p 0 -q
SDO 0x1000, "Device type"
SDO 0x1001, "Error register"
SDO 0x1008, "Device name"
SDO 0x1009, "Hardware version"
SDO 0x100a, "Software version"
SDO 0x1010, "store parameters"
..............
SDO 0x6007, "Abort_connection_option_code"
SDO 0x603f, "errorcode"
SDO 0x6040, "controlword"
SDO 0x6041, "statusword"
..............
2.11 ethercat pdos
该命令行用来显示出同步管理器的参数和PDO分配和映射信息。
@:~$ ethercat pdos --help
ethercat pdos [OPTIONS]
List Sync managers, PDO assignment and mapping.
For the default skin (see --skin option) the information
is displayed in three layers, which are
indented accordingly:
1) Sync managers - Contains the sync manager information
from the SII: Index, physical start address, default
size, control register and enable word. Example:
SM3: PhysAddr 0x1100, DefaultSize 0, ControlRegister 0x20, Enable 1
2) Assigned PDOs - PDO direction, hexadecimal index and
the PDO name, if available. Note that a 'Tx' and 'Rx'
are seen from the slave's point of view. Example:
TxPDO 0x1a00 "Channel1"
3) Mapped PDO entries - PDO entry index and subindex (both
hexadecimal), the length in bit and the description, if
available. Example:
PDO entry 0x3101:01, 8 bit, "Status"
Note, that the displayed PDO assignment and PDO mapping
information can either originate from the SII or from the
CoE communication area.
The "etherlab" skin outputs a template configuration
for EtherLab's generic EtherCAT slave block.
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
--skin -s <skin> Choose output skin. Possible values are
"default" and "etherlab".
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
该命令行中如果采用采用的默认的参数,那么会输出一下三层信息:
-
1、同步管理器信息
SM3: PhysAddr 0x1600, DefaultSize 31, ControlRegister 0x20, Enable 1
- SM3:同步管理器3;
- PhysAddr:物理地址开始地址 0x1600;
- DefaultSize:默认数据大小 31;
- ControlRegister:控制寄存器 0x20;
- Enable:使能字 1;
-
2、显示PDO方向(TX 或者 RX),索引值,PDO名字
TxPDO 0x1a00 “TxPdoMapping”
- TxPDO:代表从站发送数据的方向(从站发送数据);
- 0x1a00:PDO的索引值;
- “TxPdoMapping”:PDO的名字;
-
3、显示PDO条目的索引和子索引(都是以16进制的形式现实的),显示位宽和描述
PDO entry 0x6041:00, 16 bit, “statusword”
* 0x6041:00 : 表示PDO的索引和子索引,当前表示为 状态字 的索引和子索引地址; * 16bit:表示该条目的位宽,是一个 16 bit 的数据; * "statusword":表示该位的描述,表示这个PDO 描述的是状态字;
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –skin -s <skin> :用以设置输出的形式
例子:
@:~$ ethercat pdos
SM0: PhysAddr 0x1000, DefaultSize 128, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1200, DefaultSize 256, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1400, DefaultSize 17, ControlRegister 0x64, Enable 1
RxPDO 0x1600 "RxPdoMapping"
PDO entry 0x6040:00, 16 bit, "controlword"
PDO entry 0x6060:00, 8 bit, "op_mode"
PDO entry 0x607a:00, 32 bit, "target_position"
PDO entry 0x60b8:00, 16 bit, "Touch_probe_function"
PDO entry 0x60fe:01, 32 bit, "physical_outputs"
PDO entry 0x60fe:02, 32 bit, "bit_mask"
SM3: PhysAddr 0x1600, DefaultSize 31, ControlRegister 0x20, Enable 1
TxPDO 0x1a00 "TxPdoMapping"
PDO entry 0x603f:00, 16 bit, "errorcode"
PDO entry 0x6041:00, 16 bit, "statusword"
PDO entry 0x6061:00, 8 bit, "op_mode_display"
PDO entry 0x6064:00, 32 bit, "actual_position"
PDO entry 0x60b9:00, 16 bit, "Touch_probe_status"
PDO entry 0x60ba:00, 32 bit, "Touch_probe_pos1_pos_value"
PDO entry 0x60bb:00, 32 bit, "Touch_probe_pos1_neg_value"
PDO entry 0x60bc:00, 32 bit, "Touch_probe_pos2_pos_value"
PDO entry 0x60bd:00, 32 bit, "Touch_probe_pos2_neg_value"
PDO entry 0x60fd:00, 32 bit, "digtal_inputs"
设置 etherlab 的输出形式。
@:~$ ethercat pdos -a 0 -p 0 -s "etherlab"
%
% Master 0, Slave 0, "2DM522-EC"
%
function rv = slave0()
% Slave configuration
rv.SlaveConfig.vendor = 1717995656;
rv.SlaveConfig.product = hex2dec('20190303');
rv.SlaveConfig.description = '2DM522-EC';
rv.SlaveConfig.sm = { ...
{0, 0, {
}}, ...
{1, 1, {
}}, ...
{2, 0, {
{hex2dec('1600'), [
hex2dec('6040'), hex2dec('00'), 16; ...
hex2dec('6060'), hex2dec('00'), 8; ...
hex2dec('607a'), hex2dec('00'), 32; ...
hex2dec('60b8'), hex2dec('00'), 16; ...
hex2dec('60fe'), hex2dec('01'), 32; ...
hex2dec('60fe'), hex2dec('02'), 32; ...
]}, ...
}}, ...
{3, 1, {
{hex2dec('1a00'), [
hex2dec('603f'), hex2dec('00'), 16; ...
hex2dec('6041'), hex2dec('00'), 16; ...
hex2dec('6061'), hex2dec('00'), 8; ...
hex2dec('6064'), hex2dec('00'), 32; ...
hex2dec('60b9'), hex2dec('00'), 16; ...
hex2dec('60ba'), hex2dec('00'), 32; ...
hex2dec('60bb'), hex2dec('00'), 32; ...
hex2dec('60bc'), hex2dec('00'), 32; ...
hex2dec('60bd'), hex2dec('00'), 32; ...
hex2dec('60fd'), hex2dec('00'), 32; ...
]}, ...
}}, ...
};
% Port configuration
rv.PortConfig.input(1).pdo = [2, 0, 0, 0];
rv.PortConfig.input(1).pdo_data_type = 1016;
rv.PortConfig.input(2).pdo = [2, 0, 1, 0];
rv.PortConfig.input(2).pdo_data_type = 1008;
rv.PortConfig.input(3).pdo = [2, 0, 2, 0];
rv.PortConfig.input(3).pdo_data_type = 1032;
rv.PortConfig.input(4).pdo = [2, 0, 3, 0];
rv.PortConfig.input(4).pdo_data_type = 1016;
rv.PortConfig.input(5).pdo = [2, 0, 4, 0];
rv.PortConfig.input(5).pdo_data_type = 1032;
rv.PortConfig.input(6).pdo = [2, 0, 5, 0];
rv.PortConfig.input(6).pdo_data_type = 1032;
rv.PortConfig.output(1).pdo = [3, 0, 0, 0];
rv.PortConfig.output(1).pdo_data_type = 1016;
rv.PortConfig.output(2).pdo = [3, 0, 1, 0];
rv.PortConfig.output(2).pdo_data_type = 1016;
rv.PortConfig.output(3).pdo = [3, 0, 2, 0];
rv.PortConfig.output(3).pdo_data_type = 1008;
rv.PortConfig.output(4).pdo = [3, 0, 3, 0];
rv.PortConfig.output(4).pdo_data_type = 1032;
rv.PortConfig.output(5).pdo = [3, 0, 4, 0];
rv.PortConfig.output(5).pdo_data_type = 1016;
rv.PortConfig.output(6).pdo = [3, 0, 5, 0];
rv.PortConfig.output(6).pdo_data_type = 1032;
rv.PortConfig.output(7).pdo = [3, 0, 6, 0];
rv.PortConfig.output(7).pdo_data_type = 1032;
rv.PortConfig.output(8).pdo = [3, 0, 7, 0];
rv.PortConfig.output(8).pdo_data_type = 1032;
rv.PortConfig.output(9).pdo = [3, 0, 8, 0];
rv.PortConfig.output(9).pdo_data_type = 1032;
rv.PortConfig.output(10).pdo = [3, 0, 9, 0];
rv.PortConfig.output(10).pdo_data_type = 1032;
end
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.12 ethercat upload
该命令行用以读取指定从站相应PDO设定的参数值。
@:~$ ethercat upload
ethercat upload [OPTIONS] <INDEX> <SUBINDEX>
Read an SDO entry from a slave.
This command requires a single slave to be selected.
The data type of the SDO entry is taken from the SDO
dictionary by default. It can be overridden with the
--type option. If the slave does not support the SDO
information service or the SDO is not in the dictionary,
the --type option is mandatory.
These are valid data types to use with
the --type option:
bool,
int8, int16, int32, int64,
uint8, uint16, uint32, uint64,
float, double,
string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
sm8, sm16, sm32, sm64
Arguments:
INDEX is the SDO index and must be an unsigned
16 bit number.
SUBINDEX is the SDO entry subindex and must be an
unsigned 8 bit number.
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
--type -t <type> SDO entry data type (see above).
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
必选参数介绍:
- INDEX:16位无符整型的SDO索引;
- SUBINDEX:8位无符整型的SDO子索引;
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –type -t <type> : SDO 子索引中的参数数据类型;
例子:
@:~$ ethercat upload 0x2001 0x0000
0x03e8 1000
解析:读取从站0中索引号为 0x2001(16位),子索引号为00(8位)的SDO条目。返回的参数值为 1000。
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.13 ethercat download
该命令行用以向指定的从站 SDO 中的子索引中写入相应的参数值。
@:~$ ethercat upload
ethercat download [OPTIONS] <INDEX> <SUBINDEX> <VALUE>
[OPTIONS] <INDEX> <VALUE>
Write an SDO entry to a slave.
This command requires a single slave to be selected.
The data type of the SDO entry is taken from the SDO
dictionary by default. It can be overridden with the
--type option. If the slave does not support the SDO
information service or the SDO is not in the dictionary,
the --type option is mandatory.
The second call (without <SUBINDEX>) uses the complete
access method.
These are valid data types to use with
the --type option:
bool,
int8, int16, int32, int64,
uint8, uint16, uint32, uint64,
float, double,
string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
sm8, sm16, sm32, sm64
Arguments:
INDEX is the SDO index and must be an unsigned
16 bit number.
SUBINDEX is the SDO entry subindex and must be an
unsigned 8 bit number.
VALUE is the value to download and must correspond
to the SDO entry datatype (see above). Use
'-' to read from standard input.
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
--type -t <type> SDO entry data type (see above).
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
必选参数介绍:
- INDEX:16位无符整型的SDO索引;
- SUBINDEX:8位无符整型的SDO子索引;
- VALUE: 要设定的参数,必须符合该SDO子索引要求的数据类型参数;
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –type -t <type> : SDO 子索引中的参数数据类型;
例子:
向从站0的索引号为0x6060(16位),子索引号为00(8位)的地址写入参数值"0x08"。
@:~$ sudo ethercat download -t int16 -p 0 0x6060 00 08
有的SDO 可能是由于厂家的限制,不能写入参数。
@:~$ sudo ethercat download -t uint16 0x2008 0x0000 0x000f
SDO transfer aborted with code 0x08000021: Data cannot be transferred or stored to the application because of local control
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.14 ethercat soe_read
该命令行用以读取从站的 IDN 参数值。
@:~$ ethercat soe_read --help
ethercat soe_read [OPTIONS] <IDN>
ethercat soe_read [OPTIONS] <DRIVE> <IDN>
Read an SoE IDN from a slave.
This command requires a single slave to be selected.
Arguments:
DRIVE is the drive number (0 - 7). If omitted, 0 is assumed.
IDN is the IDN and must be either an unsigned
16 bit number acc. to IEC 61800-7-204:
Bit 15: (0) Standard data, (1) Product data
Bit 14 - 12: Parameter set (0 - 7)
Bit 11 - 0: Data block number
or a string like 'P-0-150'.
Data of the given IDN are read and displayed according to
the given datatype, or as raw hex bytes.
These are valid data types to use with
the --type option:
bool,
int8, int16, int32, int64,
uint8, uint16, uint32, uint64,
float, double,
string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
sm8, sm16, sm32, sm64
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
--type -t <type> Data type (see above).
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
此命令要求必须指定单个从属设备。
必选参数介绍:
- DRIVE: 是驱动器编号(0-7)。如果省略,则假定为0。
- IDN:必须是无符号的符合IEC 61800-7-2004的16位数字。
- 位15:(0)标准数据,(1)产品数据
- 位14-12:参数集(0-7)
- 位11-0:数据块编号或类似于“P-0-150”的字符串。
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –type -t <type> : 参数数据类型;
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.15 ethercat soe_write
该命令行用以向指定从站 SOE IDN 写入一个参数值。
@:~$ ethercat soe_write --help
ethercat soe_write [OPTIONS] <IDN> <VALUE>
ethercat soe_write [OPTIONS] <DRIVE> <IDN> <VALUE>
Write an SoE IDN to a slave.
This command requires a single slave to be selected.
Arguments:
DRIVE is the drive number (0 - 7). If omitted, 0 is assumed.
IDN is the IDN and must be either an unsigned
16 bit number acc. to IEC 61800-7-204:
Bit 15: (0) Standard data, (1) Product data
Bit 14 - 12: Parameter set (0 - 7)
Bit 11 - 0: Data block number
or a string like 'P-0-150'.
VALUE is the value to write (see below).
The VALUE argument is interpreted as the given data type
(--type is mandatory) and written to the selected slave.
These are valid data types to use with
the --type option:
bool,
int8, int16, int32, int64,
uint8, uint16, uint32, uint64,
float, double,
string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
sm8, sm16, sm32, sm64
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
--type -t <type> Data type (see above).
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
此命令要求必须指定单个从属设备。
必选参数介绍:
- DRIVE: 是驱动器编号(0-7)。如果省略,则假定为0。
- IDN:必须是无符号的符合IEC 61800-7-2004的16位数字。
- 位15:(0)标准数据,(1)产品数据
- 位14-12:参数集(0-7)
- 位11-0:数据块编号或类似于“P-0-150”的字符串。
- VALUE:要写入的数据。
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –type -t <type> : 参数数据类型;
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.16 ethercat foe_read
通过FOE读取从站的文件。
@:~$ ethercat foe_read --help
ethercat foe_read [OPTIONS] <SOURCEFILE> [<PASSWORD>]
Read a file from a slave via FoE.
This command requires a single slave to be selected.
Arguments:
SOURCEFILE is the name of the source file on the slave.
PASSWORD is the numeric password defined by the vendor.
Command-specific options:
--output-file -o <file> Local target filename. If
'-' (default), data are
printed to stdout.
--alias -a <alias>
--position -p <pos> Slave selection. See the help
of the 'slaves' command.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
此命令要求必须指定单个从属设备。
必选参数介绍:
- SOURCEFILE:为从站中的源文件名字;
- PASSWORD:厂家定义的数字密码;
可选参数介绍:
- –output -file -o :为读取数据的存储文件,缺省的话数据将会输出到终端;
- –alias:匹配从站的别名;
- –position:匹配从站的绝对位置;
2.17 ethercat foe_write
@:~$ ethercat foe_write --help
ethercat foe_write [OPTIONS] <FILENAME> [<PASSWORD>]
Store a file on a slave via FoE.
This command requires a single slave to be selected.
Arguments:
FILENAME can either be a path to a file, or '-'. In
the latter case, data are read from stdin and
the --output-file option has to be specified.
PASSWORD is the numeric password defined by the vendor.
Command-specific options:
--output-file -o <file> Target filename on the slave.
If the FILENAME argument is
'-', this is mandatory.
Otherwise, the basename() of
FILENAME is used by default.
--alias -a <alias>
--position -p <pos> Slave selection. See the help
of the 'slaves' command.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
此命令要求必须指定单个从属设备。
必选参数介绍:
- FILENAME:为要发送的文件(指定路径+文件名),也可以为"-",表示从标准输入中读取文件;
- PASSWORD:厂家定义的数字密码;
可选参数介绍:
- –output -file -o :为从站存储的目标文件名,假如不指定名字,则为主站发送 FILENAME 的去掉路径的名字;
- –alias:匹配从站的别名;
- –position:匹配从站的绝对位置;
2.18 ethercat reg_read
获取对应从站寄存器的内容。
《工业以太网现场总线 EtherCAT 驱动程序设计及应用》里面的<3.1.2 ESC 存储空间> 提到 ESC 芯片具有 64KB 的DPRAM 地址空间,前 4kB (0x0000 ~ 0x0FFFF) 的空间为寄存器空间。0x1000~0xFFFF 的地址空间为过程数据存储空间。
@:~$ ethercat reg_read --help
ethercat reg_read [OPTIONS] <ADDRESS> [SIZE]
Output a slave's register contents.
This command requires a single slave to be selected.
Arguments:
ADDRESS is the register address. Must
be an unsigned 16 bit number.
SIZE is the number of bytes to read and must also be
an unsigned 16 bit number. ADDRESS plus SIZE
may not exceed 64k. The size is ignored (and
can be omitted), if a selected data type
implies a size.
These are valid data types to use with
the --type option:
bool,
int8, int16, int32, int64,
uint8, uint16, uint32, uint64,
float, double,
string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
sm8, sm16, sm32, sm64
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
--type -t <type> Data type (see above).
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
此命令要求必须指定单个从属设备。
必选参数介绍:
- ADDRESS:16位无符整型的寄存器地址;
- SIZE:要读取的对应寄存器字节数(16位无符号值);[SIZE] + ADDRESS不能超过64K,假如type参数隐含要读取的字节数,则可以忽略掉[SIZE]参数;
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –type -t <type> : 要读取的参数数据类型;
例子:
读取从站的 SM 通道数目。
@:~$ ethercat reg_read -a 0 -p 0 -t uint8 0x0005
0x08 8
读取从站的 RAM 容量,过程数据存储区容量,以 KByte 为单位。当前驱动器的容量为 8 KB。
@:~$ ethercat reg_read -a 0 -p 0 -t uint8 0x0006
0x08 8
读取从站的端口配置,当前值为 0f,表示支持 MII 的 Port0 和 Port1 两个端口。
@:~$ ethercat reg_read -a 0 -p 0 -t uint8 0x0007
0x0f 15
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.19 ethercat reg_write
设定对应从站寄存器的内容。
@:~$ ethercat reg_write --help
ethercat reg_write [OPTIONS] <OFFSET> <DATA>
Write data to a slave's registers.
This command requires a single slave to be selected.
Arguments:
ADDRESS is the register address to write to.
DATA depends on whether a datatype was specified
with the --type option: If not, DATA must be
either a path to a file with data to write,
or '-', which means, that data are read from
stdin. If a datatype was specified, VALUE is
interpreted respective to the given type.
These are valid data types to use with
the --type option:
bool,
int8, int16, int32, int64,
uint8, uint16, uint32, uint64,
float, double,
string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
sm8, sm16, sm32, sm64
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
--type -t <type> Data type (see above).
--emergency -e Send as emergency request.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
此命令要求必须指定单个从属设备。
必选参数介绍:
- ADDRESS:16位无符整型的寄存器地址;
- DATA:要写入寄存器的数据;假如制定了"ype"数据类型,那么"DATA"根据指定的数据类型对数据进行解析;假如未指定"type"数据类型,则"DATA"可以为指定的文件或将"DATA"设置为"-",表示从标准输入中获得数据;
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –type -t <type> : 要设置的参数数据类型;
- –emergency -e:以紧急的方式请求写入文件;
例子:
向从站5的寄存器0x092c(代表系统时间偏移)写入数据200。
sudo ethercat reg_write -p 5 -t sm32 0x092c 200
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.20 ethercat sii_read
该命令行用以读取从站的SII内容。
@:~$ ethercat sii_read --help
ethercat sii_read [OPTIONS]
Output a slave's SII contents.
This command requires a single slave to be selected.
Without the --verbose option, binary SII contents are
output.
With the --verbose option given, a textual representation
of the data is output, that is separated by SII category
names.
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
--verbose -v Output textual data with
category names.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
此命令要求必须指定单个从属设备。
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –verbose -v : 分类显示数据文本内容;
例子:
显示从站sii的内容。
@:~$ ethercat sii_read -a 0 -p 0
<d���ff �
$ 2DM522-EC 2DM Slave
2DM SlavesDSynchron
TxPdoMapping errorcode
digtal_inputsactual_velocityfollow_err_actualTorque_actual_value_probe_pos1_pos_value�Touch_probe_pos1_neg_value�Touch_probe_pos2_pos_value�Touch_probe_pos2_neg_value
RxPdoMapping
target_torqueprofile_velocityprofile_accelerationprofile_deceleration controlwordop_modetarget_positionTouch_probe_functionphysical_outputbit_masktargrt_velocity
home_offset
home_methodhome_switch_velocityhome_zero_velocityhome_acceleration/(�)�&"d 2L�
?`Aa` d`
�`
�`
�` �` �` ��a` l` �` ��?`w`��3l@``z` �`�` �`� �@``�``�` �`� �q`�` �` �` �` �`� �|` �`�`" �`# �`$ <��@:~$
以分类数据文本形式显示sii的内容。
@:~$ ethercat sii_read -a 0 -p 0 -v
SII Area:
00 3c 00 00 64 00 00 00 00 00 00 00 00 00 91 00
88 88 66 66 03 03 19 20 20 06 19 20 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 10 80 00 00 12 00 01 04 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 0f 00 01 00
SII Category 0x000a (STRINGS), 286 words
24 09 32 44 4d 35 32 32 2d 45 43 09 32 44 4d 20
53 6c 61 76 65 0a 32 44 4d 20 53 6c 61 76 65 73
02 44 43 08 53 79 6e 63 68 72 6f 6e 0c 54 78 50
64 6f 4d 61 70 70 69 6e 67 09 65 72 72 6f 72 63
6f 64 65 0a 73 74 61 74 75 73 77 6f 72 64 0f 6f
70 5f 6d 6f 64 65 5f 64 69 73 70 6c 61 79 0f 61
63 74 75 61 6c 5f 70 6f 73 69 74 69 6f 6e 12 54
6f 75 63 68 5f 70 72 6f 62 65 5f 73 74 61 74 75
73 1a 54 6f 75 63 68 5f 70 72 6f 62 65 5f 70 6f
73 31 5f 70 6f 73 5f 76 61 6c 75 65 1a 54 6f 75
63 68 5f 70 72 6f 62 65 5f 70 6f 73 31 5f 6e 65
67 5f 76 61 6c 75 65 1a 54 6f 75 63 68 5f 70 72
6f 62 65 5f 70 6f 73 32 5f 70 6f 73 5f 76 61 6c
75 65 1a 54 6f 75 63 68 5f 70 72 6f 62 65 5f 70
6f 73 32 5f 6e 65 67 5f 76 61 6c 75 65 0d 64 69
67 74 61 6c 5f 69 6e 70 75 74 73 0f 61 63 74 75
61 6c 5f 76 65 6c 6f 63 69 74 79 11 66 6f 6c 6c
6f 77 5f 65 72 72 5f 61 63 74 75 61 6c 13 54 6f
72 71 75 65 5f 61 63 74 75 61 6c 5f 76 61 6c 75
65 0c 52 78 50 64 6f 4d 61 70 70 69 6e 67 0b 63
6f 6e 74 72 6f 6c 77 6f 72 64 07 6f 70 5f 6d 6f
64 65 0f 74 61 72 67 65 74 5f 70 6f 73 69 74 69
6f 6e 14 54 6f 75 63 68 5f 70 72 6f 62 65 5f 66
75 6e 63 74 69 6f 6e 10 70 68 79 73 69 63 61 6c
5f 6f 75 74 70 75 74 73 08 62 69 74 5f 6d 61 73
6b 0f 74 61 72 67 72 74 5f 76 65 6c 6f 63 69 74
79 0d 74 61 72 67 65 74 5f 74 6f 72 71 75 65 10
70 72 6f 66 69 6c 65 5f 76 65 6c 6f 63 69 74 79
14 70 72 6f 66 69 6c 65 5f 61 63 63 65 6c 65 72
61 74 69 6f 6e 14 70 72 6f 66 69 6c 65 5f 64 65
63 65 6c 65 72 61 74 69 6f 6e 0b 68 6f 6d 65 5f
6f 66 66 73 65 74 0b 68 6f 6d 65 5f 6d 65 74 68
6f 64 14 68 6f 6d 65 5f 73 77 69 74 63 68 5f 76
65 6c 6f 63 69 74 79 12 68 6f 6d 65 5f 7a 65 72
6f 5f 76 65 6c 6f 63 69 74 79 11 68 6f 6d 65 5f
61 63 63 65 6c 65 72 61 74 69 6f 6e
SII Category 0x001e (General), 16 words
02 00 01 01 01 2f 00 00 00 01 00 04 00 00 03 00
11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SII Category 0x0028 (FMMU), 2 words
01 02 03 ff
SII Category 0x0029 (SyncM), 16 words
00 10 80 00 26 00 01 01 00 12 00 01 22 00 01 02
00 14 11 00 64 00 01 03 00 16 1f 00 20 00 01 04
SII Category 0x0032 (TXPDO), 76 words
00 1a 0a 03 00 06 01 00 3f 60 00 07 06 10 00 00
41 60 00 08 06 10 00 00 61 60 00 09 02 08 00 00
64 60 00 0a 04 20 00 00 b9 60 00 0b 06 10 00 00
ba 60 00 0c 04 20 00 00 bb 60 00 0d 04 20 00 00
bc 60 00 0e 04 20 00 00 bd 60 00 0f 04 20 00 00
fd 60 00 10 07 20 00 00 01 1a 03 ff 00 06 00 00
61 60 00 09 02 08 00 00 6c 60 00 11 04 20 00 00
f4 60 00 12 04 20 00 00 02 1a 02 ff 00 06 00 00
3f 60 00 07 06 10 00 00 77 60 00 13 03 10 00 00
03 1a 00 ff 00 06 00 00
SII Category 0x0033 (RXPDO), 108 words
00 16 06 02 00 14 01 00 40 60 00 15 06 10 00 00
60 60 00 16 02 08 00 00 7a 60 00 17 04 20 00 00
b8 60 00 18 06 10 00 00 fe 60 01 19 07 20 00 00
fe 60 02 1a 07 20 00 00 01 16 06 ff 00 14 00 00
40 60 00 15 06 10 00 00 60 60 00 16 02 08 00 00
ff 60 00 1b 04 20 00 00 b8 60 00 18 06 10 00 00
fe 60 01 19 07 20 00 00 fe 60 02 1a 07 20 00 00
02 16 06 ff 00 14 00 00 71 60 00 1c 03 10 00 00
81 60 00 1d 07 20 00 00 83 60 00 1e 07 20 00 00
84 60 00 1f 07 20 00 00 fe 60 01 19 07 20 00 00
fe 60 02 1a 07 20 00 00 03 16 05 ff 00 14 00 00
7c 60 00 20 04 20 00 00 98 60 00 21 02 08 00 00
99 60 01 22 04 20 00 00 99 60 02 23 04 20 00 00
9a 60 00 24 07 20 00 00
SII Category 0x003c (DC), 24 words
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 05 00 00 00 00 00
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.21 ethercat sii_write
该命令行用以设置从站的SII内容。
@:~$ ethercat sii_write --help
ethercat sii_write [OPTIONS] <FILENAME>
Write SII contents to a slave.
This command requires a single slave to be selected.
The file contents are checked for validity and integrity.
These checks can be overridden with the --force option.
Arguments:
FILENAME must be a path to a file that contains a
positive number of words. If it is '-',
data are read from stdin.
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
--force -f Override validity checks.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
此命令要求必须指定单个从属设备。
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –verbose -v : 分类显示数据文本内容;
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.22 ethercat data
该命令行以二进制的形式显示所有过程数据。
ethercat data [OPTIONS]
Output binary domain process data.
Data of multiple domains are concatenated.
Command-specific options:
--domain -d <index> Positive numerical domain index.
If omitted, data of all domains
are output.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
可选参数介绍:
- –domain -d <index>:域的索引值,假如不填写参数则显示所有过程数据;
@:~$ ethercat data
7
注意:必须运行应用程序才可以使用。
2.23 ethercat config
该命令行用来显示从站的配置。
@:~$ ethercat config --help
ethercat config [OPTIONS]
Show slave configurations.
Without the --verbose option, slave configurations are
output one-per-line. Example:
1001:0 0x0000003b/0x02010000 3 OP
| | | |
| | | \- Application-layer
| | | state of the attached
| | | slave, or '-', if no
| | | slave is attached.
| | \- Absolute decimal ring
| | position of the attached
| | slave, or '-' if none
| | attached.
| \- Expected vendor ID and product code (both
| hexadecimal).
\- Alias address and relative position (both decimal).
With the --verbose option given, the configured PDOs and
SDOs are output in addition.
Configuration selection:
Slave configurations can be selected with
the --alias and --position parameters as follows:
1) If neither the --alias nor the --position option
is given, all slave configurations are displayed.
2) If only the --position option is given, an alias
of zero is assumed (see 4)).
3) If only the --alias option is given, all slave
configurations with the given alias address
are displayed.
4) If both the --alias and the --position option are
given, the selection can match a single
configuration, that is displayed, if it exists.
Command-specific options:
--alias -a <alias> Configuration alias (see above).
--position -p <pos> Relative position (see above).
--verbose -v Show detailed configurations.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
- –verbose -v : 显示详细的配置信息;
例子:
显示从站的配置信息和状态。
@:~$ ethercat config
0:0 0x66668888/0x20190303 0 OP
下面这个例子采用 -v 参数用来显示更加详细的配置信息。
@:~$ ethercat config -a 0 -p 0 -v
Alias: 0
Position: 0
Vendor Id: 0x66668888
Product code: 0x20190303
Attached slave: 0 (OP)
Watchdog divider: (Default)
Watchdog intervals: (Default)
SM2, Dir: Output, Watchdog: Enable
PDO 0x1600
PDO entry 0x6040:00, 16 bit
PDO entry 0x607b:00, 8 bit
PDO entry 0x6060:00, 8 bit
PDO entry 0x607a:00, 32 bit
SM3, Dir: Input, Watchdog: Enable
PDO 0x1a00
PDO entry 0x6041:00, 16 bit
PDO entry 0x606c:00, 32 bit
PDO entry 0x6064:00, 32 bit
SDO configuration:
None.
IDN configuration:
None.
Feature flags:
None.
DC configuration:
AssignActivate: 0x0300
Cycle [ns] Shift [ns]
SYNC0 1000000 0
SYNC1 0 0
注意:必须运行应用程序才可以使用。
2.24 ethercat domains
该命令行用来显示域的信息。
@:~$ ethercat domains --help
ethercat domains [OPTIONS]
Show configured domains.
Without the --verbose option, the domains are displayed
one-per-line. Example:
Domain0: LogBaseAddr 0x00000000, Size 6, WorkingCounter 0/1
The domain's base address for the logical datagram
(LRD/LWR/LRW) is displayed followed by the domain's
process data size in byte. The last values are the current
datagram working counter sum and the expected working
counter sum. If the values are equal, all PDOs were
exchanged during the last cycle.
If the --verbose option is given, the participating slave
configurations/FMMUs and the current process data are
additionally displayed:
Domain1: LogBaseAddr 0x00000006, Size 6, WorkingCounter 0/1
SlaveConfig 1001:0, SM3 ( Input), LogAddr 0x00000006, Size 6
00 00 00 00 00 00
The process data are displayed as hexadecimal bytes.
Command-specific options:
--domain -d <index> Positive numerical domain index.
If omitted, all domains are
displayed.
--verbose -v Show FMMUs and process data
in addition.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
可选参数介绍:
- –domain -d <index>:域的索引号,为正整数。如果没有填写该值则显示所有的域;
- –verbose -v : 显示域的详细信息(FMMU和过程数据的信息);
例子:
@:~$ ethercat domains
Domain0: LogBaseAddr 0x00000000, Size 18, WorkingCounter 3/3
结果说明:
- LogBaseAddr:逻辑寻址的逻辑基地址;
- Size:域交换数据的字节数;
- WorkingCounter:第一个数字是WKC的当前值,第二个数字是WKC的期望值;
设置 -v 参数后显示的结果。
@:~$ ethercat domains -v
Domain0: LogBaseAddr 0x00000000, Size 18, WorkingCounter 3/3
SlaveConfig 0:0, SM2 (Output), LogAddr 0x00000000, Size 8
1f 00 00 08 0a 00 00 00
SlaveConfig 0:0, SM3 ( Input), LogAddr 0x00000008, Size 10
37 02 00 00 00 00 00 00 00 00
结果说明:
- SlaveConfig:从机配置信息,主要包含别名和地址(绝对地址或相对地址);
- SM2:同步管理器2;
- LogAddr:FMMU映射的地址;
- Size:映射地址的大小;
- 数据位:十六进制显示的过程数据;
注意:必须运行应用程序才可以使用。
2.25 ethercat crc
该命令行用以 CRC 错误诊断。
@:~$ ethercat crc --help
ethercat crc
ethercat crc reset
CRC error register diagnosis.
CRC - CRC Error Counter 0x300, 0x302, 0x304, 0x306
PHY - Physical Interface Error Counter 0x301, 0x303, 0x305, 0x307
FWD - Forwarded RX Error Counter 0x308, 0x309, 0x30a, 0x30b
NXT - Next slave
例子:
@:~$ ethercat crc
|Port 0 |Port 1 |Port 2 |Port 3 |
|CRC PHY FWD NXT|CRC PHY FWD NXT|CRC PHY FWD NXT|CRC PHY FWD NXT|
0| 0 0 0 | | | |2DM522-EC
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.26 ethercat rescan
该命令行用以重新扫描总线上的从站信息。
@:~$ ethercat rescan --help
ethercat rescan
Rescan the bus.
Command a bus rescan. Gathered slave information will be
forgotten and slaves will be read in again.
例子:
该命令执行后不会有任何信息输出。
@:~$ ethercat rescan
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
2.27 ethercat cstruct
该命令行生成的PDO信息可以直接被应用层的ecrt_slave_config_pdos()函数调用。
@:~$ ethercat cstruct --help
ethercat cstruct [OPTIONS]
Generate slave PDO information in C language.
The output C code can be used directly with the
ecrt_slave_config_pdos() function of the application
interface.
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
例子:
@:~$ ethercat cstruct -a 0 -p 0
/* Master 0, Slave 0, "2DM522-EC"
* Vendor ID: 0x66668888
* Product code: 0x20190303
* Revision number: 0x20190620
*/
ec_pdo_entry_info_t slave_0_pdo_entries[] = {
{0x6040, 0x00, 16}, /* controlword */
{0x6060, 0x00, 8}, /* op_mode */
{0x607a, 0x00, 32}, /* target_position */
{0x60b8, 0x00, 16}, /* Touch_probe_function */
{0x60fe, 0x01, 32}, /* physical_outputs */
{0x60fe, 0x02, 32}, /* bit_mask */
{0x603f, 0x00, 16}, /* errorcode */
{0x6041, 0x00, 16}, /* statusword */
{0x6061, 0x00, 8}, /* op_mode_display */
{0x6064, 0x00, 32}, /* actual_position */
{0x60b9, 0x00, 16}, /* Touch_probe_status */
{0x60ba, 0x00, 32}, /* Touch_probe_pos1_pos_value */
{0x60bb, 0x00, 32}, /* Touch_probe_pos1_neg_value */
{0x60bc, 0x00, 32}, /* Touch_probe_pos2_pos_value */
{0x60bd, 0x00, 32}, /* Touch_probe_pos2_neg_value */
{0x60fd, 0x00, 32}, /* digtal_inputs */
};
ec_pdo_info_t slave_0_pdos[] = {
{0x1600, 6, slave_0_pdo_entries + 0}, /* RxPdoMapping */
{0x1a00, 10, slave_0_pdo_entries + 6}, /* TxPdoMapping */
};
ec_sync_info_t slave_0_syncs[] = {
{0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
{1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
{2, EC_DIR_OUTPUT, 1, slave_0_pdos + 0, EC_WD_ENABLE},
{3, EC_DIR_INPUT, 1, slave_0_pdos + 1, EC_WD_DISABLE},
{0xff}
};
注意:必须运行应用程序才可以使用。
sudo ethercat cstruct -a 0
记下电机VenderID,ProductID,PDO信息
2.28 ethercat eoe
该命令行用以显示EOE的统计信息,包括主站的发送率和接收率(Byte/s)。
@:~$ ethercat eoe --help
ethercat eoe
Display Ethernet over EtherCAT statictics.
The TxRate and RxRate are displayed in Byte/s.
注意:必须运行应用程序才可以使用。
2.29 ethercat ip
设置 EOE 的 IP 参数地址。
@:~$ ethercat ip --help
ethercat ip [OPTIONS] <ARGS>
Set EoE IP parameters.
This command requires a single slave to be selected.
IP parameters can be appended as argument pairs:
addr <IPv4>[/prefix] IP address (optionally with
decimal subnet prefix)
link <MAC> Link-layer address (may contain
colons or hyphens)
default <IPv4> Default gateway
dns <IPv4> DNS server
name <hostname> Host name (max. 32 byte)
IPv4 adresses can be given either in dot notation or as
hostnames, which will be automatically resolved.
Command-specific options:
--alias -a <alias>
--position -p <pos> Slave selection. See the help of
the 'slaves' command.
Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
此命令要求必须指定单个从属设备。
必选参数介绍:
IP参数可以作为参数元组添加:
- addr <IPv4> [/prefix]: IP地址(可选十进制子网前缀);
- link <MAC>: 链路层地址(可能包含colons or hyphens);
- default <IPv4>: 默认网关;
- dns <IPv4>: dns服务器;
- name <hostname>: 主机名(最大32字节);
IPv4地址可以用点表示法,比如说"192.168.0.1"或主机名,该命令行将会自动解析。
可选参数介绍:
- –alias -a <alias>:匹配从站的别名;
- –position -p <pos>:匹配从站的绝对位置;
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
到了这里,关于EtherCAT IGH 命令行介绍的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!