2.2 CAN FD Driver

2.2.1 Introduction

Overview

CAN FD (Controller Area Network Flexible Data-Rate) is a data-communication protocol typically used for broadcasting sensor data and control information on 2 wire interconnections between different parts of electronic instrumentation and control system. This protocol is generally used in modern high performance vehicles.

Features

Configurable Clock settings

  • CAN FD operating frequency .
  • Nominal(Arbitration) Bit Rate.
  • Data Bit Rate.

Configurable ISO CRC for CAN FD frames

FIFO Settings

  • Configurable FIFO for Transmit and Receive operation.
  • Configurable FIFO depth, payload and transmit priority.
  • User can provide Custom Name for the FIFOs.

Receive-Filter Settings

  • Supports both SID(11 bit) and EID(29 bit) type Message IDs.
  • 12 bit SIDs are not supported.
  • Displays Permissible ID based on Message IDs allowed for a given filter. Permissible ID is a binary depiction of Message ID that can pass through filter.

2.2.2 Module Documentation

2.2.2.1 CAN FD Driver

CAN FD Driver using dsPIC MCUs.

2.2.2.1.1 Module description

CAN FD Driver using dsPIC MCUs.

2.2.2.1.1.1 Data structures
  • struct CAN_INTERFACE

    Structure containing the function pointers of CAN driver.

  • struct CAN_MSG_FIELD

    This data structure used to configure the message fields. Some of the fields formatType and brs data should match with the CAN FD configuration in Melody MCC user interface.

  • struct CAN_MSG_OBJ

    This data structure used to configure the CAN FD message object.

2.2.2.1.1.2 Definitions
2.2.2.1.1.3 Enumerations
2.2.2.1.1.4 Functions
2.2.2.1.1.5 Variables

2.2.2.1.2 Definition Documentation

2.2.2.1.2.1 CAN1_RX_FIFO3

#define CAN1_RX_FIFO3 CAN1_FIFO_3

CAN1 Receive FIFO 3 Custom Name.

Defines the custom name of CAN1_FIFO_3 used for Receive functionality

2.2.2.1.2.2 CAN1_RX_FIFO4

#define CAN1_RX_FIFO4 CAN1_FIFO_4

CAN1 Receive FIFO 4 Custom Name.

Defines the custom name of CAN1_FIFO_4 used for Receive functionality

2.2.2.1.2.3 CAN1_RX_FIFO5

#define CAN1_RX_FIFO5 CAN1_FIFO_5

CAN1 Receive FIFO 5 Custom Name.

Defines the custom name of CAN1_FIFO_5 used for Receive functionality

2.2.2.1.2.4 CAN1_TX_FIFO1

#define CAN1_TX_FIFO1 CAN1_FIFO_1

CAN1 Transmit FIFO 1 Custom Name.

Defines the custom name of CAN1_FIFO_1 used for Transmit functionality

2.2.2.1.2.5 CAN1_TX_FIFO2

#define CAN1_TX_FIFO2 CAN1_FIFO_2

CAN1 Transmit FIFO 2 Custom Name.

Defines the custom name of CAN1_FIFO_2 used for Transmit functionality

2.2.2.1.2.6 CAN1_TX_TXQ

#define CAN1_TX_TXQ CAN1_TXQ

CAN1 Transmit FIFO TXQ Custom Name.

Defines the custom name of CAN1_TXQ used for Transmit functionality

2.2.2.1.2.7 CAN_DMA_INTERFACE_FEATURE_AVAILABLE

#define CAN_DMA_INTERFACE_FEATURE_AVAILABLE 0

This macro defines the CAN 2.0 DMA interface data update request functionality.

2.2.2.1.2.8 CAN_FD_MESSAGE_FORMAT_FEATURE_AVAILABLE

#define CAN_FD_MESSAGE_FORMAT_FEATURE_AVAILABLE 1

This macro defines the CAN FD Message format data update request functionality.

APIs Supported:  

CAN_TX_MSG_REQUEST_STATUS CANx_Transmit(const CANx_TX_FIFO_CHANNELS fifoChannel, CAN_MSG_OBJ *txCanMsg); bool CANx_Receive(CAN_MSG_OBJ *rxCanMsg); x denotes instance of CAN in CANx. Refer to device specific datasheet to check number of CAN module instance. Refer driver header file for detailed description of the APIs.

2.2.2.1.2.9 CAN_FIFO_BASED_TRANSMIT_PRIORITY_FEATURE_AVAILABLE

#define CAN_FIFO_BASED_TRANSMIT_PRIORITY_FEATURE_AVAILABLE 1

This macro defines the CAN FIFO based transmit priority data update request functionality.

APIs Supported:  

CAN_TX_MSG_REQUEST_STATUS CANx_Transmit(const CANx_TX_FIFO_CHANNELS fifoChannel, CAN_MSG_OBJ *txCanMsg); CAN_TX_FIFO_STATUS CANx_TransmitFIFOStatusGet(const CANx_TX_FIFO_CHANNELS fifoChannel);

x denotes instance of CAN in CANx. Refer to device specific datasheet to check number of CAN module instance. Refer driver header file for detailed description of the APIs.

2.2.2.1.3 Function Documentation

2.2.2.1.3.1 CAN1_BusErrorCallback()

void CAN1_BusErrorCallback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CAN1_BusErrorCallbackRegister.

Parameters:
none
Returns:

none

2.2.2.1.3.2 CAN1_BusErrorCallbackRegister()

void CAN1_BusErrorCallbackRegister (void(*)(void) handler)

This function can be used to override default callback and to define custom callback for CAN1_BusErrorCallback.

Parameters:
in handler

- Address of the callback routine

Returns:

none

2.2.2.1.3.3 CAN1_BusWakeUpActivityCallback()

void CAN1_BusWakeUpActivityCallback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CAN1_BusWakeUpActivityCallbackRegister.

Parameters:
none
Returns:

none

2.2.2.1.3.4 CAN1_BusWakeUpActivityCallbackRegister()

void CAN1_BusWakeUpActivityCallbackRegister (void(*)(void) handler)

This function can be used to override default callback and to define custom callback for CAN1_BusWakeUpActivityCallback.

Parameters:
in handler

- Address of the callback routine

Returns:

none

2.2.2.1.3.5 CAN1_Deinitialize()

void CAN1_Deinitialize (void )

Deinitializes CAN1 to POR values.

Parameters:
none
Returns:

none

2.2.2.1.3.6 CAN1_Initialize()

void CAN1_Initialize (void )

Initializes CAN1 module.

Parameters:
none
Returns:

none

2.2.2.1.3.7 CAN1_InvalidMessageCallback()

void CAN1_InvalidMessageCallback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CAN1_InvalidMessageCallbackRegister.

Parameters:
none
Returns:

none

2.2.2.1.3.8 CAN1_InvalidMessageCallbackRegister()

void CAN1_InvalidMessageCallbackRegister (void(*)(void) handler)

This function can be used to override default callback and to define custom callback for CAN1_InvalidMessageCallback.

Parameters:
in handler

- Address of the callback routine

Returns:

none

2.2.2.1.3.9 CAN1_IsBusOff()

bool CAN1_IsBusOff (void )

Returns the bus off status.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
none
Returns:

true - CAN node in Bus Off state

false - CAN node not in Bus Off state

2.2.2.1.3.10 CAN1_IsRxErrorActive()

bool CAN1_IsRxErrorActive (void )

Returns the receive error active state.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
none
Returns:

true - CAN node Error active state

false - CAN node not Error active state

2.2.2.1.3.11 CAN1_IsRxErrorPassive()

bool CAN1_IsRxErrorPassive (void )

Returns the receive error passive state.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
none
Returns:

true - CAN node Error Passive state

false - CAN node not Error Passive state

2.2.2.1.3.12 CAN1_IsRxErrorWarning()

bool CAN1_IsRxErrorWarning (void )

Returns the receive error warning state. If Receiver error counter is above 95 to below 128, then receiver error warning state is set.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
none
Returns:

true - CAN node Error warning state

false - CAN node not Error warning state

2.2.2.1.3.13 CAN1_IsTxErrorActive()

bool CAN1_IsTxErrorActive (void )

Returns the transmit error active state.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
none
Returns:

true - CAN node Error active state

false - CAN node not Error active state

2.2.2.1.3.14 CAN1_IsTxErrorPassive()

bool CAN1_IsTxErrorPassive (void )

Returns the transmit error passive state.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
none
Returns:

true - CAN node Error Passive state

false - CAN node not Error Passive state

2.2.2.1.3.15 CAN1_IsTxErrorWarning()

bool CAN1_IsTxErrorWarning (void )

Returns the transmit error warning state. If Transmitter error counter is above 95 to below 128, then transmitter error warning state is set.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
none
Returns:

true - CAN node Error warning state

false - CAN node not Error warning state

2.2.2.1.3.16 CAN1_ModeChangeCallback()

void CAN1_ModeChangeCallback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CAN1_ModeChangeCallbackRegister.

Parameters:
none
Returns:

none

2.2.2.1.3.17 CAN1_ModeChangeCallbackRegister()

void CAN1_ModeChangeCallbackRegister (void(*)(void) handler)

This function can be used to override default callback and to define custom callback for CAN1_ModeChangeCallback.

Parameters:
in handler

- Address of the callback routine

Returns:

none

2.2.2.1.3.18 CAN1_OperationModeGet()

enum CAN_OP_MODES CAN1_OperationModeGet (void )

Get the CAN1 operation mode.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
none
Returns:

Return the present CAN1 operation mode

2.2.2.1.3.19 CAN1_OperationModeSet()

enum CAN_OP_MODE_STATUS CAN1_OperationModeSet (const enum CAN_OP_MODES requestMode)

Sets the CAN1 operation mode.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
in requestMode

- CAN1 operation modes

Returns:

CAN1 Operation mode request to set.

2.2.2.1.3.20 CAN1_Receive()

bool CAN1_Receive (struct CAN_MSG_OBJ * rxCanMsg)

Reads the received single message object.

Precondition:

CAN1_Initialize() function should be called before calling this function. The CAN1_ReceivedMessageCountGet() function should be checked to see if any CAN message is received.

Parameters:
out rxCanMsg

- pointer to the message object

Returns:

true - CAN message read success

false - CAN message read fail

2.2.2.1.3.21 CAN1_ReceivedMessageCountGet()

uint8_t CAN1_ReceivedMessageCountGet (void )

Returns the number of CAN messages received in all the FIFO.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
none
Returns:

Number of messages received.

2.2.2.1.3.22 CAN1_ReceiveMessageGet()

bool CAN1_ReceiveMessageGet (const enum CAN1_RX_FIFO_CHANNELS fifoChannel, struct CAN_MSG_OBJ * rxCanMsg)

Reads the received single message object from the CAN1 receive FIFO.

Precondition:

CAN1_Initialize() function should be called before calling this function. The CAN1_ReceivedMessageCountGet() function should be checked to see if the receiver is not empty before calling this function.

Parameters:
out rxCanMsg

- pointer to the message object

Returns:

true - CAN message read success

false - CAN message read fail

2.2.2.1.3.23 CAN1_RX_FIFO_StatusGet()

uint8_t CAN1_RX_FIFO_StatusGet (const enum CAN1_RX_FIFO_CHANNELS fifoNum)

This returns the CAN1 receive FIFO status.

Precondition:

CAN1_Initialize() function should be called before calling this function

Parameters:
in fifoNum

- FIFO channel of which status is required

Returns:

Combined status of the FIFO

Note:

Use CAN_RX_FIFO_STATUS to mask individual status.

2.2.2.1.3.24 CAN1_RxBufferOverFlowCallback()

void CAN1_RxBufferOverFlowCallback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CAN1_RxBufferOverFlowCallbackRegister.

Parameters:
none
Returns:

none

2.2.2.1.3.25 CAN1_RxBufferOverFlowCallbackRegister()

void CAN1_RxBufferOverFlowCallbackRegister (void(*)(void) handler)

This function can be used to override default callback and to define custom callback for CAN1_RxBufferOverFlowCallback.

Parameters:
in handler

- Address of the callback routine

Returns:

none

2.2.2.1.3.26 CAN1_Sleep()

void CAN1_Sleep (void )

Sets the CAN node in sleep mode.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
none
Returns:

none

2.2.2.1.3.27 CAN1_SystemErrorCallback()

void CAN1_SystemErrorCallback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CAN1_SystemErrorCallbackRegister.

Parameters:
none
Returns:

none

2.2.2.1.3.28 CAN1_SystemErrorCallbackRegister()

void CAN1_SystemErrorCallbackRegister (void(*)(void) handler)

This function can be used to override default callback and to define custom callback for CAN1_SystemErrorCallback.

Parameters:
in handler

- Address of the callback routine

Returns:

none

2.2.2.1.3.29 CAN1_Tasks()

void CAN1_Tasks (void )

This routine is used to implement the tasks for polled implementations.

Precondition:

CAN1_Initialize() function should have been called before calling this function.

Parameters:
none
Returns:

none

2.2.2.1.3.30 CAN1_Transmit()

enum CAN_TX_MSG_REQUEST_STATUS CAN1_Transmit (const enum CAN1_TX_FIFO_CHANNELS fifoChannel, struct CAN_MSG_OBJ * txCanMsg)

Writes the CAN message object to specified transmit FIFO channel.

Precondition:

CAN1_Initialize() function should be called before calling this function. CAN1_TransmitFIFOStatusGet function should be called to check buffer availability in the Transmit FIFO.

Parameters:
in fifoChannel

- FIFO channel where the message object to be written

in txCanMsg

- pointer to the message object

Returns:

Returns the transmit status of type CAN_TX_MSG_REQUEST_STATUS

2.2.2.1.3.31 CAN1_TransmitFIFOStatusGet()

enum CAN_TX_FIFO_STATUS CAN1_TransmitFIFOStatusGet (const enum CAN1_TX_FIFO_CHANNELS fifoChannel)

Returns the CAN1 transmitter FIFO status.

Precondition:

CAN1_Initialize() function should be called before calling this function.

Parameters:
in fifoChannel

- CAN1 TX priority FIFO selection

Returns:

Returns the transmit status of type CAN_TX_FIFO_STATUS

2.2.2.1.3.32 CAN1_TxAttemptCallback()

void CAN1_TxAttemptCallback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CAN1_TxAttemptCallbackRegister.

Parameters:
none
Returns:

none

2.2.2.1.3.33 CAN1_TxAttemptCallbackRegister()

void CAN1_TxAttemptCallbackRegister (void(*)(void) handler)

This function can be used to override default callback and to define custom callback for CAN1_TxAttemptCallback.

Parameters:
in handler

- Address of the callback routine

Returns:

none

2.2.2.1.4 Enumeration Type Documentation

2.2.2.1.4.1 CAN1_RX_FIFO_CHANNELS

enum CAN1_RX_FIFO_CHANNELS

This enumeration defines the can receive FIFO.

CAN1_FIFO_3

CAN1 Receive FIFO 3

CAN1_FIFO_4

CAN1 Receive FIFO 4

CAN1_FIFO_5

CAN1 Receive FIFO 5

2.2.2.1.4.2 CAN1_TX_FIFO_CHANNELS

enum CAN1_TX_FIFO_CHANNELS

This enumeration defines the can Transmit FIFO Configured in MCC Melody CAN user interface.

CAN1_TXQ

CAN1 Transmit FIFO TXQ

CAN1_FIFO_1

CAN1 Transmit FIFO 1

CAN1_FIFO_2

CAN1 Transmit FIFO 2

2.2.2.1.4.3 CAN_DLC

enum CAN_DLC

Defines the CAN message payload size that are available for the mode to use.

DLC_0

Data length count 0

DLC_1

Data length count 1

DLC_2

Data length count 2

DLC_3

Data length count 3

DLC_4

Data length count 4

DLC_5

Data length count 5

DLC_6

Data length count 6

DLC_7

Data length count 7

DLC_8

Data length count 8

DLC_12

Data length count 12

DLC_16

Data length count 16

DLC_20

Data length count 20

DLC_24

Data length count 24

DLC_32

Data length count 32

DLC_48

Data length count 48

DLC_64

Data length count 64

2.2.2.1.4.4 CAN_MSG_OBJ_BRS_MODE

enum CAN_MSG_OBJ_BRS_MODE

Defines the Bit rate with enabled or disabled the CAN message object.

CAN_NON_BRS_MODE

Disable BRS Mode (Supported only in CAN FD mode)

CAN_BRS_MODE

Enable BRS Mode (Supported only in CAN FD mode)

2.2.2.1.4.5 CAN_MSG_OBJ_FRAME_TYPE

enum CAN_MSG_OBJ_FRAME_TYPE

Defines the Data frame or Remote transmit Request frame in CAN message object.

CAN_FRAME_DATA

Data Frame CAN message object

CAN_FRAME_RTR

Remote Transmit Request Frame CAN message object

2.2.2.1.4.6 CAN_MSG_OBJ_ID_TYPE

enum CAN_MSG_OBJ_ID_TYPE

Defines the Standard ID or Extended ID in CAN message object.

CAN_FRAME_STD

Standard ID CAN message object

CAN_FRAME_EXT

Extended ID CAN message object

2.2.2.1.4.7 CAN_MSG_OBJ_TYPE

enum CAN_MSG_OBJ_TYPE

Defines the CAN FD format or CAN 2.0 format in CAN message object.

CAN_2_0_FORMAT

CAN 2.0 Message format

CAN_FD_FORMAT

CAN FD Message format (Supported only in CAN FD mode)

2.2.2.1.4.8 CAN_OP_MODE_STATUS

enum CAN_OP_MODE_STATUS

Defines the CAN operation set Api return status.

CAN_OP_MODE_REQUEST_SUCCESS

Defines the requested operation mode set successfully

CAN_OP_MODE_REQUEST_FAIL

Defines the requested operation mode set failure. Set configuration mode before setting CAN normal or debug operation mode.

CAN_OP_MODE_SYS_ERROR_OCCURED

Defines the system error occurred while setting operation mode.

2.2.2.1.4.9 CAN_OP_MODES

enum CAN_OP_MODES

Defines the CAN operation modes are available for the module to use.

CAN_NORMAL_FD_MODE

CAN FD Normal Operation Mode (Supported only in CAN FD mode)

CAN_DISABLE_MODE

CAN Disable Operation Mode

CAN_INTERNAL_LOOPBACK_MODE

CAN Internal Loopback Operation Mode

CAN_LISTEN_ONLY_MODE

CAN Listen only Operation Mode

CAN_CONFIGURATION_MODE

CAN Configuration Operation Mode

CAN_EXTERNAL_LOOPBACK_MODE

CAN External loopback Operation Mode

CAN_NORMAL_2_0_MODE

CAN 2.0 Operation Mode

CAN_RESTRICTED_OPERATION_MODE

CAN Restricted Operation Mode

2.2.2.1.4.10 CAN_TX_FIFO_STATUS

enum CAN_TX_FIFO_STATUS

Defines the CAN transmit status get Api return status.

CAN_TX_FIFO_FULL

Defines the Transmit FIFO is full

CAN_TX_FIFO_AVAILABLE

Defines the Transmit FIFO is available

2.2.2.1.4.11 CAN_TX_MSG_REQUEST_STATUS

enum CAN_TX_MSG_REQUEST_STATUS

Defines the CAN transmit Api return status.

CAN_TX_MSG_REQUEST_SUCCESS

Transmit message object successfully placed into Transmit FIFO

CAN_TX_MSG_REQUEST_DLC_EXCEED_ERROR

Transmit message object DLC size is more than Transmit FIFO configured DLC size

CAN_TX_MSG_REQUEST_BRS_ERROR

Transmit FIFO is configured has Non BRS mode and CAN TX Message object has BRS enabled

CAN_TX_MSG_REQUEST_FIFO_FULL

Transmit FIFO is Full

2.2.2.1.5 Variable Documentation

2.2.2.1.5.1 CAN_FD1

const struct CAN_INTERFACE CAN_FD1

Structure object of type CAN_INTERFACE with the custom name given by the user in the Melody Driver User interface.

The default name e.g. CAN can be changed by the user in the CAN FD user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

2.2.3 Class Documentation

2.2.3.1 CAN_INTERFACE Struct Reference

Structure containing the function pointers of CAN driver.

2.2.3.1.1 Detailed Description

Structure containing the function pointers of CAN driver.

#include <can_interface.h>

2.2.3.1.1.1 Public Attributes

2.2.3.1.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

can_interface.h

2.2.3.1.2.1 BusErrorCallbackRegister

void(* BusErrorCallbackRegister) (void(*CallbackHandler)(void))

Pointer to CANx_BusErrorCallbackRegister e.g. CAN1_BusErrorCallbackRegister.

2.2.3.1.2.2 BusWakeUpActivityCallbackRegister

void(* BusWakeUpActivityCallbackRegister) (void(*CallbackHandler)(void))

Pointer to CANx_BusWakeUpActivityCallbackRegister e.g. CAN1_BusWakeUpActivityCallbackRegister.

2.2.3.1.2.3 Deinitialize

void(* Deinitialize) (void)

Pointer to CANx_Deinitialize e.g. CAN1_Deinitialize.

2.2.3.1.2.4 Initialize

void(* Initialize) (void)

Pointer to CANx_Initialize e.g. CAN1_Initialize.

2.2.3.1.2.5 InvalidMessageCallbackRegister

void(* InvalidMessageCallbackRegister) (void(*CallbackHandler)(void))

Pointer to CANx_InvalidMessageCallbackRegister e.g. CAN1_InvalidMessageCallbackRegister.

2.2.3.1.2.6 IsBusOff

bool(* IsBusOff) (void)

Pointer to CANx_IsBusOff e.g. CAN1_IsBusOff.

2.2.3.1.2.7 IsRxErrorActive

bool(* IsRxErrorActive) (void)

Pointer to CANx_IsRxErrorActive e.g. CAN1_IsRxErrorActive.

2.2.3.1.2.8 IsRxErrorPassive

bool(* IsRxErrorPassive) (void)

Pointer to CANx_IsRxErrorPassive e.g. CAN1_IsRxErrorPassive.

2.2.3.1.2.9 IsRxErrorWarning

bool(* IsRxErrorWarning) (void)

Pointer to CANx_IsRxErrorWarning e.g. CAN1_IsRxErrorWarning.

2.2.3.1.2.10 IsTxErrorActive

bool(* IsTxErrorActive) (void)

Pointer to CANx_IsTxErrorActive e.g. CAN1_IsTxErrorActive.

2.2.3.1.2.11 IsTxErrorPassive

bool(* IsTxErrorPassive) (void)

Pointer to CANx_IsTxErrorPassive e.g. CAN1_IsTxErrorPassive.

2.2.3.1.2.12 IsTxErrorWarning

bool(* IsTxErrorWarning) (void)

Pointer to CANx_IsTxErrorWarning e.g. CAN1_IsTxErrorWarning.

2.2.3.1.2.13 ModeChangeCallbackRegister

void(* ModeChangeCallbackRegister) (void(*CallbackHandler)(void))

Pointer to CANx_ModeChangeCallbackRegister e.g. CAN1_ModeChangeCallbackRegister.

2.2.3.1.2.14 OperationModeGet

enum CAN_OP_MODES(* OperationModeGet) (void)

Pointer to CANx_OperationModeGet e.g. CAN1_OperationModeGet.

2.2.3.1.2.15 OperationModeSet

enum CAN_OP_MODE_STATUS(* OperationModeSet) (const enum CAN_OP_MODES requestMode)

Pointer to CANx_OperationModeSet e.g. CAN1_OperationModeSet.

2.2.3.1.2.16 Receive

bool(* Receive) (struct CAN_MSG_OBJ *rxCanMsg)

Pointer to CANx_Receive e.g. CAN1_Receive.

2.2.3.1.2.17 ReceivedMessageCountGet

uint8_t(* ReceivedMessageCountGet) (void)

Pointer to CANx_ReceivedMessageCountGet e.g. CAN1_ReceivedMessageCountGet.

2.2.3.1.2.18 ReceiveMessageGet

bool(* ReceiveMessageGet) (const unsigned fifoChannel, struct CAN_MSG_OBJ *rxCanMsg)

Pointer to CANx_ReceiveMessageGet e.g. CAN1_ReceiveMessageGet.

2.2.3.1.2.19 RX_FIFO_StatusGet

uint8_t(* RX_FIFO_StatusGet) (const unsigned fifoNum)

Pointer to CANx_RX_FIFO_StatusGet e.g. CAN1_RX_FIFO_StatusGet.

2.2.3.1.2.20 RxBufferOverFlowCallbackRegister

void(* RxBufferOverFlowCallbackRegister) (void(*CallbackHandler)(void))

Pointer to CANx_RxBufferOverFlowCallbackRegister e.g. CAN1_RxBufferOverFlowCallbackRegister.

2.2.3.1.2.21 SleepMode

void(* SleepMode) (void)

Pointer to CANx_Sleep e.g. CAN1_Sleep.

2.2.3.1.2.22 SystemErrorCallbackRegister

void(* SystemErrorCallbackRegister) (void(*CallbackHandler)(void))

Pointer to CANx_SystemErrorCallbackRegister e.g. CAN1_SystemErrorCallbackRegister.

2.2.3.1.2.23 Tasks

void(* Tasks) (void)

Pointer to CANx_Tasks e.g. CAN1_Tasks (Supported only in polling mode)

2.2.3.1.2.24 Transmit

enum CAN_TX_MSG_REQUEST_STATUS(* Transmit) (const unsigned fifoChannel, struct CAN_MSG_OBJ *txCanMsg)

Pointer to CANx_Transmit e.g. CAN1_Transmit.

2.2.3.1.2.25 TransmitFIFOStatusGet

enum CAN_TX_FIFO_STATUS(* TransmitFIFOStatusGet) (const unsigned fifoChannel)

Pointer to CANx_TransmitFIFOStatusGet e.g. CAN1_TransmitFIFOStatusGet.

2.2.3.1.2.26 TxAttemptCallbackRegister

void(* TxAttemptCallbackRegister) (void(*CallbackHandler)(void))

Pointer to CANx_TxAttemptCallbackRegister e.g. CAN1_TxAttemptCallbackRegister.

2.2.3.2 CAN_MSG_FIELD Struct Reference

This data structure used to configure the message fields. Some of the fields formatType and brs data should match with the CAN FD configuration in Melody MCC user interface.

2.2.3.2.1 Detailed Description

This data structure used to configure the message fields. Some of the fields formatType and brs data should match with the CAN FD configuration in Melody MCC user interface.

#include <can_types.h>

2.2.3.2.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

can_types.h

2.2.3.2.2.1 brs

unsigned int brs

Enables or Disables the Bit Rate Switch

2.2.3.2.2.2 dlc

unsigned int dlc

Defines the size of the data bytes in a message format. The maximum date length is defined in MCC Melody

2.2.3.2.2.3 formatType

unsigned int formatType

Defines the message type as CAN 2.0 Format or CAN_FD Format

2.2.3.2.2.4 frameType

unsigned int frameType

Defines the message frame type as Data Frame or RTR Frame

2.2.3.2.2.5 idType

unsigned int idType

Defines the message ID type as Standard ID or Extended ID

2.2.3.3 CAN_MSG_OBJ Struct Reference

This data structure used to configure the CAN FD message object.

2.2.3.3.1 Detailed Description

This data structure used to configure the CAN FD message object.

#include <can_types.h>

2.2.3.3.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

can_types.h

2.2.3.3.2.1 data

uint8_t* data

Pointer to message data

2.2.3.3.2.2 field

struct CAN_MSG_FIELD field

Defines the CAN_MSG_FIELD CAN TX/RX Message Object Control

2.2.3.3.2.3 msgId

uint32_t msgId

Set the CAN Message ID

2.2.4 File Documentation

2.2.4.1 source/can1.h File Reference

This is the generated driver header file for the CAN1 driver using CCL.

#include <xc.h>
#include <stdbool.h>
#include <stdint.h>
#include "can_types.h"
#include "can_interface.h"

2.2.4.1.1 Functions

2.2.4.1.4 Variables

2.2.4.1.5 Detailed Description

This is the generated driver header file for the CAN1 driver using CCL.

CAN1 Generated Driver Header File

2.2.4.2 source/can_features.h File Reference

This is the generated module feature header file for CAN driver using CCL.

2.2.4.2.2 Detailed Description

This is the generated module feature header file for CAN driver using CCL.

CAN Generated Feature Header File

This file provides module feature list available on the selected device. The macros defined in this file provides the flexibility to easily migrate the user application to other device which might have varied feature list.

2.2.4.3 source/can_interface.h File Reference

#include <stdbool.h>
#include <stdint.h>
#include "can_types.h"

2.2.4.3.1 Data structures

  • struct CAN_INTERFACE

    Structure containing the function pointers of CAN driver.

2.2.4.3.2 Detailed Description

CAN Generated Driver Interface Header File

2.2.4.4 source/can_types.h File Reference

This is the generated driver types header file for the CAN driver using CCL.

#include <stdint.h>

2.2.4.4.1 Data structures

  • struct CAN_MSG_FIELD

    This data structure used to configure the message fields. Some of the fields formatType and brs data should match with the CAN FD configuration in Melody MCC user interface.

  • struct CAN_MSG_OBJ

    This data structure used to configure the CAN FD message object.

2.2.4.4.2 Enumerations

2.2.4.4.3 Detailed Description

This is the generated driver types header file for the CAN driver using CCL.

CAN Generated Driver Types Header File

2.2.4.4.4 Enumeration Type Documentation

2.2.4.4.4.1 CAN_RX_FIFO_STATUS

enum CAN_RX_FIFO_STATUS

CAN_RX_MSG_NOT_AVAILABLE
CAN_RX_MSG_AVAILABLE
CAN_RX_MSG_OVERFLOW