CANopen Slave Documentation
Version 6.16.04
|
The CANopen Network Management (NMT) is used to change the state of a CANopen slave node. In addition, the network state can be monitored via the Network Management Error Control (NMT-EC) service. This module provides the following functionality:
Macros | |
#define | NODE_STATE_BOOTUP ((uint8_t)(0x00)) |
#define | NODE_STATE_STOPPED ((uint8_t)(0x04)) |
#define | NODE_STATE_OPERATIONAL ((uint8_t)(0x05)) |
#define | NODE_STATE_PREOPERATIONAL ((uint8_t)(0x7F)) |
#define | NODE_STATE_BUS_OFF ((uint8_t)(0xFF)) |
Functions | |
void | CosNmtChangeNodeState (uint8_t ubFailureV) |
uint8_t | CosNmtCheckNodeReset (void) |
uint8_t | CosNmtGetNodeState (void) |
void | CosNmtServiceOnError (void) |
void | CosNmtServiceOnGuardingEvent (void) |
void | CosNmtServiceOnHeartbeatEvent (void) |
void | CosNmtServiceOnPreOperational (void) |
void | CosNmtServiceOnStart (void) |
void | CosNmtServiceOnStop (void) |
uint8_t | CosNmtSetHeartbeatCons (uint8_t ubEntryV, uint8_t ubNodeIdV, uint16_t uwTimeV) |
void | CosNmtSetHeartbeatProd (uint16_t uwTimeV) |
void CosNmtChangeNodeState | ( | uint8_t | ubFailureV | ) |
[in] | ubFailureV | Error reason |
This function changes the NMT state of the device depending on the contents of object 1029h (error behaviour). The parameter ubFailureV
defines the reason for the failure:
The maximum value for ubFailureV
is defined by the symbol COS_DICT_OBJ_1029. For the failure type 'communication error' the function is called by the stack.
uint8_t CosNmtCheckNodeReset | ( | void | ) |
This function returns the node reset state (NODE_RESET_XXX).
uint8_t CosNmtGetNodeState | ( | void | ) |
This function returns the current NMT state of the node. Possible return values are defined by NMT node state.
void CosNmtServiceOnError | ( | void | ) |
This function is called when the NMT state machine receives an unknown NMT command, i.e. the identifier 0 with a DLC that does not match or data that does not match. The reaction on this event is application specific.
The function implementation is located in the file cos_user.c
.
void CosNmtServiceOnGuardingEvent | ( | void | ) |
This functions is called upon the occurrence of a guarding event.
The function implementation is located in the file cos_user.c
.
void CosNmtServiceOnHeartbeatEvent | ( | void | ) |
This functions is called upon the occurrence of a heartbeat event.
The function implementation is located in the file cos_user.c
.
void CosNmtServiceOnPreOperational | ( | void | ) |
This service routine is called when the NMT state machine changes into NMT pre-operational state. It can be used to perform device specific routines after reception of the NMT command.
The function implementation is located in the file cos_user.c
.
void CosNmtServiceOnStart | ( | void | ) |
This service routine is called when the NMT state machine changes into NMT operational state. It can be used to perform device specific routines after reception of the NMT command.
The function implementation is located in the file cos_user.c
.
void CosNmtServiceOnStop | ( | void | ) |
This service routine is called when the NMT state machine changes into NMT stopped state. It can be used to perform device specific routines after reception of the NMT command.
The function implementation is located in the file cos_user.c
.
uint8_t CosNmtSetHeartbeatCons | ( | uint8_t | ubEntryV, |
uint8_t | ubNodeIdV, | ||
uint16_t | uwTimeV | ||
) |
[in] | ubEntryV | heartbeat consumer entry (0 .. N) |
[in] | ubNodeIdV | node-ID to monitor |
[in] | uwTimeV | expected heartbeat cycle time |
This function sets the heartbeat consumer time for the entry ubEntryV. The maximum number of entries is defined via the symbol COS_DICT_OBJ_1016. The parameter uwTimeV denotes the time in milli-seconds. If the heartbeat consumer time is setup for the own node-ID or the supplied node-ID is already in use, the function will return the value 1. On success, the value 0 is returned.
void CosNmtSetHeartbeatProd | ( | uint16_t | uwTimeV | ) |
[in] | uwTimeV | heartbeat cycle time |
This function sets the heartbeat producer time. The parameter uwTimeV denotes the time in milli-seconds. By default, the heartbeat producer time is set to 0 during initialization.