CANopenNode
CANopen protocol stack
Loading...
Searching...
No Matches
Node Guarding CANopen Node Guarding, an older alternative to the Heartbeat protocol.
+ Collaboration diagram for Node Guarding CANopen Node Guarding, an older alternative to the Heartbeat protocol.:

Files

file  CO_Node_Guarding.h
 CANopen Node Guarding slave and master objects.
 

Data Structures

struct  CO_nodeGuardingSlave_t
 Node Guarding slave object. More...
 
struct  CO_nodeGuardingMasterNode_t
 Node Guarding master - monitored node. More...
 
struct  CO_nodeGuardingMaster_t
 Node Guarding master object. More...
 

Functions

CO_ReturnError_t CO_nodeGuardingSlave_init (CO_nodeGuardingSlave_t *ngs, OD_entry_t *OD_100C_GuardTime, OD_entry_t *OD_100D_LifeTimeFactor, CO_EM_t *em, uint16_t CANidNodeGuarding, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdx, CO_CANmodule_t *CANdevTx, uint16_t CANdevTxIdx, uint32_t *errInfo)
 Initialize Node Guarding slave object.
 
void CO_nodeGuardingSlave_process (CO_nodeGuardingSlave_t *ngs, CO_NMT_internalState_t NMTstate, bool_t slaveDisable, uint32_t timeDifference_us, uint32_t *timerNext_us)
 Process Node Guarding slave.
 
static bool_t CO_nodeGuardingSlave_isTimeout (CO_nodeGuardingSlave_t *ngs)
 Inquire, if Node guarding slave detected life time timeout.
 
CO_ReturnError_t CO_nodeGuardingMaster_init (CO_nodeGuardingMaster_t *ngm, CO_EM_t *em, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdx, CO_CANmodule_t *CANdevTx, uint16_t CANdevTxIdx)
 Initialize Node Guarding master object.
 
CO_ReturnError_t CO_nodeGuardingMaster_initNode (CO_nodeGuardingMaster_t *ngm, uint8_t index, uint8_t nodeId, uint16_t guardTime_ms)
 Initialize node inside Node Guarding master object.
 
void CO_nodeGuardingMaster_process (CO_nodeGuardingMaster_t *ngm, uint32_t timeDifference_us, uint32_t *timerNext_us)
 Process Node Guarding master.
 

Detailed Description

Node guarding master pools each node guarding slave at time intervals, called guard time. Master sends a CAN RTR message, and slave responds. Slave also monitors presence of RTR message from master and indicates error, if it wasn't received within life time. ('Life time' is 'Guard time' multiplied by 'Life time factor').

Adding Node guarding to the project:

Warning
Usage of Node guarding is not recommended, as it is outdated and uses RTR CAN functionality, which is also not recommended. Use Heartbeat and Heartbeat consumer, if possible.

Node Guarding slave response message contents:

Byte, bits Description
0, bits 0..6 CO_NMT_internalState_t
0, bit 7 toggle bit

See Default CANopen identifiers for CAN identifiers.

Function Documentation

◆ CO_nodeGuardingSlave_init()

CO_ReturnError_t CO_nodeGuardingSlave_init ( CO_nodeGuardingSlave_t * ngs,
OD_entry_t * OD_100C_GuardTime,
OD_entry_t * OD_100D_LifeTimeFactor,
CO_EM_t * em,
uint16_t CANidNodeGuarding,
CO_CANmodule_t * CANdevRx,
uint16_t CANdevRxIdx,
CO_CANmodule_t * CANdevTx,
uint16_t CANdevTxIdx,
uint32_t * errInfo )

Initialize Node Guarding slave object.

Function must be called in the communication reset section.

Parameters
ngsThis object will be initialized.
OD_100C_GuardTimeOD entry for 0x100C -"Guard time", entry is required.
OD_100D_LifeTimeFactorOD entry for 0x100D -"Life time factor", entry is required.
emEmergency object.
CANidNodeGuardingCAN identifier for Node Guarding rtr and response message (usually CO_CAN_ID_HEARTBEAT + nodeId).
CANdevRxCAN device for Node Guarding rtr reception.
CANdevRxIdxIndex of the receive buffer in the above CAN device.
CANdevTxCAN device for Node Guarding response transmission.
CANdevTxIdxIndex of the transmit buffer in the above CAN device.
[out]errInfoAdditional information in case of error, may be NULL.
Returns
CO_ReturnError_t CO_ERROR_NO on success.

◆ CO_nodeGuardingSlave_process()

void CO_nodeGuardingSlave_process ( CO_nodeGuardingSlave_t * ngs,
CO_NMT_internalState_t NMTstate,
bool_t slaveDisable,
uint32_t timeDifference_us,
uint32_t * timerNext_us )

Process Node Guarding slave.

Function must be called cyclically.

Parameters
ngsThis object.
NMTstateNMT operating state.
slaveDisableIf true, then Node guarding slave is disabled.
timeDifference_usTime difference from previous function call in microseconds.
[out]timerNext_usinfo to OS - see CO_process().

◆ CO_nodeGuardingSlave_isTimeout()

static bool_t CO_nodeGuardingSlave_isTimeout ( CO_nodeGuardingSlave_t * ngs)
inlinestatic

Inquire, if Node guarding slave detected life time timeout.

Error is reset after pool request from master.

Parameters
ngsThis object.
Returns
true, if life time timeout was detected.

◆ CO_nodeGuardingMaster_init()

CO_ReturnError_t CO_nodeGuardingMaster_init ( CO_nodeGuardingMaster_t * ngm,
CO_EM_t * em,
CO_CANmodule_t * CANdevRx,
uint16_t CANdevRxIdx,
CO_CANmodule_t * CANdevTx,
uint16_t CANdevTxIdx )

Initialize Node Guarding master object.

Function must be called in the communication reset section.

Parameters
ngmThis object will be initialized.
emEmergency object.
CANdevRxCAN device for Node Guarding reception.
CANdevRxIdxIndex of the receive buffer in the above CAN device.
CANdevTxCAN device for Node Guarding rtr transmission.
CANdevTxIdxIndex of the transmit buffer in the above CAN device.
Returns
CO_ReturnError_t CO_ERROR_NO on success.

◆ CO_nodeGuardingMaster_initNode()

CO_ReturnError_t CO_nodeGuardingMaster_initNode ( CO_nodeGuardingMaster_t * ngm,
uint8_t index,
uint8_t nodeId,
uint16_t guardTime_ms )

Initialize node inside Node Guarding master object.

Function may be called any time after CO_nodeGuardingMaster_init(). It configures monitoring of the remote node.

Parameters
ngmNode Guarding master object.
indexIndex of the slot, which will be configured. 0 <= index < CO_CONFIG_NODE_GUARDING_MASTER_COUNT.
nodeIdNode Id of the monitored node.
guardTime_msGuard time of the monitored node.
Returns
CO_ReturnError_t CO_ERROR_NO on success.

◆ CO_nodeGuardingMaster_process()

void CO_nodeGuardingMaster_process ( CO_nodeGuardingMaster_t * ngm,
uint32_t timeDifference_us,
uint32_t * timerNext_us )

Process Node Guarding master.

Function must be called cyclically.

Parameters
ngmThis object.
timeDifference_usTime difference from previous function call in microseconds.
[out]timerNext_usinfo to OS - see CO_process().