CANopen Master Documentation
Version 6.06.04
Loading...
Searching...
No Matches
com_conf.h File Reference

Detailed Description

The file com_conf.h holds all definitions for the configuration of the CANopen FD Master protocol stack. Please set the symbols to an appropriate value in order to achieve a specific CANopen FD Master behaviour.

Macros

#define COM_NET_MAX   1
 
#define COM_NODE_MAX   127
 
#define COM_TIMER_PERIOD   1000
 
#define COM_FD_SUPPORT   0
 
#define COM_LSS_SUPPORT   1
 
#define COM_LED_SUPPORT   0
 
#define COM_SYNC_SUPPORT   1
 
#define COM_CIA302_NV   0
 
#define COM_DICT_MAN   0
 
#define COM_DICT_OBJ_1008   0
 
#define COM_DICT_OBJ_1009   0
 
#define COM_DICT_OBJ_100A   0
 
#define COM_NMT_GUARDING   0
 
#define COM_NMT_GUARDING_FIFO_SIZE   8
 
#define COM_NMT_HEARTBEAT_CONSUMER   1
 
#define COM_NMT_FLYING_MASTER   1
 
#define COM_NMT_MASTER_PRIORITY   1
 
#define COM_SDO_CLIENT_MAX   1
 
#define COM_SDO_SRV   1
 
#define COM_SDO_SRV_SEGMENTED   1
 
#define COM_SDO_SRV_BLOCK   0
 
#define COM_USDO_CLIENT_MAX   1
 
#define COM_USDO_SRV   0
 
#define COM_SRDO_NUMBER   0
 
#define COM_SRDO_TRM_FIFO_SIZE   16
 
#define COM_PDO_RCV_MAX   32
 
#define COM_PDO_TRM_MAX   32
 
#define COM_PDO_TRM_FIFO_SIZE   16
 
#define COM_TIME_SUPPORT   1
 
#define COM_EMCY_SUPPORT   1
 
#define COM_EMCY_QUEUE   4
 
#define COM_EMCY_CONS_SUPPORT   1
 
#define COM_J1939_SUPPORT   0
 
#define COM_BUS_EMCY   0
 
#define COM_NRL_SUPPORT   0
 
#define COM_MGR_INT   1
 

Macro Definition Documentation

◆ COM_BUS_EMCY

#define COM_BUS_EMCY   0

With this symbol it is possible to enable the transmission of emergency messages upon bus errors. The functionality is handled inside the function ComMgrCanErrorHandler().

  • 0 : do not send emergency messages on bus errors
  • 1 : send emergency messages on bus errors

◆ COM_CIA302_NV

#define COM_CIA302_NV   0

Support CiA 302 Network Variables.

This symbol defines if network variables from CiA 302 are included in the dictionary.

  • 0 : do not support CiA 302 network variables
  • 1 : support CiA 302 network variables

◆ COM_DICT_MAN

#define COM_DICT_MAN   0

This symbol defines if manufacturer specific objects are included in the dictionary. A value of 0 means the manufacturer objects are not included. A value of 1 means they are included.

◆ COM_DICT_OBJ_1008

#define COM_DICT_OBJ_1008   0

Implementation of index 1008h.

This symbol defines if the object 1008h (device name) is supported by the protocol stack.

  • 0 : do not support index 1008h
  • 1 : support index 1008h

◆ COM_DICT_OBJ_1009

#define COM_DICT_OBJ_1009   0

Implementation of index 1009h.

This symbol defines if the object 1009h (hardware version) is supported by the protocol stack.

  • 0 : do not support index 1009h
  • 1 : support index 1009h

◆ COM_DICT_OBJ_100A

#define COM_DICT_OBJ_100A   0

Implementation of index 100Ah.

This symbol defines if the object 100A (software version) is supported by the protocol stack.

  • 0 : do not support index 100Ah
  • 1 : support index 100Ah

◆ COM_EMCY_CONS_SUPPORT

#define COM_EMCY_CONS_SUPPORT   1
See also
COM_EMCY_SUPPORT

The symbol defines if the EMCY Consumer service is supported. If a consumer EMCY was received the ComEmcyConsEventReceive() will be called and user can handle the event. Setting this symbol to 1 requires that COM_EMCY_SUPPORT is enabled.

A CANopen Master EMCY Consumer will be configured by ComEmcyConsSetId() and enabled by calling ComEmcyConsEnable().

  • 0 : do not support consumer EMCY messages
  • 1 : support consumer EMCY messages

◆ COM_EMCY_QUEUE

#define COM_EMCY_QUEUE   4

The symbol defines if the size of the EMCY producer message queue.

◆ COM_EMCY_SUPPORT

#define COM_EMCY_SUPPORT   1

The symbol defines if the EMCY service is supported.

  • 0 : do not support EMCY messages
  • 1 : support EMCY messages

◆ COM_FD_SUPPORT

#define COM_FD_SUPPORT   0

Support CANopen FD.

This symbol defines if the protocol stack supports CANopen FD functionality defined by the CiA 1301 specification. Support for CANopen FD also requires a CAN FD capable hardware, hence the symbol CP_CAN_FD provided by the CANpie driver must be set to 1.

Possible values for this symbol are:

  • 0 : do not support CANopen FD
  • 1 : support CANopen FD

If CANopen FD support is configured during compile time, it has to be enabled during run-time as depicted in the following example.

//------------------------------------------------------------------------------------
// Initialize the CANopen Master stack with address 1, bit-rate 500 kBit/s
//
@ eCP_BITRATE_500K
Definition canpie.h:677
@ eCP_CHANNEL_1
Definition canpie.h:732
@ eCOM_NET_1
Definition com_defs.h:723
@ eCOM_MODE_NMT_MASTER
Definition com_mgr.h:94
@ eCOM_MODE_FD
Definition com_mgr.h:118
ComStatus_tv ComMgrInit(uint8_t ubCanIfV, uint8_t ubNetV, uint8_t ubBitrateNomSelV, uint8_t ubNodeIdV, uint32_t ulModeV)

◆ COM_J1939_SUPPORT

#define COM_J1939_SUPPORT   0

The symbol defines if SAE J1939 is supported.

  • 0 : do not support SAE J1939
  • 1 : support SAE J1939

◆ COM_LED_SUPPORT

#define COM_LED_SUPPORT   0

With this symbol the LED support can be enabled. There are two LEDs supported: a Network LED and a Module LED. The Network LED denotes the state of the CANopen status machine (Operational, Stopped, Bus-Off, etc.). The optional Module LED denotes the physical state of the device (running, hardware failure, etc).

  • 0 : do not support LEDs
  • 1 : support Network LED
  • 2 : support Network and Module LEDs

◆ COM_LSS_SUPPORT

#define COM_LSS_SUPPORT   1

LSS offers the possibility to inquire and change the settings of certain parameters of the local layers on a CANopen module with LSS Slave capabilities. This switch is used to enable/disable the LSS capability. If enabled, the file com_lss.c must be included to the project.

  • 0 : do not support LSS
  • 1 : support LSS

◆ COM_MGR_INT

#define COM_MGR_INT   1

With this symbol it is possible to switch the CAN message handler (message reception) between Polling- and IRQ-mode. In Polling mode the messages are read from the buffer during the main loop. The default mode is the IRQ-mode: received CAN messages are processed inside the CAN IRQ-handler.

  • 0 : Run CAN message handler in Poll-Mode
  • 1 : Run CAN message handler in IRQ-Mode

◆ COM_NET_MAX

#define COM_NET_MAX   1

This symbol defines the maximum number of CANopen FD Master networks in a system. The value is typically equal to the number of physical CAN interfaces. The maximum number of logical CANopen networks is limited to 8.

◆ COM_NMT_FLYING_MASTER

#define COM_NMT_FLYING_MASTER   1

With this symbol it is possible to enable the NMT Flying Master functionality and protocol.

  • 0 : Disable NMT Flying Master
  • 1 : Enable NMT Flying Master

◆ COM_NMT_GUARDING

#define COM_NMT_GUARDING   0

With this symbol it is possible to enable the NMT node guarding protocol. It is disabled by default.

  • 0 : Disable NMT node guarding protocol
  • 1 : Enable NMT node guarding protocol

◆ COM_NMT_GUARDING_FIFO_SIZE

#define COM_NMT_GUARDING_FIFO_SIZE   8

This symbol defines the FIFO size for the NMT node guarding protocol. The default value is 8.

◆ COM_NMT_HEARTBEAT_CONSUMER

#define COM_NMT_HEARTBEAT_CONSUMER   1

With this symbol it is possible to enable the NMT Heartbeat consumer service. It is enabled by default. Setting this symbol to 0 means that index 1016h is not supported and the NMT state of other nodes in the network cannot be tested.

  • 0 : Disable Heartbeat Consumer
  • 1 : Enable Heartbeat Consumer

◆ COM_NMT_MASTER_PRIORITY

#define COM_NMT_MASTER_PRIORITY   1

This symbol defines the NMT master priority for the flying master negotiation procedure. Possible values are:

  • 0 : Priority high
  • 1 : Priority medium
  • 2 : Priority low

◆ COM_NODE_MAX

#define COM_NODE_MAX   127

This symbol defines the maximum number of CANopen devices in a network. The default value is 127, which is also the maximum value. A lower value has an impact on the required memory resources (lower RAM requirements).

◆ COM_NRL_SUPPORT

#define COM_NRL_SUPPORT   0

Support of Network Redundancy Layer.

With this symbol the Network Redundancy Layer (NRL) support can be enabled. In case the CANopen Master protocol stack has direct access to the NRL layer the symbol must be set to 1. When the NRL is running on a remote interface (e.g. NRL and CANpie FD driver are accessed via SPI) the symbol must be set to 2.

  • 0 : do not support NRL
  • 1 : support NRL, direct access to NRL functions
  • 2 : support NRL, remote access to NRL functions

◆ COM_PDO_RCV_MAX

#define COM_PDO_RCV_MAX   32

This symbol defines the number of receive PDOs used by the CANopen Master stack. The number can be in the range of 0 (no receive PDO) and 512 (maximum number of PDOs). The number has an impact on the required RAM size.

◆ COM_PDO_TRM_FIFO_SIZE

#define COM_PDO_TRM_FIFO_SIZE   16

This symbol defines the FIFO size for the Transmit PDOs. The default value is 16.

◆ COM_PDO_TRM_MAX

#define COM_PDO_TRM_MAX   32

This symbol defines the number of transmit PDOs used by the CANopen Master stack. The number can be in the range of 0 (no transmit PDO) and 512 (maximum number of PDOs). The number has an impact on the required RAM size.

◆ COM_SDO_CLIENT_MAX

#define COM_SDO_CLIENT_MAX   1

The symbol defines the number of SDO clients that are supported. Possible values are 1 to 127. The number has an impact on the required CAN message buffers and the code size.

◆ COM_SDO_SRV

#define COM_SDO_SRV   1

The symbol defines if a SDO server is supported. If the SDO server is disabled, an object dictionary for the CANopen Master stack is not generated.

  • 0 : Disable SDO server
  • 1 : Enable SDO server

◆ COM_SDO_SRV_BLOCK

#define COM_SDO_SRV_BLOCK   0

The symbol defines if the SDO Block transfer is supported. A value of 0 denotes that SDO Block transfer is not supported. A value greater 0 denotes the maximum number of blocks that can be transferred between master and slave. The maximum value is 127 blocks.

◆ COM_SDO_SRV_SEGMENTED

#define COM_SDO_SRV_SEGMENTED   1

The symbol defines if the segmented SDO transfer is supported. If segmented SDOs are not supported, the code size can be reduced. However, segmented SDOs are required if the data type STRING must be supported with string length greater than 4.

  • 0 : do not support segmented SDOs
  • 1 : support segmented SDOs

◆ COM_SRDO_NUMBER

#define COM_SRDO_NUMBER   0

This symbol defines the number of SRDOs which can be managed by the CANopen Master protocol stack. The allowed value range is 0 (no CANopen Safety support) to 64.

◆ COM_SRDO_TRM_FIFO_SIZE

#define COM_SRDO_TRM_FIFO_SIZE   16

This symbol defines the FIFO size for transmission of SRDOs. The default value is 16.

◆ COM_SYNC_SUPPORT

#define COM_SYNC_SUPPORT   1

The Synchronization Object is broadcasted periodically by the SYNC producer. This SYNC provides the basic network clock. This switch is used to control the SYNC capability. If enabled, the file com_sync.c must be included to the project.

The SYNC transmission can either be controlled by the protocol stack (using ComSyncSetCycleTime() to configure the cycle time) or manually be the application (using ComSyncSend()). The two options are mutually exclusive.

  • 0 : do not support SYNC
  • 1 : support SYNC, controlled by protocol stack
  • 2 : support SYNC, controlled by application

◆ COM_TIME_SUPPORT

#define COM_TIME_SUPPORT   1

The symbol defines if the TIME service is supported.

  • 0 : do not support TIME service
  • 1 : support TIME service

◆ COM_TIMER_PERIOD

#define COM_TIMER_PERIOD   1000

This symbol defines the period of the timer interrupt. The value is a multiple of 1 microsecond. It is used for timing services. Please set this value to the timer interrupt period of the target system.

Please note that the value must be at least 1000 [microseconds], because all CANopen services use a multiple of 1 millisecond.

◆ COM_USDO_CLIENT_MAX

#define COM_USDO_CLIENT_MAX   1

The symbol defines the number of USDO clients that are supported. Possible values are 1 to 127. The number has an impact on the required CAN message buffers and the code size.

◆ COM_USDO_SRV

#define COM_USDO_SRV   0

The symbol defines if a USDO server is supported. If the USDO server is disabled, an object dictionary for the CANopen Master stack is not generated. The USDO server is only avaliable if CAN FD support is available (see COM_FD_SUPPORT).

  • 0 : Disable SDO server
  • 1 : Enable SDO server