CANopen Master Documentation
Version 6.08.00
Loading...
Searching...
No Matches
com_nrl.h File Reference

Detailed Description

This module covers the functionality of the specification CiA 302-6 and CiA 1302-6.

#include "com_defs.h"
#include "cp_nrl.h"
+ Include dependency graph for com_nrl.h:

Functions

uint8_t ComIdx1F62_NrlConfig (uint8_t ubNetV, uint8_t ubSubIndexV, uint8_t ubReqCodeV)
 
uint8_t ComIdx1F63_NrlMonitor (uint8_t ubNetV, uint8_t ubSubIndexV, uint8_t ubReqCodeV)
 
void ComNrlEventHandler (uint8_t ubNetV, uint8_t ubNrlStateV)
 
ComStatus_tv ComNrlInit (uint8_t ubNetV, uint8_t ubPhyIfDclV, uint8_t ubPhyIfRclV, CpNrlDriver_ts *ptsNrlDriverV, uint8_t ubDeviationLimitV, uint32_t ulMboxTimeoutV, uint32_t ulRecoveryTimeV)
 
ComStatus_tv ComNrlRelease (uint8_t ubNetV)
 
ComStatus_tv ComNrlSendConnectionService (uint8_t ubNetV)
 
ComStatus_tv ComNrlStart (uint8_t ubNetV)
 
ComStatus_tv ComNrlState (uint8_t ubNetV, CpNrlState_ts *ptsNrlStateV)
 
void ComNrlTimerEvent (uint8_t ubNetV)
 

Macro Definition Documentation

◆ COM_NRL_ACCESS_DIRECT

#define COM_NRL_ACCESS_DIRECT   1

◆ COM_NRL_ACCESS_REMOTE

#define COM_NRL_ACCESS_REMOTE   2

Function Documentation

◆ ComIdx1F62_NrlConfig()

uint8_t ComIdx1F62_NrlConfig ( uint8_t ubNetV,
uint8_t ubSubIndexV,
uint8_t ubReqCodeV )

Index 1F62 - Network Redundancy Layer Configuration.

Parameters
[in]ubNetVCANopen Network channel
[in]ubSubIndexVSub-index
[in]ubReqCodeVread / write access
Returns
SDO response code (enumeration ComSdo_e)

This object controls the transmit and receive counter deviation limits of the Network Redundancy Layer.

  • Sub-Index 0 Contains the largest Sub-Index that is supported
  • Sub-Index 1 Rx counter deviation limit
  • Sub-Index 2 Tx counter deviation limit

The function returns a SDO response code defined by the ComSdo_e enumeration. The index is only available when the symbol COM_NRL_SUPPORT is set.

◆ ComIdx1F63_NrlMonitor()

uint8_t ComIdx1F63_NrlMonitor ( uint8_t ubNetV,
uint8_t ubSubIndexV,
uint8_t ubReqCodeV )

Index 1F63 - Network Redundancy Layer Monitoring.

Parameters
[in]ubNetVCANopen Network channel
[in]ubSubIndexVSub-index
[in]ubReqCodeVread / write access
Returns
SDO response code (enumeration ComSdo_e)

This object allows to monitor the transmit and receive counter deviation values of the Network Redundancy Layer.

  • Sub-Index 0 Contains the largest Sub-Index that is supported
  • Sub-Index 1 Rx counter deviation value
  • Sub-Index 2 Tx counter deviation value

The function returns a SDO response code defined by the ComSdo_e enumeration. The index is only available when the symbol COM_NRL_SUPPORT is set.

◆ ComNrlEventHandler()

void ComNrlEventHandler ( uint8_t ubNetV,
uint8_t ubNrlStateV )
Parameters
[in]ubNetVCANopen Network channel
[in]ubNrlStateVNRL state

This handler is called by the NRL upon state change of the NRL.

◆ ComNrlFaultSimulation()

ComStatus_tv ComNrlFaultSimulation ( uint8_t ubNetV,
enum CpNrlFault_e teFaultV )

◆ ComNrlInit()

ComStatus_tv ComNrlInit ( uint8_t ubNetV,
uint8_t ubPhyIfDclV,
uint8_t ubPhyIfRclV,
CpNrlDriver_ts * ptsNrlDriverV,
uint8_t ubDeviationLimitV,
uint32_t ulMboxTimeoutV,
uint32_t ulRecoveryTimeV )
Parameters
[in]ubNetVCANopen Network channel
[in]ubPhyIfDclVPhysical interface of Default CAN Line
[in]ubPhyIfRclVPhysical interface of Redundant CAN Line
[in]ptsNrlDriverVPointer to NRL driver structure
[in]ubDeviationLimitVCounter deviation limit value
[in]ulMboxTimeoutVMailbox timeout value
[in]ulRecoveryTimeVTime to recover from NRL passive state
Returns
Error code defined by the ComErr_e enumeration. If no error occurred, the function will return the value eCOM_ERR_NONE.

This function must be called by the application program prior to any other CANopen FD Master Stack function if the Network Redundancy Layer shall be supported. It is assigned to the channel defined by ubNetV, the parameters ubPhyIfDclV and ubPhyIfRclV are used to assign the physical CAN interfaces of the driver to the Default CAN Line (DLC) and Redundant CAN Line (RCL).

The parameter ubDeviationLimitV configures the deviation limit value (refer to #CpNrlSetDeviationLimit()). The parameter ulMboxTimeoutV configures the mailbox timeout value (refer to #CpNrlSetTimeout()). The parameter ulRecoveryTimeV configures the recovery timeout value (refer to #CpNrlSetRecoveryTime()).

The function returns an error code defined the the enumeration ComErr_e.

◆ ComNrlRelease()

ComStatus_tv ComNrlRelease ( uint8_t ubNetV)
Parameters
[in]ubNetVCANopen Network channel
Returns
Error code defined by the ComErr_e enumeration. If no error occurred, the function will return the value eCOM_ERR_NONE.

This function releases the Network Reduncy Layer.

The function returns an error code defined the the enumeration ComErr_e.

◆ ComNrlSendConnectionService()

ComStatus_tv ComNrlSendConnectionService ( uint8_t ubNetV)
Parameters
[in]ubNetVCANopen Network channel
Returns
Error code defined by the ComErr_e enumeration. If no error occurred, the function will return the value eCOM_ERR_NONE.

This function triggers the transmission of the NRL connection service. The purpose of the function is verification of the CAN connection schema (DCL/RCL). Since the NRL connection service can modify the NRL state machine it shall be used sparingly.

The function returns an error code defined the the enumeration ComErr_e.

◆ ComNrlStart()

ComStatus_tv ComNrlStart ( uint8_t ubNetV)
Parameters
[in]ubNetVCANopen Network channel
Returns
Error code defined by the ComErr_e enumeration. If no error occurred, the function will return the value eCOM_ERR_NONE.

This function must be called by the application program after ComMgrInit(). It is responsible for initialisation of the NRL connection service.

The function returns an error code defined the the enumeration ComErr_e.

◆ ComNrlState()

ComStatus_tv ComNrlState ( uint8_t ubNetV,
CpNrlState_ts * ptsNrlStateV )
Parameters
[in]ubNetVCANopen Network channel
[in]ptsNrlStateVPointer to NRL state structure
Returns
Error code defined by the ComErr_e enumeration. If no error occurred, the function will return the value eCOM_ERR_NONE.

This function retrieves the current state of the NRL for the CANopen network channel defined by ubNetV.

The function returns an error code defined the the enumeration ComErr_e.

◆ ComNrlTimerEvent()

void ComNrlTimerEvent ( uint8_t ubNetV)
Parameters
[in]ubNetVCANopen Network channel

This function must be called by a timer resource of the target system. It is responsible to call the NRL fault detection and recovery. The period of the timer is defined via the symbol #CP_NRL_TIMER_PERIOD.

Example

//-------------------------------------------------------------//
// Timer service routine //
// //
//-------------------------------------------------------------//
void MyTimerService(void)
{
//... timer services of application ...
//--- Call NRL timer function -------------
}
@ eCOM_NET_1
Definition com_defs.h:728
void ComNrlTimerEvent(uint8_t ubNetV)