Supported platforms: CODESYS 3.5, CODESYS 3.5 SAFETY
This section describes how to use application error log with S Series and E Series control units.
Application error log is implemented in MultiTool Creator code template using SafeErrorLog safety library.
SafeErrorLog library provides POUs and data structures for error logging which is possible to use within safety related application code.
Application error log is not intended for implementing safety related functionalities but only for diagnostic and debugging purposes.
Purpose is to make it easier to identify and debug which part of the application has caused error(s).
These errors may have led to safe state, depending on error and application.
It is possible to read log data from:
CODESYS (online debugging or application)
CANopen OD (using SDO)
Log data is stored in application’s non-safety RAM memory so that errors can be triggered from safety and non-safety application code.
Log is located in code template's global variable list CodeTemplate > Globals > G_Logs.
Log is initialized automatically by code template using S_InitLog function.
Errors are added automatically to log by code template using S_AddError_<type> function.
Error triggering is done in existing code template programs when errors occur.
Log contains errors in activation order and only first instance of each error.
For more information, see SafeErrorLog library documentation.
Error log line (see SafeErrorLog Data Types) includes two error codes and 8 bytes of additional information.
Error code values are defined by code template (see Error codes below)
Library error code is error specific, typically return value or error output of the functionality causing error
Additional info is error specific
For more information, see Interpreting errors below.
Error codes are defined by code template.
Error code enumeration is located in POUs tab > CodeTemplate > Enumerations > ApplicationErrors (ENUM).
ApplicationErrors (DINT ENUM)ApplicationErrors (DINT ENUM)
Name |
Numeric value |
Description |
NO_ERROR |
0 |
No error, not added to log |
FW_ERROR |
1 |
Handle_Firmware_Errors: Used for errors read from FW log |
SAFE_OPERATION_DISABLED |
2 |
S_Safety_Status: Falling edge of safe operation enable |
USER_APPLICATION |
1000 |
Reserved for end-user application usage |
IO_INIT |
2000 |
S_Init_IO/Init_IO: Error in I/O initialization |
CAN_INIT |
3000 |
Init_CAN: CANVXD channel initialization error |
CAN_INIT_SP |
3001 |
Init_CAN: Sample point initialization error |
INPUTS |
4000 |
S_Inputs / Inputs: Error in input pin |
OUTPUTS |
5000 |
S_Outputs / Outputs: Reserved for future |
OUTPUTS_FW |
5001 |
S_Outputs / Outputs: Firmware error in output |
HW_DIAGNOSTIC_FAULT |
6000 |
S_SafetyStatus (safety control units) Handle_Diagnostic (control units) HW diagnostic not OK |
HW_DIAG_OUT_PWR_GRP_1 |
6100 |
S_SafetyStatus (safety control units) Handle_Diagnostic (control units) Error in output group 1 |
HW_DIAG_OUT_REF_1 |
6101 |
S_SafetyStatus (safety control units) Handle_Diagnostic (control units) Error in REF output |
HW_DIAG_IN_SUPPLY |
6200 |
S_SafetyStatus (safety control units) Handle_Diagnostic (control units) Error in supply voltage monitoring |
HW_DIAG_IN_5VAN |
6201 |
S_SafetyStatus (safety control units) Handle_Diagnostic (control units) Error in 5VAN diagnostic |
HW_DIAG_IN_MCU_TEMP |
6202 |
S_SafetyStatus (safety control units) Handle_Diagnostic (control units) Error in MCU temperature monitoring |
HW_DIAG_IN_SBC_TEMP |
6203 |
S_SafetyStatus (safety control units) Handle_Diagnostic (control units) Error in SBC temperature monitoring |
HW_DIAG_IN_PCB_TEMP_1 |
6204 |
S_SafetyStatus (safety control units) Handle_Diagnostic (control units) Error in PCB 1 temperature |
HW_DIAG_IN_PCB_TEMP_2 |
6205 |
S_SafetyStatus (safety control units) Handle_Diagnostic (control units) Error in PCB 2 temperature |
NVRAM_INIT |
7000 |
NVMemory: initialization error |
NVRAM_INPUT |
7001 |
NVMemory: input error |
NVRAM_FW |
7002 |
NVMemory: Firmware interface error |
NVRAM_OD |
7003 |
NVMemory: CANopen OD error |
NVRAM_FASTPAR |
7004 |
NVMemory: Fast parameter error |
VALIDATE_SAFE_PAR |
8000 |
S_ValidateParameters_CANX: Safety parameter validation error |
VALIDATE_SRDO_SIGNATURE |
9000 |
S_ValidateSRDOSignatures_CANX: SRDO signature validation error |
VALIDATE_SRDO |
10000 |
S_Validate_SRDOs_CANX: SRDO validation error |
GFC_STATUS |
11000 |
S_SafetyStatus: GFC activated |
J1939 |
12000 |
Handle_J1939_CANX: J1939 protocol error |
J1939_ACL |
12001 |
Handle_J1939_CANX: Address claim server error |
J1939_ACL_PGN |
12002 |
Handle_J1939_CANX: ACL DeviceToPGN function block error |
CANOPEN_INIT_OD |
13000 |
Init_CANopen_CANX: CANopen protocol error in init |
CANOPEN_INIT_NMT |
13001 |
Init_CANopen_CANX: CANopen protocol error in init |
CANOPEN_INIT_SSDO |
13002 |
Init_CANopen_CANX: CANopen protocol error in init |
CANOPEN_INIT_CSDO |
13003 |
Init_CANopen_CANX: CANopen protocol error in init |
CANOPEN_INIT_HB |
13004 |
Init_CANopen_CANX: CANopen protocol error in init |
CANOPEN_INIT_SYNC |
13005 |
Init_CANopen_CANX: CANopen protocol error in init |
CANOPEN_INIT_EMCY |
13006 |
Init_CANopen_CANX: CANopen protocol error in init |
CANOPEN_INIT_PDO |
13007 |
Init_CANopen_CANX: CANopen protocol error in init |
CANOPEN_INIT_SRDO |
13008 |
Init_CANopen_CANX: CANopen protocol error in init |
CANOPEN_INIT_GFC |
13009 |
Init_CANopen_CANX: CANopen protocol error in init |
CANOPEN_UPDATE_OD |
14000 |
Handle_CANopen_CANX: CANopen protocol error |
CANOPEN_UPDATE_NMT |
14001 |
Handle_CANopen_CANX: CANopen protocol error |
CANOPEN_UPDATE_SSDO |
14002 |
Handle_CANopen_CANX: CANopen protocol error |
CANOPEN_UPDATE_CSDO |
14003 |
Handle_CANopen_CANX: CANopen protocol error |
CANOPEN_UPDATE_HB |
14004 |
Handle_CANopen_CANX: CANopen protocol error |
CANOPEN_UPDATE_SYNC |
14005 |
Handle_CANopen_CANX: CANopen protocol error |
CANOPEN_UPDATE_EMCY |
14006 |
Handle_CANopen_CANX: CANopen protocol error |
CANOPEN_UPDATE_PDO |
14007 |
Handle_CANopen_CANX: CANopen protocol error |
CANOPEN_UPDATE_SRDO |
14008 |
Handle_CANopen_CANX: CANopen protocol error |
CANOPEN_UPDATE_GFC |
14009 |
Handle_CANopen_CANX: CANopen protocol error |
Application log count variable indicates how many errors have been triggered since application start.
Loglines array includes errors in activation order.
Code template includes two OD indexes for application log:
2170h sub0: Application log error count (U32)
2171h sub0: Logline data (domain)
SDO block transfer is not supported for reading the log.
Log line 32-bit variables are in native byte order (big endian) when read from OD index.
Following is example log lines from 2171h:
timestamp 0x20C (524ms), error code 0x7D0 (2000), library error code 0x88A5 (34981), additional info 0, 0x1, 0, 0x23, 0, 0, 0, 0
I/O initialization error
firmware error code 34981
connector 1, pin 35
timestamp 0x252 (594ms), error code 0x36B1 (14001), library error code 0xFFFFFAA5 (-1371), additional info 0, 0, 0, 0, 0, 0, 0, 0x1
CANopen NMT protocol error
CANopen error code -1371
CAN-bus 1
timestamp 0x253 (595ms), error code 0x1B5B (7003), library error code 0x2 (2), additional info 0, 0, 0, 0, 0, 0, 0, 0
NVRAM error in OD parameters
corrupted parameter area
timestamp 0x253 (595ms), error code 0x1B5C (7004), library error code 0x2 (2), additional info 0, 0, 0, 0, 0, 0, 0, 0
NVRAM error in fast parameters
corrupted parameter area
timestamp 0x25D (605ms), error code 0x1770 (6000), library error code 0x7FFFFFFF (N/A), additional info 0, 0, 0, 0, 0, 0, 0, 0
Error in hw diagnostic (in this case because of FW error)
Following errors are common for all S/E-series control units (when corresponding POU is generated).
Code template POU(s) |
Error code (ApplicationErrors) |
Library error code |
Infos [1..8] |
|||||||
Handle_Firmware_Errors |
FW_ERROR
|
Error from FW log entry EPEC_SYSTEM SYSTEM_ERROR_CODES |
Info from FW log entry see SystemLogEntry |
Identifier from FW log entry see SystemLogEntry |
||||||
S_Init_IO Init_IO |
IO_INIT |
FW error code from I/O driver EPEC_SYSTEM SYSTEM_ERROR_CODES |
N/A |
Connector number |
N/A |
Pin number |
Reserved for error specific info |
|||
Init_CAN |
CAN_INIT |
EPEC_CANVXD Error |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
CAN number |
Init_CAN |
CAN_INIT_SP |
FW error code from CANEXT interface EPEC_SYSTEM SYSTEM_ERROR_CODES |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
CAN number |
S_Inputs Inputs |
INPUTS |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
Connector number |
Pin number |
N/A
|
N/A
|
N/A
|
Reserved |
OUTPUTS |
Reserved for future |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Outputs Outputs |
OUTPUTS_FW |
EPEC_HW PWMChannelStatus 32-bit status flag mask from FW (init OK filtered out) |
N/A |
Connector number |
N/A |
Pin number |
Reserved for error specific info |
|||
NVMemory |
NVRAM_INIT |
Boolean error flag |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
NVMemory |
NVRAM_INPUT |
Boolean error flag |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
NVMemory |
NVRAM_FW |
EPEC_SYSTEM SYSTEM_ERROR_CODES |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
NVMemory |
NVRAM_OD |
EPEC_PH ParamHandlerStatus |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
NVMemory |
NVRAM_FASTPAR |
EPEC_PH ParamHandlerStatus |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
Handle_J1939_CANX |
J1939 |
EPEC_J1939 J1939_ReturnCodes |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
CAN number |
Handle_J1939_CANX |
J1939_ACL |
EPEC_ACL ServerErrors |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
CAN number |
Handle_J1939_CANX |
J1939_ACL_PGN |
EPEC_ACL DeviceToPGNErrors |
N/A |
N/A |
PGN number |
N/A |
N/A |
N/A |
CAN number |
|
Init_CANopen_CANX |
CANOPEN_INIT_<protocol> |
EPEC_CANopen Errors |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
CAN number |
Handle_CANopen_CANX |
CANOPEN_UPDATE_<protocol> |
EPEC_CANopen Errors |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
CAN number |
Following errors are included in Safety Control Unit only (when corresponding POU is generated).
Code template POU(s) |
Error code (ApplicationErrors) |
Library error code |
Infos [1..8] |
|||||||
S_Safety_Status |
SAFE_OPERATION_DISABLED |
N/A (EPEC_SERRLOG G_ErrorNA) |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
S_ValidateParameters_CANX |
VALIDATE_SAFE_PAR |
EPEC_DITF EventCode.EventID |
N/A |
N/A |
Safety parameter OD index which failed validation |
N/A |
N/A |
N/A |
CAN number |
|
S_ValidateSRDOSignatures_CANX |
VALIDATE_SRDO_SIGNATURE |
EPEC_DITF EventCode.EventID |
N/A |
N/A |
N/A |
SRDO number which failed validation |
N/A |
N/A |
N/A |
CAN number |
S_Validate_SRDOs_CANX |
VALIDATE_SRDO |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
CAN number |
S_Safety_Status |
GFC_STATUS |
GFC status value |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
CAN number |
Hardware diagnostic errors are control unit specific.
SC52 Safety Control UnitSC52 Safety Control Unit
Code template POU(s) |
Error code (ApplicationErrors) |
Library error code |
Infos [1..8] |
|||||||
S_Safety_Status |
HW_DIAGNOSTIC_FAULT |
N/A (EPEC_SERRLOG G_ErrorNA) |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_OUT_PWR_GRP_1 |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_OUT_REF_1 |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_IN_SUPPLY |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_IN_5VAN |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_IN_MCU_TEMP |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_IN_SBC_TEMP |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_IN_PCB_TEMP_1 |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_IN_PCB_TEMP_2 |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
SL84 Safety Control UnitSL84 Safety Control Unit
Code template POU(s) |
Error code (ApplicationErrors) |
Library error code |
Infos [1..8] |
|||||||
S_Safety_Status |
HW_DIAGNOSTIC_FAULT |
N/A (EPEC_SERRLOG G_ErrorNA) |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_OUT_PWR_GRP_1 |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_OUT_REF_1 |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_IN_MCU_TEMP |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_IN_SBC_TEMP |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
S_Safety_Status |
HW_DIAG_IN_PCB_TEMP_1 |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
EC44 Control UnitEC44 Control Unit
Code template POU(s) |
Error code (ApplicationErrors) |
Library error code |
Infos [1..8] |
|||||||
Handle_Diagnostic |
HW_DIAGNOSTIC_FAULT |
N/A (EPEC_SERRLOG G_ErrorNA) |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
Handle_Diagnostic |
HW_DIAG_OUT_PWR_GRP_1 |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
Handle_Diagnostic |
HW_DIAG_OUT_REF_1 |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
Handle_Diagnostic |
HW_DIAG_IN_SUPPLY |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
Handle_Diagnostic |
HW_DIAG_IN_5VAN |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
Handle_Diagnostic |
HW_DIAG_IN_MCU_TEMP |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
Handle_Diagnostic |
HW_DIAG_IN_SBC_TEMP |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
Handle_Diagnostic |
HW_DIAG_IN_PCB_TEMP_1 |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
Handle_Diagnostic |
HW_DIAG_IN_PCB_TEMP_2 |
EPEC_DITF EventCode.EventID |
EPEC_DITF EventCode. FunctionID |
EPEC_DITF EventCode. DeviceID |
EPEC_DITF EventCode. ChannelID |
N/A |
N/A |
N/A |
N/A |
N/A |
SafeErrorLog library
Source file topic100608.htm
Last updated 19-Dec-2024