Linux EtherCAT Debugging Commands

View Master Status

Obtain the master status and the number of slave device nodes

 ./ethercat master

Example Usage: The master is in idle state, the communication domain is not activated, master data statistics

Linux EtherCAT Debugging Commands

View Slave Information

The slaves command is used to view the information of slave device nodes (ESC) mounted on the EtherCAT bus

 ./ethercat slaves -v

Example Usage: Vendor ID, Product code, slave status, SDO && PDO enable status

Linux EtherCAT Debugging Commands

Switch Slave Status

Switch the slave status toSAFEOP mode

 ./ethercat states SAFEOP

Example Usage: Switch the ESC status toSAFEOP

Linux EtherCAT Debugging Commands

View PDO Registers

List all PDO registers

 ./ethercat pdos

Example Usage: Display rxPDO && txPDO configuration status

Linux EtherCAT Debugging Commands

Generate PDO Configuration Code

The cstruct command can be used to quickly generate PDO configurations

 ./ethercat cstruct

Example Usage: Generates the corresponding Vendor ID, Product code, and PDO entry list for the slave

Linux EtherCAT Debugging Commands

Slave PDO Read/Write

PDO register read/write example: Slave –> Master, Slave <– Master, note: places that can be read may not be writable, and vice versa

 # Read 2 bytes from output area
 ./ethercat reg_read -p0 0x130 2
 # Write 4 bytes to input area
 ./ethercat reg_write -p0 0x1100 -t uint32 0x12345678

Example Usage: Read 2 bytes of data from address 0x130, write uint32 data to 0x1100

Linux EtherCAT Debugging Commands

View SDO Registers

List all SDO register addresses and information under ESC

 ./ethercat sdos

Example Usage: SDO register grouping and permission allocation, register type size

Linux EtherCAT Debugging Commands

0x7010:00 The register permission is read/write, register size is uint32

Linux EtherCAT Debugging Commands

Slave SDO Read/Write

Use upload to read register values

 ./ethercat upload 0x7010 0

Use download to write to registers (followed by value)

 ./ethercat download 0x7010 0 0x03

Example Usage: Read/write the register value at address 0x7010 offset 0, indicating that this register is a 4-byte data

Linux EtherCAT Debugging Commands

Leave a Comment