Application note 0565-01: Aurix gateway mode

This document is an amendment to the implementation from Infineon Aurix TC23x CANopen driver from port.

The gateway mode makes it possible to logically link two CAN channels within a CAN controller, so that you can generate a logical total bus from two physically separated sub CAN-busses.

For further explanation excerpt from the Aurix User’s Manual:

 

This configuration is also possible on both CAN nodes at the same time, so that each of the two nodes can act as source and destination at the same time. So, it is possible to generate a logical total bus.

Implementation and which user action is needed:

The activation and the properties of the gateway mode can be configured by the Design Tool “Advanced Configuration” as follow:

compiler define

explanation

CONFIG_CAN_GATEWAY_MODE

Available gateway mode (if defined)

CONFIG_CAN_MULTICAN_NODE_GATEWAY_SOURCE

First node for gateway (should be equal to the design tool assigned node)

CONFIG_CAN_MULTICAN_NODE_GATEWAY_DESTINATION 

Second node for gateway

 

The selection should be 2 nodes from the same CAN module.

For example, the default configuration from the delivery (example s1_aurix_tc32x_gateway):

/* available the gateway mode, only the gateway source code is involved */ #define CONFIG_CAN_GATEWAY_MODE                                 1 /* parameter for feature dynamically gateway mode */ #define CONFIG_CAN_GATEWAY_MODE_INACTIVE  0 #define CONFIG_CAN_GATEWAY_MODE_ACTIVE     1 /* first source node for gateway (default the design tool selected node) */ #define CONFIG_CAN_MULTICAN_NODE_GATEWAY_SOURCE CONFIG_CAN_MULTICAN_NODE /* next define the second node for the gateway */ #define CONFIG_CAN_MULTICAN_NODE_GATEWAY_DESTINATION  2

 

Additional Feature activate gateway mode dynamically: (possible from driver patch196)

For gateway operation, the driver provides an additional function that must be called by the application before the CAN driver is initialized. The decision whether to operate a gateway must be made by the application. The switch variable “Gateway” is only a placeholder in following code snippet.

if this function not called, the gateway mode in the driver is deactivated by default.

Possible implementing in main.c (example s1_aurix_tc32x_gateway):

if (Gateway == TRUE) {   /* activate gateway mode */     Set_CAN_GatewayMode(CONFIG_CAN_GATEWAY_MODE_ACTIVE); else {     /* deactivate gateway mode */   Set_CAN_GatewayMode(CONFIG_CAN_GATEWAY_MODE_INACTIVE); } /*--- initialize CAN controller ---------------*/ ret = initCan(bitRate);

Gateway mode Restrictions:

  • only BasicCAN mode is supported

  • CANopen device on Aurix is a CANopen Single Line implementation (no Multiline supported)

  • no CAN Remote Requests (RTR) are supported

  • there are always only 2 CAN nodes connected via "Gateway"

  • which CAN-Nodes will be connected are determined at compile time

  • the decision if gateway operation is activated in a project is closed when the software initialize the CAN driver. Switching during "running CAN operation" is not intended.