EtherLab Command-line Tools
From Neuromeka Wiki
- serviceethercat can start, stop and restart the EtherCAT master installed in STEP platforms.
- serviceethercat is the symbolic link in the home directory to /opt/etherlab/etc/init.d/ethercat (installed by EtherLab).
- Before any communication with EtherCAT slaves the EtherCAT master should be running in STEP platforms.
sudo ./serviceethercat start
sudo ./serviceethercat stop
sudo ./serviceethercat restart
- EtherLab provides a command-line tool ethercat which is linked symbolically by ethercattool in the home directory in STEP platforms.
- It is a utility to easily access the EtherCAT bus, to retrieve the slave's configuration information, the slave's status, to transmit/receive SDOs(service data objects), and the like.
Checking slaves on the bus
sudo ./ethercattool slaves
- To list all the slaves on the bus
- The figure shows that there are currently three slaves on the bus.
- The table shows the meaning of each columns in displayed information.
|1||absolute ring position||0 (the first slave)|
|4||error flag||E (error) or + (none)|
|5||vendor id/product code|| 0x0000009a:0x00020924
TIESC-001 (produce name)
sudo ./ethercattool slaves -v
- list all the slaves on the bus with detailed information
Generating slave topology
sudo ./ethercattool graph | dot -Tsvg > slave_topology.svg
- To generate the graph of the EtherCAT bus with slaves
- Using pipe you can save the graph in a file, e.g. slave_topoly.svg.
Checking slave PDO configuration
sudo ./ethercattool pdos
- To display the current default PDO configurations of all the slaves
- You can select a single slave on the bus by adding option -p with slave ring position. For example,
sudo ./ethercattool pdos -p1
displays the information of the second slave. Note that -p0 is the first slave.
Generating C code for slave PDO configuration
sudo ./ethercattool cstruct
- To generate C code for the current default PDO configurations of all the slaves
- You can select a single slave on the bus by adding option -p with slave ring position.
- Using pipe you can save the result to a file. For example, the following generate TIESC_001_PDO.c.
sudo ./ethercattool cstruct -p2 > TIESC_001_PDO.c
Up/Downloading SDO data
- For example, the following command reads (or upload to the master)the vendor ID (SDO of index 0x1018 with subindex 1) of the first device (-p0), whose data type is 32 bit unsigned int (-t uint32).
sudo ./ethercattool upload -p0 -t uint32 0x1018 1