EtherCAT Communication Diagnosis Steps
This topic covers the steps to diagnose EtherCATEtherCAT is an open, high-performance Ethernet-based fieldbus system. The development goal of EtherCAT was to apply Ethernet to automation applications which require short data update times (also called cycle times) with low communication jitter (for synchronization purposes) and low hardware costs communication errors, and provides examples for how an application program can help a technician detect the issue and repair it.
Diagnosing EtherCAT Communication Errors
The flow chart below explains the steps involved in diagnosing the EtherCAT errors.
-
- The blue fields in the flow chart are clickable. Each points to sample code that can be used in a program to help with diagnosis.
Code Examples for Diagnosing EtherCAT Communication Errors
This sample code checks for any Working Counter failure using the function ECATWCStatus. If there is one or more working counter errors then the return value will be greater than 0.
WC_ErrorCount := ECATWCStatus( 0 );
IF WC_ErrorCount > 0 THEN
WC_error :=TRUE; // There is a communication problem.
ELSE
WC_error := FALSE; // No communication problem
END_IF;
The GetCtrlErrors function can be used to get the Errors and Alarms in the controller that are related to EtherCAT.
ControllerErrorStatus:= GetCtrlErrors(ActiveError, ActiveAlarm) ;
A31Active := ActiveAlarm[31]; // True if A31 is active.
A38Active := ActiveAlarm[38]; // True if A38 alarm is active
E30Active := ActiveError[30] // True if E30 is active.
// Process the alarms and Errors here.
The device (slave) state can be read by the application using the function block ECATDeviceStatus.
Inst_ECATDeviceStatus(True, slaveAddress);
IF Inst_ECATDeviceStatus.Done THEN
IF Inst_ECATDeviceStatus.LinkStatus = EC_LINK_NO_COMMUNICATION THEN
device_not_reachable := TRUE; // Device is not reachable. Link to the device is broken.
END_IF
IF Inst_ECATDeviceStatus.State <> EC_STATE_OP THEN
device_not_in_OPMODE := TRUE; // Slave is not in Operational mode.
END_IF
END_IF;
This sample code uses ECATCommErrors function block to identify the connections that have errors.
Inst_ECATCommErrors( TRUE, connections);
IF Inst_ECATCommErrors.Done THEN
IF Inst_ECATCommErrors.ConnectionCount > 0 THEN
// Process the connection errors here.
END_IF;
END_IF
-
- See the article "Building KAS Applications with Built-in EtherCAT Diagnostics" on KDN for a code sample and project file that uses EtherCAT diagnostics.