|
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.
|
|
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:
- Make sure, driver supports it. RTR bit should be part of CAN identifier.
- Enable it with 'CO_CONFIG_NODE_GUARDING', see CO_config.h
- For slave add 0x100C and 0x100D objects to the Object dictionary.
- For master use CO_nodeGuardingMaster_initNode() to add monitored nodes.
- 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:
See Default CANopen identifiers for CAN identifiers.
◆ CO_nodeGuardingSlave_init()
Initialize Node Guarding slave object.
Function must be called in the communication reset section.
- Parameters
-
| ngs | This object will be initialized. |
| OD_100C_GuardTime | OD entry for 0x100C -"Guard time", entry is required. |
| OD_100D_LifeTimeFactor | OD entry for 0x100D -"Life time factor", entry is required. |
| em | Emergency object. |
| CANidNodeGuarding | CAN identifier for Node Guarding rtr and response message (usually CO_CAN_ID_HEARTBEAT + nodeId). |
| CANdevRx | CAN device for Node Guarding rtr reception. |
| CANdevRxIdx | Index of the receive buffer in the above CAN device. |
| CANdevTx | CAN device for Node Guarding response transmission. |
| CANdevTxIdx | Index of the transmit buffer in the above CAN device. |
[out] | errInfo | Additional information in case of error, may be NULL. |
- Returns
- CO_ReturnError_t CO_ERROR_NO on success.
◆ CO_nodeGuardingSlave_process()
Process Node Guarding slave.
Function must be called cyclically.
- Parameters
-
| ngs | This object. |
| NMTstate | NMT operating state. |
| slaveDisable | If true, then Node guarding slave is disabled. |
| timeDifference_us | Time difference from previous function call in microseconds. |
[out] | timerNext_us | info to OS - see CO_process(). |
◆ CO_nodeGuardingSlave_isTimeout()
Inquire, if Node guarding slave detected life time timeout.
Error is reset after pool request from master.
- Parameters
-
- Returns
- true, if life time timeout was detected.
◆ CO_nodeGuardingMaster_init()
Initialize Node Guarding master object.
Function must be called in the communication reset section.
- Parameters
-
ngm | This object will be initialized. |
em | Emergency object. |
CANdevRx | CAN device for Node Guarding reception. |
CANdevRxIdx | Index of the receive buffer in the above CAN device. |
CANdevTx | CAN device for Node Guarding rtr transmission. |
CANdevTxIdx | Index of the transmit buffer in the above CAN device. |
- Returns
- CO_ReturnError_t CO_ERROR_NO on success.
◆ CO_nodeGuardingMaster_initNode()
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
-
ngm | Node Guarding master object. |
index | Index of the slot, which will be configured. 0 <= index < CO_CONFIG_NODE_GUARDING_MASTER_COUNT. |
nodeId | Node Id of the monitored node. |
guardTime_ms | Guard time of the monitored node. |
- Returns
- CO_ReturnError_t CO_ERROR_NO on success.
◆ CO_nodeGuardingMaster_process()
Process Node Guarding master.
Function must be called cyclically.
- Parameters
-
| ngm | This object. |
| timeDifference_us | Time difference from previous function call in microseconds. |
[out] | timerNext_us | info to OS - see CO_process(). |