发布时间:2025-12-09 16:13:39 浏览次数:4
在一开始学习 EtherCAT 的时候,可以直接编译 IGH,不需要一上来就去安装实时内核。因为编译 IGH 和安不安装实时内核没有什么关系,而且安装实时内核还比较麻烦。当我们只是有一两个电机或者IO模块来学习的时候,可以先不用去安装实时内核。
如果是在虚拟机中安装了IGH,那么为了能够扫描到从站,那么就需要在虚拟机中配置网络,利用桥接网络进行设置。这是因为虚拟机的网络地址是虚拟的IP,iP地址和实际PC上的是不一样的,所以必须固定和实际的PC的IP地址保持在同一个网段。
如果是使用的实体机,那么只要把PC 和 EtherCAT 从站用网线连接在一起就可以了,不需要单独设置IP地址,直接用DHCP也可以直接连接上。
因为我购买的电机是没有带编码器和刹车的,因此就不需要接步进驱动器上面的刹车信号。
如果要跑回零模式的话,那么就需要接步进驱动器上面的限位信号。
另外步进驱动器上面的IO接口都是已经固定好了作用的,用来接限位和原点传感器的。
EtherCAT 命令行在 《EtherCAT IGH 1.52.pdf》中的 <7.1 Command-line Tool> 也有很详细的一个介绍。在编译和安装IGH的时候,如果不修改默认的编译参数,那么就是会提供 EtherCAT 命令行工具的。
每个主站的实例都有生成一个字符设备,名字为:/dev/EtherCATx, 其中 x ∈ {0 . . . n}为主站实例的索引。
下面具体的介绍了一下各参数及命令的使用,其中 [ ] 中为必选参数,< >为可选参数。
该命令行会告诉用户当前支持哪些命令行指令参数,当前总共提供了 28 个命令行指令。
@:~$ ethercat --helpalias 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 mastersto 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 (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.Call 'ethercat <COMMAND> --help' for command-specific help.该命令行主要是用来创建 EtherCAT 从站的别名的。
ethercat alias [OPTIONS] <ALIAS>Write alias addresses.Arguments:ALIAS must be an unsigned 16 bit number. Zero meansremoving an alias address.If multiple slaves are selected, the --force optionis required.Command-specific options:--alias -a <alias>--position -p <pos> Slave selection. See the help ofthe 'slaves' command.--force -f Acknowledge writing aliases ofmultiple slaves.Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.可选参数介绍:
上面的-a 和 -p 参数后面很多的命令行都会用到。
例子:
sudo ethercat alias --position 0 0x3000解析:将在bus总线上对应的从站0的别名(默认为0)为0x3000;
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行用来显示主站和以太网设备信息。
ethercat master --helpethercat master [OPTIONS]Show master and Ethernet device information.Command-specific options:--master -m <indices> Master indices. A comma-separatedlist with ranges is supported.Example: 1,4,5,7-9. Default: - (all).Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.可选参数:
例子:
@:~$ ethercat masterMaster0Phase: IdleActive: noSlaves: 1Ethernet devices:Main: 98:29:a6:56:57:ce (attached)Link: UPTx frames: 5847Tx bytes: 534212Rx frames: 5846Rx bytes: 534152Tx errors: 0Tx frame rate [1/s]: 125 307 87Tx rate [KByte/s]: 7.3 27.4 7.8Rx frame rate [1/s]: 125 307 87Rx rate [KByte/s]: 7.3 27.4 7.8Common:Tx frames: 12089Tx bytes: 915900Rx frames: 6797Rx bytes: 598380Lost frames: 5292Tx frame rate [1/s]: 125 353 149Tx rate [KByte/s]: 7.3 30.3 11.5Rx frame rate [1/s]: 125 327 99Rx rate [KByte/s]: 7.3 28.7 8.6Loss rate [1/s]: 0 27 50Frame loss [%]: 0.0 7.5 33.4Distributed clocks:Reference clock: Slave 0DC reference time: 0Application time: 02000-01-01 00:00:00.000000000显示所有主机的设备信息(发送帧、接收帧、参考时钟、应用时间)。
后面的 Distributed clocks 只有在启动应用程序之后才会有相应的参数值。
当给定的主站参数无效的时候,会输处如下报错信息。
@:~$ ethercat master -m 1Failed to open master device /dev/EtherCAT1: No such file or directory注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
如果设置了最后的 -v 参数,则为每一个从站输出相应的描述。
该命令行中从站的选择是通过参数 -a 和 -p 来选择的。
这边关于从站的别名配置以及匹配的方法介绍,可以参照 《EtherCAT IGH 1.52.pdf》中的 < 3.1.1 Slave Configuration > 介绍。
或者阅读下面这两个文章,这两个文章介绍的也是很详细的。
Ethercat解析(十)之从站配置
IgH Master 1.5.2 Documentation 中文版 2.1从站的配置
可选参数介绍:
例子:
@:~$ ethercat slaves0 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: MainState: OPFlag: +Identity:Vendor Id: 0x66668888Product code: 0x20190303Revision number: 0x20190620Serial number: 0x00000000DL information:FMMU bit operation: noDistributed clocks: yes, 64 bitDC system time transmission delay: 0 nsPort Type Link Loop Signal NextSlave RxTime [ns] Diff [ns] NextDc [ns]0 MII up open yes - 3810966012 0 01 MII down closed no - - - -2 N/A down closed no - - - -3 N/A down closed no - - - -Mailboxes:Bootstrap RX: 0x0000/0, TX: 0x0000/0Standard RX: 0x1000/128, TX: 0x1200/256Supported protocols: CoEGeneral:Group: 2DM SlaveImage name: Order number: 2DM522-ECDevice name: 2DM522-ECCoE details:Enable SDO: yesEnable SDO Info: yesEnable PDO Assign: yesEnable PDO Configuration: yesEnable Upload at startup: noEnable SDO complete access: yesFlags:Enable SafeOp: noEnable notLRW: noCurrent consumption: 0 mA注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行用来请求从站转换状态。
@:~$ ethercat states --helpethercat 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 ofthe 'slaves' command.Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.必选参数介绍:
可选参数介绍:
例子:
sudo ethercat states -p 0 OP用于将从站0的状态切换为OP;
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行用来输出总线上连接的所有从站设备的总线拓扑图。
ethercat graph [OPTIONS]ethercat graph [OPTIONS] <INFO>Output the bus topology as a graph.The bus is output in DOT language (seehttp://www.graphviz.org/doc/info/lang.html), which canbe processed with the tools from the Graphvizpackage. Example:ethercat graph | dot -Tsvg > bus.svgSee 'man dot' for more information.Additional information at edges and nodes is selected viathe first argument:DC - DC timingCRC - CRC error register information例子:
以文本的信息输出从站连接拓扑图。
@:~$ ethercat graph/* EtherCAT bus graph. Generated by 'ethercat graph'. */strict graph bus {rankdir="LR"ranksep=0.8nodesep=0.8node [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注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
可选参数介绍:
例子:
@:~$ 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>注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令用来设置主站的调试级别。
@:~$ ethercat debug --helpethercat 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, or2 for printing all frame contents (use with caution!).Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.在实际的调试过程中的时候,一般会和sudo dmesg -w这个命令一起配合使用。
该命令后终端不会有任何的信息输出,但是当你在另外一个终端输入sudo dmesg -w,你就会发现在这个终端这边输出了一些 ethercat 的 debug 信息,前提是你设置的参数是 1 或者 2。
参数介绍:
例子:
sudo ethercat debug 1注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行用来输出当前主站的版本的。
@:~$ ethercat version --helpethercat version [OPTIONS]Show version information.例子:
@:~$ sudo ethercat versionIGH EtherCAT master 1.6.0-rc1 unknow注意:不连接从站也能使用此命令,不运行应用程序也可以使用。
该命令行用来输出当前驱动器支持的所有的SDO信息。
@:~$ ethercat sdos --helpethercat 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 (bothhexadecimal) followed by the access rights (seebelow), the data type, the length in bit, and thedescription. 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 readablein the corresponding state, an 'w' means writable,respectively. If a right is not granted, a dash '-' isshown.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 ofthe 'slaves' command.--quiet -q Only output SDOs (without theSDO entries).Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.该命令行中如果采用采用的默认的参数,那么会输出一下两层信息:
1、SDO 的索引和名字信息
SDO 0x6040, “controlword”
2、显示 SDO 的内容,包括各个子索引的参数含义、访问权限等
0x6040:00, rwrwrw, uint16, 16 bit, “controlword”"
可选参数介绍:
例子:
@:~$ ethercat sdosSDO 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 -qSDO 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"..............该命令行用来显示出同步管理器的参数和PDO分配和映射信息。
@:~$ ethercat pdos --helpethercat pdos [OPTIONS]List Sync managers, PDO assignment and mapping.For the default skin (see --skin option) the informationis displayed in three layers, which areindented accordingly:1) Sync managers - Contains the sync manager informationfrom the SII: Index, physical start address, defaultsize, control register and enable word. Example:SM3: PhysAddr 0x1100, DefaultSize 0, ControlRegister 0x20, Enable 12) Assigned PDOs - PDO direction, hexadecimal index andthe 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 (bothhexadecimal), the length in bit and the description, ifavailable. Example:PDO entry 0x3101:01, 8 bit, "Status"Note, that the displayed PDO assignment and PDO mappinginformation can either originate from the SII or from theCoE communication area.The "etherlab" skin outputs a template configurationfor EtherLab's generic EtherCAT slave block.Command-specific options:--alias -a <alias>--position -p <pos> Slave selection. See the help ofthe 'slaves' command.--skin -s <skin> Choose output skin. Possible values are"default" and "etherlab".Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.该命令行中如果采用采用的默认的参数,那么会输出一下三层信息:
1、同步管理器信息
SM3: PhysAddr 0x1600, DefaultSize 31, ControlRegister 0x20, Enable 1
2、显示PDO方向(TX 或者 RX),索引值,PDO名字
TxPDO 0x1a00 “TxPdoMapping”
3、显示PDO条目的索引和子索引(都是以16进制的形式现实的),显示位宽和描述
PDO entry 0x6041:00, 16 bit, “statusword”
* 0x6041:00 : 表示PDO的索引和子索引,当前表示为 状态字 的索引和子索引地址; * 16bit:表示该条目的位宽,是一个 16 bit 的数据; * "statusword":表示该位的描述,表示这个PDO 描述的是状态字;可选参数介绍:
例子:
@:~$ ethercat pdosSM0: PhysAddr 0x1000, DefaultSize 128, ControlRegister 0x26, Enable 1SM1: PhysAddr 0x1200, DefaultSize 256, ControlRegister 0x22, Enable 1SM2: PhysAddr 0x1400, DefaultSize 17, ControlRegister 0x64, Enable 1RxPDO 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 1TxPDO 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 configurationrv.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 configurationrv.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注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行用以读取指定从站相应PDO设定的参数值。
@:~$ ethercat uploadethercat 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 SDOdictionary by default. It can be overridden with the--type option. If the slave does not support the SDOinformation service or the SDO is not in the dictionary,the --type option is mandatory.These are valid data types to use withthe --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, sm64Arguments:INDEX is the SDO index and must be an unsigned16 bit number.SUBINDEX is the SDO entry subindex and must be anunsigned 8 bit number.Command-specific options:--alias -a <alias>--position -p <pos> Slave selection. See the help ofthe 'slaves' command.--type -t <type> SDO entry data type (see above).Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.必选参数介绍:
可选参数介绍:
例子:
@:~$ ethercat upload 0x2001 0x00000x03e8 1000解析:读取从站0中索引号为 0x2001(16位),子索引号为00(8位)的SDO条目。返回的参数值为 1000。
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行用以向指定的从站 SDO 中的子索引中写入相应的参数值。
@:~$ ethercat uploadethercat 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 SDOdictionary by default. It can be overridden with the--type option. If the slave does not support the SDOinformation service or the SDO is not in the dictionary,the --type option is mandatory.The second call (without <SUBINDEX>) uses the completeaccess method.These are valid data types to use withthe --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, sm64Arguments:INDEX is the SDO index and must be an unsigned16 bit number.SUBINDEX is the SDO entry subindex and must be anunsigned 8 bit number.VALUE is the value to download and must correspondto 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 ofthe 'slaves' command.--type -t <type> SDO entry data type (see above).Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.必选参数介绍:
可选参数介绍:
例子:
向从站0的索引号为0x6060(16位),子索引号为00(8位)的地址写入参数值"0x08"。
@:~$ sudo ethercat download -t int16 -p 0 0x6060 00 08有的SDO 可能是由于厂家的限制,不能写入参数。
@:~$ sudo ethercat download -t uint16 0x2008 0x0000 0x000fSDO transfer aborted with code 0x08000021: Data cannot be transferred or stored to the application because of local control注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行用以读取从站的 IDN 参数值。
@:~$ ethercat soe_read --helpethercat 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 unsigned16 bit number acc. to IEC 61800-7-204:Bit 15: (0) Standard data, (1) Product dataBit 14 - 12: Parameter set (0 - 7)Bit 11 - 0: Data block numberor a string like 'P-0-150'.Data of the given IDN are read and displayed according tothe given datatype, or as raw hex bytes.These are valid data types to use withthe --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, sm64Command-specific options:--alias -a <alias>--position -p <pos> Slave selection. See the help ofthe 'slaves' command.--type -t <type> Data type (see above).Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.此命令要求必须指定单个从属设备。
必选参数介绍:
可选参数介绍:
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行用以向指定从站 SOE IDN 写入一个参数值。
@:~$ ethercat soe_write --helpethercat 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 unsigned16 bit number acc. to IEC 61800-7-204:Bit 15: (0) Standard data, (1) Product dataBit 14 - 12: Parameter set (0 - 7)Bit 11 - 0: Data block numberor 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 withthe --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, sm64Command-specific options:--alias -a <alias>--position -p <pos> Slave selection. See the help ofthe 'slaves' command.--type -t <type> Data type (see above).Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.此命令要求必须指定单个从属设备。
必选参数介绍:
可选参数介绍:
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
通过FOE读取从站的文件。
@:~$ ethercat foe_read --helpethercat 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 areprinted to stdout.--alias -a <alias> --position -p <pos> Slave selection. See the helpof the 'slaves' command.Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.此命令要求必须指定单个从属设备。
必选参数介绍:
可选参数介绍:
此命令要求必须指定单个从属设备。
必选参数介绍:
可选参数介绍:
获取对应从站寄存器的内容。
《工业以太网现场总线 EtherCAT 驱动程序设计及应用》里面的<3.1.2 ESC 存储空间> 提到 ESC 芯片具有 64KB 的DPRAM 地址空间,前 4kB (0x0000 ~ 0x0FFFF) 的空间为寄存器空间。0x1000~0xFFFF 的地址空间为过程数据存储空间。
此命令要求必须指定单个从属设备。
必选参数介绍:
可选参数介绍:
例子:
读取从站的 SM 通道数目。
@:~$ ethercat reg_read -a 0 -p 0 -t uint8 0x00050x08 8读取从站的 RAM 容量,过程数据存储区容量,以 KByte 为单位。当前驱动器的容量为 8 KB。
@:~$ ethercat reg_read -a 0 -p 0 -t uint8 0x00060x08 8读取从站的端口配置,当前值为 0f,表示支持 MII 的 Port0 和 Port1 两个端口。
@:~$ ethercat reg_read -a 0 -p 0 -t uint8 0x00070x0f 15注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
设定对应从站寄存器的内容。
@:~$ ethercat reg_write --helpethercat 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 specifiedwith the --type option: If not, DATA must beeither a path to a file with data to write,or '-', which means, that data are read fromstdin. If a datatype was specified, VALUE isinterpreted respective to the given type.These are valid data types to use withthe --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, sm64Command-specific options:--alias -a <alias>--position -p <pos> Slave selection. See the help ofthe 'slaves' command.--type -t <type> Data type (see above).--emergency -e Send as emergency request.Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.此命令要求必须指定单个从属设备。
必选参数介绍:
可选参数介绍:
例子:
向从站5的寄存器0x092c(代表系统时间偏移)写入数据200。
sudo ethercat reg_write -p 5 -t sm32 0x092c 200注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行用以读取从站的SII内容。
@:~$ ethercat sii_read --helpethercat 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 areoutput.With the --verbose option given, a textual representationof the data is output, that is separated by SII categorynames.Command-specific options:--alias -a <alias>--position -p <pos> Slave selection. See the help ofthe 'slaves' command.--verbose -v Output textual data withcategory names.Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.此命令要求必须指定单个从属设备。
可选参数介绍:
例子:
显示从站sii的内容。
@:~$ ethercat sii_read -a 0 -p 0<d���ff �$2DM522-EC2DM Slave2DM SlavesDSynchronTxPdoMappingerrorcodedigtal_inputsactual_velocityfollow_err_actualTorque_actual_value_probe_pos1_pos_value�Touch_probe_pos1_neg_value�Touch_probe_pos2_pos_value�Touch_probe_pos2_neg_valueRxPdoMappingtarget_torqueprofile_velocityprofile_accelerationprofile_deceleration controlwordop_modetarget_positionTouch_probe_functionphysical_outputbit_masktargrt_velocityhome_offsethome_methodhome_switch_velocityhome_zero_velocityhome_acceleration/(�)�&"d 2L�?`Aa` d`�`�`�` �` �` ��a` l` �` ��?`w`��3l@``z` �`�` �`� �@``�``�` �`� �q`�` �` �` �` �`� �|` �`�`" �`# �`$ <��@:~$以分类数据文本形式显示sii的内容。
@:~$ ethercat sii_read -a 0 -p 0 -vSII Area:00 3c 00 00 64 00 00 00 00 00 00 00 00 00 91 0088 88 66 66 03 03 19 20 20 06 19 20 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 10 80 00 00 12 00 01 04 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 0f 00 01 00SII Category 0x000a (STRINGS), 286 words24 09 32 44 4d 35 32 32 2d 45 43 09 32 44 4d 2053 6c 61 76 65 0a 32 44 4d 20 53 6c 61 76 65 7302 44 43 08 53 79 6e 63 68 72 6f 6e 0c 54 78 5064 6f 4d 61 70 70 69 6e 67 09 65 72 72 6f 72 636f 64 65 0a 73 74 61 74 75 73 77 6f 72 64 0f 6f70 5f 6d 6f 64 65 5f 64 69 73 70 6c 61 79 0f 6163 74 75 61 6c 5f 70 6f 73 69 74 69 6f 6e 12 546f 75 63 68 5f 70 72 6f 62 65 5f 73 74 61 74 7573 1a 54 6f 75 63 68 5f 70 72 6f 62 65 5f 70 6f73 31 5f 70 6f 73 5f 76 61 6c 75 65 1a 54 6f 7563 68 5f 70 72 6f 62 65 5f 70 6f 73 31 5f 6e 6567 5f 76 61 6c 75 65 1a 54 6f 75 63 68 5f 70 726f 62 65 5f 70 6f 73 32 5f 70 6f 73 5f 76 61 6c75 65 1a 54 6f 75 63 68 5f 70 72 6f 62 65 5f 706f 73 32 5f 6e 65 67 5f 76 61 6c 75 65 0d 64 6967 74 61 6c 5f 69 6e 70 75 74 73 0f 61 63 74 7561 6c 5f 76 65 6c 6f 63 69 74 79 11 66 6f 6c 6c6f 77 5f 65 72 72 5f 61 63 74 75 61 6c 13 54 6f72 71 75 65 5f 61 63 74 75 61 6c 5f 76 61 6c 7565 0c 52 78 50 64 6f 4d 61 70 70 69 6e 67 0b 636f 6e 74 72 6f 6c 77 6f 72 64 07 6f 70 5f 6d 6f64 65 0f 74 61 72 67 65 74 5f 70 6f 73 69 74 696f 6e 14 54 6f 75 63 68 5f 70 72 6f 62 65 5f 6675 6e 63 74 69 6f 6e 10 70 68 79 73 69 63 61 6c5f 6f 75 74 70 75 74 73 08 62 69 74 5f 6d 61 736b 0f 74 61 72 67 72 74 5f 76 65 6c 6f 63 69 7479 0d 74 61 72 67 65 74 5f 74 6f 72 71 75 65 1070 72 6f 66 69 6c 65 5f 76 65 6c 6f 63 69 74 7914 70 72 6f 66 69 6c 65 5f 61 63 63 65 6c 65 7261 74 69 6f 6e 14 70 72 6f 66 69 6c 65 5f 64 6563 65 6c 65 72 61 74 69 6f 6e 0b 68 6f 6d 65 5f6f 66 66 73 65 74 0b 68 6f 6d 65 5f 6d 65 74 686f 64 14 68 6f 6d 65 5f 73 77 69 74 63 68 5f 7665 6c 6f 63 69 74 79 12 68 6f 6d 65 5f 7a 65 726f 5f 76 65 6c 6f 63 69 74 79 11 68 6f 6d 65 5f61 63 63 65 6c 65 72 61 74 69 6f 6eSII Category 0x001e (General), 16 words02 00 01 01 01 2f 00 00 00 01 00 04 00 00 03 0011 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00SII Category 0x0028 (FMMU), 2 words01 02 03 ffSII Category 0x0029 (SyncM), 16 words00 10 80 00 26 00 01 01 00 12 00 01 22 00 01 0200 14 11 00 64 00 01 03 00 16 1f 00 20 00 01 04SII Category 0x0032 (TXPDO), 76 words00 1a 0a 03 00 06 01 00 3f 60 00 07 06 10 00 0041 60 00 08 06 10 00 00 61 60 00 09 02 08 00 0064 60 00 0a 04 20 00 00 b9 60 00 0b 06 10 00 00ba 60 00 0c 04 20 00 00 bb 60 00 0d 04 20 00 00bc 60 00 0e 04 20 00 00 bd 60 00 0f 04 20 00 00fd 60 00 10 07 20 00 00 01 1a 03 ff 00 06 00 0061 60 00 09 02 08 00 00 6c 60 00 11 04 20 00 00f4 60 00 12 04 20 00 00 02 1a 02 ff 00 06 00 003f 60 00 07 06 10 00 00 77 60 00 13 03 10 00 0003 1a 00 ff 00 06 00 00SII Category 0x0033 (RXPDO), 108 words00 16 06 02 00 14 01 00 40 60 00 15 06 10 00 0060 60 00 16 02 08 00 00 7a 60 00 17 04 20 00 00b8 60 00 18 06 10 00 00 fe 60 01 19 07 20 00 00fe 60 02 1a 07 20 00 00 01 16 06 ff 00 14 00 0040 60 00 15 06 10 00 00 60 60 00 16 02 08 00 00ff 60 00 1b 04 20 00 00 b8 60 00 18 06 10 00 00fe 60 01 19 07 20 00 00 fe 60 02 1a 07 20 00 0002 16 06 ff 00 14 00 00 71 60 00 1c 03 10 00 0081 60 00 1d 07 20 00 00 83 60 00 1e 07 20 00 0084 60 00 1f 07 20 00 00 fe 60 01 19 07 20 00 00fe 60 02 1a 07 20 00 00 03 16 05 ff 00 14 00 007c 60 00 20 04 20 00 00 98 60 00 21 02 08 00 0099 60 01 22 04 20 00 00 99 60 02 23 04 20 00 009a 60 00 24 07 20 00 00SII Category 0x003c (DC), 24 words00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0301 00 04 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 01 00 05 00 00 00 00 00注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行用以设置从站的SII内容。
@:~$ ethercat sii_write --helpethercat 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 apositive 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 ofthe 'slaves' command.--force -f Override validity checks.Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.此命令要求必须指定单个从属设备。
可选参数介绍:
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行以二进制的形式显示所有过程数据。
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 domainsare output.Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.可选参数介绍:
注意:必须运行应用程序才可以使用。
该命令行用来显示从站的配置。
@:~$ ethercat config --helpethercat config [OPTIONS]Show slave configurations.Without the --verbose option, slave configurations areoutput 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 andSDOs are output in addition.Configuration selection:Slave configurations can be selected withthe --alias and --position parameters as follows:1) If neither the --alias nor the --position optionis given, all slave configurations are displayed.2) If only the --position option is given, an aliasof zero is assumed (see 4)).3) If only the --alias option is given, all slaveconfigurations with the given alias addressare displayed.4) If both the --alias and the --position option aregiven, the selection can match a singleconfiguration, 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 (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.可选参数介绍:
例子:
显示从站的配置信息和状态。
@:~$ ethercat config0:0 0x66668888/0x20190303 0 OP下面这个例子采用 -v 参数用来显示更加详细的配置信息。
@:~$ ethercat config -a 0 -p 0 -vAlias: 0Position: 0Vendor Id: 0x66668888Product code: 0x20190303Attached slave: 0 (OP)Watchdog pider: (Default)Watchdog intervals: (Default)SM2, Dir: Output, Watchdog: EnablePDO 0x1600PDO entry 0x6040:00, 16 bitPDO entry 0x607b:00, 8 bitPDO entry 0x6060:00, 8 bitPDO entry 0x607a:00, 32 bitSM3, Dir: Input, Watchdog: EnablePDO 0x1a00PDO entry 0x6041:00, 16 bitPDO entry 0x606c:00, 32 bitPDO entry 0x6064:00, 32 bitSDO configuration:None.IDN configuration:None.Feature flags:None.DC configuration:AssignActivate: 0x0300Cycle [ns] Shift [ns]SYNC0 1000000 0SYNC1 0 0注意:必须运行应用程序才可以使用。
该命令行用来显示域的信息。
@:~$ ethercat domains --helpethercat domains [OPTIONS]Show configured domains.Without the --verbose option, the domains are displayedone-per-line. Example:Domain0: LogBaseAddr 0x00000000, Size 6, WorkingCounter 0/1The domain's base address for the logical datagram(LRD/LWR/LRW) is displayed followed by the domain'sprocess data size in byte. The last values are the currentdatagram working counter sum and the expected workingcounter sum. If the values are equal, all PDOs wereexchanged during the last cycle.If the --verbose option is given, the participating slaveconfigurations/FMMUs and the current process data areadditionally displayed:Domain1: LogBaseAddr 0x00000006, Size 6, WorkingCounter 0/1SlaveConfig 1001:0, SM3 ( Input), LogAddr 0x00000006, Size 600 00 00 00 00 00The process data are displayed as hexadecimal bytes.Command-specific options:--domain -d <index> Positive numerical domain index.If omitted, all domains aredisplayed.--verbose -v Show FMMUs and process datain addition.Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.可选参数介绍:
例子:
@:~$ ethercat domains Domain0: LogBaseAddr 0x00000000, Size 18, WorkingCounter 3/3结果说明:
设置 -v 参数后显示的结果。
@:~$ ethercat domains -vDomain0: LogBaseAddr 0x00000000, Size 18, WorkingCounter 3/3SlaveConfig 0:0, SM2 (Output), LogAddr 0x00000000, Size 81f 00 00 08 0a 00 00 00 SlaveConfig 0:0, SM3 ( Input), LogAddr 0x00000008, Size 1037 02 00 00 00 00 00 00 00 00结果说明:
注意:必须运行应用程序才可以使用。
该命令行用以 CRC 错误诊断。
@:~$ ethercat crc --helpethercat crcethercat crc resetCRC error register diagnosis.CRC - CRC Error Counter 0x300, 0x302, 0x304, 0x306PHY - Physical Interface Error Counter 0x301, 0x303, 0x305, 0x307FWD - Forwarded RX Error Counter 0x308, 0x309, 0x30a, 0x30bNXT - 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注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行用以重新扫描总线上的从站信息。
@:~$ ethercat rescan --helpethercat rescanRescan the bus.Command a bus rescan. Gathered slave information will beforgotten and slaves will be read in again.例子:
该命令执行后不会有任何信息输出。
@:~$ ethercat rescan注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。
该命令行生成的PDO信息可以直接被应用层的ecrt_slave_config_pdos()函数调用。
@:~$ ethercat cstruct --helpethercat cstruct [OPTIONS]Generate slave PDO information in C language.The output C code can be used directly with theecrt_slave_config_pdos() function of the applicationinterface.Command-specific options:--alias -a <alias>--position -p <pos> Slave selection. See the help ofthe 'slaves' command.Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.可选参数介绍:
例子:
@:~$ 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信息
该命令行用以显示EOE的统计信息,包括主站的发送率和接收率(Byte/s)。
@:~$ ethercat eoe --helpethercat eoeDisplay Ethernet over EtherCAT statictics.The TxRate and RxRate are displayed in Byte/s.注意:必须运行应用程序才可以使用。
设置 EOE 的 IP 参数地址。
@:~$ ethercat ip --helpethercat 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 withdecimal subnet prefix)link <MAC> Link-layer address (may containcolons or hyphens)default <IPv4> Default gatewaydns <IPv4> DNS servername <hostname> Host name (max. 32 byte)IPv4 adresses can be given either in dot notation or ashostnames, which will be automatically resolved.Command-specific options:--alias -a <alias>--position -p <pos> Slave selection. See the help ofthe 'slaves' command.Numerical values can be specified either with decimal (noprefix), octal (prefix '0') or hexadecimal (prefix '0x') base.此命令要求必须指定单个从属设备。
必选参数介绍:
IP参数可以作为参数元组添加:
IPv4地址可以用点表示法,比如说"192.168.0.1"或主机名,该命令行将会自动解析。
可选参数介绍:
注意:必须有从站连接才能使用此命令,不运行应用程序也可以使用。