Node Start
The start of a node needs to have some additional information about memory allocation, the object directory, and more. This information is collected to a single structure, called "node specification".
The following source lines show a typical node specification:
const CO_NODE_SPEC DemoSpec = { (CPU_INT08U ) 0x01, /* pre-defined Node-ID */ (CO_OBJ *)&AppObjDir, /* start of object directory */ (CPU_INT16U ) APP_OBJ_N, /* number of objects in directory */ (CO_EMCY_TBL *)&AppEmcyCode, /* start of emergency code table */ (CO_TMR_MEM *)&AppTmrMem, /* start of timer manager memory */ (CPU_INT16U ) APP_TMR_N, /* max. number of timers/actions */ (CANBUS_PARA *)&AppCanCfg, /* start of CAN bus parameters */ (CPU_INT08U *)&AppSdoBuf /* start of SDO transfer buffer */ };
The service function CONodeInit()
initializes the given node with the data and memory of the given node specification:
CONodeInit (&demo, (CO_NODE_SPEC *)&DemoSpec);
The internal behavior of the CANopen stack is shown in the following diagram:
Note: The CANopen network state machine state is INIT after the node initialization, because there may be several additional actions necessary (e.g. device profile or application specific actions) before setting the node into pre-operational state. With the final function call CONodeStart()
the bootup message is sent and the node is in the mode: CO.PREOP
. The node is now able to perform network communications
.