EtherLab Command-line Tools

From Neuromeka Wiki
Jump to: navigation, search


Managing Master

  • 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.

Start master

sudo ./serviceethercat start 

Stop master

sudo ./serviceethercat stop 

Restart master

sudo ./serviceethercat restart 

Managing Slaves

  • 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.

ethercattool slaves

  • The table shows the meaning of each columns in displayed information.
column description example
1 absolute ring position 0 (the first slave)
2 alias/position 0:0
3 slave status PREOP
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

ethercattool slaves -v

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.

ethercattool graph

Checking slave PDO configuration

sudo ./ethercattool pdos
  • To display the current default PDO configurations of all the slaves

ethercattool pdos

  • 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

ethercattool cstruct

  • 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