CANopen FD Master Library
Making your systems precise, reliable and high-quality - 5.10.01
Functions
NMT service

Functions

void ComNmtEventActiveMaster (uint8_t ubNetV, uint8_t ubPriorityV, uint8_t ubNodeIdV)
 
void ComNmtEventHeartbeat (uint8_t ubNetV, uint8_t ubNodeIdV)
 
void ComNmtEventStateChange (uint8_t ubNetV, uint8_t ubNodeIdV, uint8_t ubNmtStateV)
 
void ComNmtEventIdCollision (uint8_t ubNetV)
 
void ComNmtEventMasterDetection (uint8_t ubNetV, uint8_t ubResultV)
 
void ComNmtEventResetNode (uint8_t ubNetV)
 
void ComNmtEventResetCommunication (uint8_t ubNetV)
 
ComStatus_tv ComNmtGetHbProdTime (uint8_t ubNetV, uint16_t *puwTimeV)
 
ComStatus_tv ComNmtGetInhibit (uint8_t ubNetV, uint32_t *pulTimeV)
 
ComStatus_tv ComNmtGetNodeState (uint8_t ubNetV, uint8_t ubNodeIdV, uint8_t *pubStateV)
 
ComStatus_tv ComNmtIsMaster (uint8_t ubNetV)
 
ComStatus_tv ComNmtMasterDetection (uint8_t ubNetV, uint8_t ubBootupV)
 
ComStatus_tv ComNmtSetHbProdTime (uint8_t ubNetV, uint16_t uwTimeV)
 
ComStatus_tv ComNmtSetInhibit (uint8_t ubNetV, uint32_t ulTimeV)
 
ComStatus_tv ComNmtSetNodeState (uint8_t ubNetV, uint8_t ubNodeIdV, uint8_t ubStateV)
 

Detailed Description

The CANopen Network Management (NMT) is used to change the state of a CANopen slave node. This module holds functions for the protocol stack to behave in both ways: as Master or as Slave. If the protocol stack is started in Slave mode (refer to the ComMgrInit() function), the protocol stack must react on NMT messages. If started in Master mode, the protocol stack holds the NMT resource and is allowed to send NMT messages.

Function Documentation

◆ ComNmtEventActiveMaster()

void ComNmtEventActiveMaster ( uint8_t  ubNetV,
uint8_t  ubPriorityV,
uint8_t  ubNodeIdV 
)

NMT event callback - Active NMT master.

Parameters
ubNetV- CANopen Network channel
ubPriorityV- NMT master priority
ubNodeIdV- Node-ID value

This function is called by the stack on a NMT active master indication. The action on this function is application specific.

◆ ComNmtEventHeartbeat()

void ComNmtEventHeartbeat ( uint8_t  ubNetV,
uint8_t  ubNodeIdV 
)

NMT event callback - Heartbeat.

Parameters
ubNetV- CANopen Network channel
ubNodeIdV- Node-ID value

This function is called by the stack on a NMT heartbeat event. The action on this function is application specific.

◆ ComNmtEventIdCollision()

void ComNmtEventIdCollision ( uint8_t  ubNetV)

NMT event callback - ID collision.

Parameters
ubNetV- CANopen Network channel

This function is called by the stack on a NMT identifier collision. The action on this function is application specific.

◆ ComNmtEventMasterDetection()

void ComNmtEventMasterDetection ( uint8_t  ubNetV,
uint8_t  ubResultV 
)

NMT master detection callback.

Parameters
ubNetV- CANopen Network channel
ubResultV- Result of NMT master detection
See also
ComNmtMasterDetection()

This function is called by the stack as result on a NMT master detection procedure. Possible values for the parameter ubResultV are

  • eCOM_NMT_DETECT_SUCCESS
  • eCOM_NMT_DETECT_TIMEOUT

The value eCOM_NMT_DETECT_SUCCESS means that a NMT master device is available in the network. The CANopen master stack shall not be used as NMT master in that case. The values eCOM_NMT_DETECT_TIMEOUT denotes that there was no response from another NMT master in the network and the CANopen master stack may be used as NMT master.

The action on this function is application specific.

◆ ComNmtEventResetCommunication()

void ComNmtEventResetCommunication ( uint8_t  ubNetV)

NMT reset event callback.

Parameters
ubNetV- CANopen Network channel

This function is called by the stack on a NMT reset communication command. The action on this function is application specific.

◆ ComNmtEventResetNode()

void ComNmtEventResetNode ( uint8_t  ubNetV)

NMT reset event callback.

Parameters
ubNetV- CANopen Network channel

This function is called by the stack on a NMT reset remote node command. The action on this function is application specific.

◆ ComNmtEventStateChange()

void ComNmtEventStateChange ( uint8_t  ubNetV,
uint8_t  ubNodeIdV,
uint8_t  ubNmtStateV 
)

NMT event callback - State change.

Parameters
ubNetV- CANopen Network channel
ubNodeIdV- Node-ID value
ubNmtStateV- New NMT state

This function is called by the stack on a NMT state change event. Possible values for ubNmtStateV are listed in the ComNmtState_e enumeration. The action on this function is application specific.

◆ ComNmtGetHbProdTime()

ComStatus_tv ComNmtGetHbProdTime ( uint8_t  ubNetV,
uint16_t *  puwTimeV 
)
Parameters
ubNetV- CANopen Network channel
puwTimeV- Pointer to heartbeat timer value
Returns
eCOM_ERR_NONE on success, negative ComErr_e value on failure
See also
ComNmtSetHbProdTime()

This function retrieves the heartbeat producer time for the CANopen Master. The value passed to the pointer puwTimeV is given in multiples of 1 millisecond.

◆ ComNmtGetInhibit()

ComStatus_tv ComNmtGetInhibit ( uint8_t  ubNetV,
uint32_t *  pulTimeV 
)
Parameters
ubNetV- CANopen Network channel
pulTimeV- Pointer to NMT inhibit time
Returns
eCOM_ERR_NONE on success, negative ComErr_e value on failure
See also
ComNmtSetInhibit()

This function retrieves the inhibit time between two subsequent NMT messages. The pointer pulTimeV points to a variable that holds the time value in multiples of one microsecond.

◆ ComNmtGetNodeState()

ComStatus_tv ComNmtGetNodeState ( uint8_t  ubNetV,
uint8_t  ubNodeIdV,
uint8_t *  pubStateV 
)
Parameters
ubNetV- CANopen Network channel
ubNodeIdV- Node-ID value
pubStateV- Pointer to NMT state variable
Returns
eCOM_ERR_NONE on success, negative ComErr_e value on failure
See also
ComNmtSetNodeState()

This function retrieves the NMT state of the CANopen device with the Node-ID ubNodeIdV. Possible values for ubNodeIdV are 1 .. 127. The value passed to the pointer pubStateV is taken from the ComNmtState_e enumeration.

◆ ComNmtIsMaster()

ComStatus_tv ComNmtIsMaster ( uint8_t  ubNetV)
Parameters
ubNetV- CANopen Network channel
Returns
1 if NMT master, 0 if NMT slave

This function checks if the device is the NMT master or not.

◆ ComNmtMasterDetection()

ComStatus_tv ComNmtMasterDetection ( uint8_t  ubNetV,
uint8_t  ubBootupV 
)
Parameters
ubNetV- CANopen Network channel
ubBootupV- set to 1 if run upon bootup
Returns
eCOM_ERR_NONE on success, negative ComErr_e value on failure
See also
ComNmtEventMasterDetection()

This function starts the NMT master detection.

◆ ComNmtSetHbProdTime()

ComStatus_tv ComNmtSetHbProdTime ( uint8_t  ubNetV,
uint16_t  uwTimeV 
)
Parameters
ubNetV- CANopen Network channel
uwTimeV- Heartbeat timer value
Returns
eCOM_ERR_NONE on success, negative ComErr_e value on failure
See also
ComNmtGetHbProdTime()

This function sets the heartbeat producer time for the CANopen Master. The value passed to uwTimeV is given in multiples of 1 millisecond.

◆ ComNmtSetInhibit()

ComStatus_tv ComNmtSetInhibit ( uint8_t  ubNetV,
uint32_t  ulTimeV 
)
Parameters
ubNetV- CANopen Network channel
ulTimeV- NMT inhibit time
Returns
eCOM_ERR_NONE on success, negative ComErr_e value on failure
See also
ComNmtGetInhibit()

This function sets the inhibit time between two subsequent NMT messages. The parameter ulTimeV is given in multiples of 1 microsecond.

◆ ComNmtSetNodeState()

ComStatus_tv ComNmtSetNodeState ( uint8_t  ubNetV,
uint8_t  ubNodeIdV,
uint8_t  ubStateV 
)
Parameters
ubNetV- CANopen Network channel
ubNodeIdV- Node-ID value
ubStateV- New NMT state
Returns
eCOM_ERR_NONE on success, negative ComErr_e value on failure
See also
ComNmtGetNodeState()

This function changes the NMT state of the CANopen device with the Node-ID ubNodeIdV. Possible values for ubNodeIdV are 0 .. 127. A value of 0 addresses all devices in the network. Passing the address of the CANopen Master to ubNodeIdV will change the NMT state of the Master.

The value passed to ubStateV is taken from the ComNmtState_e enumeration.