Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Managing Emergency Errors

The CANopen stack provides service API functions for managing the emergency events within the application. The handling of EMCY transmission events, the error register and EMCY history management within the object directory is handled within the CANopen stack. For managing the emergency errors the service function group COEmcy…() is provided.

The emergency error codes and the properties of the emergency errors are specified within the configuration. The following example shows the emergency error specification table:


Code Block
languagecpp
const CO_EMCY_TBL DemoEmcyCode[CO_EMCY_N] = {
    {       /*--- emercency: #0 -----*/
      CO_EMCY_REG_GENERAL,                     /* error register bit    */
      CO_EMCY_CODE_GEN_ERR + 0x0010            /* emergency error code  */
    },
    {       /*--- emercency: #1 -----*/
      CO_EMCY_REG_VOLTAGE,                     /* error register bit    */
      CO_EMCY_CODE_VOL_ERR + 0x0001            /* emergency error code  */
    },
     :
};


When using the emergency errors, the emergency code is the key for the service functions. Additional to the specific emergency code, user data may be stored or transmitted with each emergency change event. The user data is typical a local structure which will be given as parameter to the service functions. Due to the fact, that the user data for transmission and internal history has different sizes, the following structure is provided for the user data fields:


Code Block
languagecpp
CO_EMCY_USR DemoEmcyUsr = {
    0x1234,                                    /* 16bit User Data for History  */
    { 0x11, 0x22, 0x33, 0x44, 0x55 }           /* 5byte User Data for EMCY-Msg */
};


Note: The user data fields for history and/or message can be disabled with two separate configuration settings.End of topic