4.3 CAN FD - Controller Area Network Flexible Data-Rate

4.3.1 Introduction

The MPLAB® Code Configurator (MCC) Melody CAN 2.0/CAN FD Peripheral Library (PLIBs) drivers generates APIs to support CAN 2.0/CAN FD-specific peripheral functionality on target MCUs. This PLIB is supported by the Melody CAN 2.0 and CAN FD Drivers. Please refer to 3.1 CAN 2.0/CAN FD Driver for more details on the portable abstract interface and use case examples.

This reference document covers implementation of the CAN FD PLIB only. The APIs supported by CAN FD and CAN 2.0 are almost similar. The additional features supported by CAN FD are mentioned wherever applicable. PIC18F-Q83 family of devices does not support CAN FD mode.

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

4.3.2 Supported Device Families

PIC18F-Q83 PIC18F-Q84

4.3.3 Required Header Files

#include "mcc_generated_files/can/can1.h"

4.3.4 Module Documentation

4.3.4.1 CAN FD DRIVER

This file contains API prototypes and other data types for the CAN1 driver.

4.3.4.1.1 Module description

This file contains API prototypes and other data types for the CAN1 driver.

Note: This reference document uses CAN1_TXQ, CAN1_FIFO_1 for transmit functionality and CAN1_FIFO_2, CAN1_FIFO_3 for receive functionality.

Version: CAN Driver Version 1.0.0
Data structures
  • struct CAN1_FIFOREG

    Defines a structure to access CAN1 FIFO Registers.

  • struct CAN1_RX_FIFO_MSG

    CAN1 Receive FIFO Message Object head count information maintenance data structure.

  • struct CAN_MSG_FIELD

    Used to configure the message fields of CAN frame.

  • struct CAN_MSG_OBJ

    Used to configure the message object of CAN frame.

Definitions
Enumerations
Functions
Variables
  • const struct CAN_INTERFACE CAN_FD1

    Structure object of type CAN_INTERFACE with the custom name given by the user.

4.3.4.1.2 Definition Documentation

CAN1_RX_FIFO2

#define CAN1_RX_FIFO2 CAN1_FIFO_2

CAN1 Receive FIFO 2 Custom Name.

Defines the custom name of CAN1_FIFO_2 used for Receive functionality.

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.

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.

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.

CAN_DMA_INTERFACE_FEATURE_AVAILABLE

#define CAN_DMA_INTERFACE_FEATURE_AVAILABLE 0

Defines the CAN 2.0 DMA interface data update request functionality.

CAN_FD1_BusErrorCallbackRegister

#define CAN_FD1_BusErrorCallbackRegister CAN1_BusErrorCallbackRegister

Defines the Custom Name for CAN1_BusErrorCallbackRegister() API.

CAN_FD1_BusWakeUpActivityCallbackRegister

#define CAN_FD1_BusWakeUpActivityCallbackRegister CAN1_BusWakeUpActivityCallbackRegister

Defines the Custom Name for CAN1_BusWakeUpActivityCallbackRegister() API.

CAN_FD1_Deinitialize

#define CAN_FD1_Deinitialize CAN1_Deinitialize

Defines the Custom Name for CAN1_Deinitialize() API.

CAN_FD1_Initialize

#define CAN_FD1_Initialize CAN1_Initialize

Defines the Custom Name for CAN1_Initialize() API.

CAN_FD1_InvalidMessageCallbackRegister

#define CAN_FD1_InvalidMessageCallbackRegister CAN1_InvalidMessageCallbackRegister

Defines the Custom Name for CAN1_InvalidMessageCallbackRegister() API.

CAN_FD1_IsBusOff

#define CAN_FD1_IsBusOff CAN1_IsBusOff

Defines the Custom Name for CAN1_IsBusOff() API.

CAN_FD1_IsRxErrorActive

#define CAN_FD1_IsRxErrorActive CAN1_IsRxErrorActive

Defines the Custom Name for CAN1_IsRxErrorActive() API.

CAN_FD1_IsRxErrorPassive

#define CAN_FD1_IsRxErrorPassive CAN1_IsRxErrorPassive

Defines the Custom Name for CAN1_IsRxErrorPassive() API.

CAN_FD1_IsRxErrorWarning

#define CAN_FD1_IsRxErrorWarning CAN1_IsRxErrorWarning

Defines the Custom Name for CAN1_IsRxErrorWarning() API.

CAN_FD1_IsTxErrorActive

#define CAN_FD1_IsTxErrorActive CAN1_IsTxErrorActive

Defines the Custom Name for CAN1_IsTxErrorActive() API.

CAN_FD1_IsTxErrorPassive

#define CAN_FD1_IsTxErrorPassive CAN1_IsTxErrorPassive

Defines the Custom Name for CAN1_IsTxErrorPassive() API.

CAN_FD1_IsTxErrorWarning

#define CAN_FD1_IsTxErrorWarning CAN1_IsTxErrorWarning

Defines the Custom Name for CAN1_IsTxErrorWarning() API.

CAN_FD1_ModeChangeCallbackRegister

#define CAN_FD1_ModeChangeCallbackRegister CAN1_ModeChangeCallbackRegister

Defines the Custom Name for CAN1_ModeChangeCallbackRegister() API.

CAN_FD1_OperationModeGet

#define CAN_FD1_OperationModeGet CAN1_OperationModeGet

Defines the Custom Name for CAN1_OperationModeGet() API.

CAN_FD1_OperationModeSet

#define CAN_FD1_OperationModeSet CAN1_OperationModeSet

Defines the Custom Name for CAN1_OperationModeSet() API.

CAN_FD1_Receive

#define CAN_FD1_Receive CAN1_Receive

Defines the Custom Name for CAN1_Receive() API.

CAN_FD1_ReceivedMessageCountGet

#define CAN_FD1_ReceivedMessageCountGet CAN1_ReceivedMessageCountGet

Defines the Custom Name for CAN1_ReceivedMessageCountGet() API.

CAN_FD1_ReceiveFIFOStatusGet

#define CAN_FD1_ReceiveFIFOStatusGet CAN1_ReceiveFIFOStatusGet

Defines the Custom Name for CAN1_ReceiveFIFOStatusGet() API.

CAN_FD1_ReceiveMessageGet

#define CAN_FD1_ReceiveMessageGet CAN1_ReceiveMessageGet

Defines the Custom Name for CAN1_ReceiveMessageGet() API.

CAN_FD1_RxBufferOverFlowCallbackRegister

#define CAN_FD1_RxBufferOverFlowCallbackRegister CAN1_RxBufferOverFlowCallbackRegister

Defines the Custom Name for CAN1_RxBufferOverFlowCallbackRegister() API.

CAN_FD1_Sleep

#define CAN_FD1_Sleep CAN1_Sleep

Defines the Custom Name for CAN1_Sleep() API.

CAN_FD1_SystemErrorCallbackRegister

#define CAN_FD1_SystemErrorCallbackRegister CAN1_SystemErrorCallbackRegister

Defines the Custom Name for CAN1_SystemErrorCallbackRegister() API.

CAN_FD1_Tasks

#define CAN_FD1_Tasks CAN1_Tasks

Defines the Custom Name for CAN1_Tasks() API.

CAN_FD1_Transmit

#define CAN_FD1_Transmit CAN1_Transmit

Defines the Custom Name for CAN1_Transmit() API.

CAN_FD1_TransmitFIFOStatusGet

#define CAN_FD1_TransmitFIFOStatusGet CAN1_TransmitFIFOStatusGet

Defines the Custom Name for CAN1_TransmitFIFOStatusGet() API.

CAN_FD1_TxAttemptCallbackRegister

#define CAN_FD1_TxAttemptCallbackRegister CAN1_TxAttemptCallbackRegister

Defines the Custom Name for CAN1_TxAttemptCallbackRegister() API.

CAN_FD_MESSAGE_FORMAT_FEATURE_AVAILABLE

#define CAN_FD_MESSAGE_FORMAT_FEATURE_AVAILABLE 1

Defines the CAN FD Message format data update request functionality.

Note:

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 in CANx denotes the instance number of CAN. Refer to the specific device data sheet to check the number of CAN peripherals present in the device. Refer to the driver header file for detailed description of the APIs.
CAN_FIFO_BASED_TRANSMIT_PRIORITY_FEATURE_AVAILABLE

#define CAN_FIFO_BASED_TRANSMIT_PRIORITY_FEATURE_AVAILABLE 1

Defines the CAN FIFO based transmit priority data update request functionality.

Note:

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 in CANx denotes the instance number of CAN. Refer to the specific device data sheet to check the number of CAN peripherals present in the device. Refer to the driver header file for detailed description of the APIs.

4.3.4.1.3 Function Documentation

CAN1_BitRateConfiguration()

static void CAN1_BitRateConfiguration (void )[static]

Configures the CAN1 Bit rate settings.

Parameters:
None.
Returns:

None.

CAN1_BusErrorCallbackRegister()

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

Setter function for the CAN1_BusError callback.

Parameters:
in handler

- Pointer to the callback routine.

Returns:

None.

CAN1_BusWakeUpActivityCallbackRegister()

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

Setter function for the CAN1_BusWakeUpActivity callback.

Parameters:
in handler

- Pointer to the callback routine.

Returns:

None.

CAN1_Deinitialize()

void CAN1_Deinitialize (void )

Resets the CAN1 registers and settings to their POR values.

Parameters:
None.
Returns:

None.

CAN1_DlcToDataBytesGet()

static uint8_t CAN1_DlcToDataBytesGet (const enum CAN_DLC dlc)[static]

Get the DLC enum based data byte value.

Parameters:
in dlc

- DLC value as described in CAN_DLC.

Returns:

The data byte value coresponding to DLC.

CAN1_ErrorNotificationEnable()

static void CAN1_ErrorNotificationEnable (void )[static]

Enables the CAN1 error notification interrupt.

Parameters:
None.
Returns:

None.

CAN1_FIFO1HalfEmptyCallbackRegister()

void CAN1_FIFO1HalfEmptyCallbackRegister (void (*handler)(void))

Setter function for the CAN1_FIFO1HalfEmpty callback.

Parameters:
in handler

- Pointer to the callback routine.

Returns:

None.

CAN1_FIFO2NotEmptyCallbackRegister()

void CAN1_FIFO2NotEmptyCallbackRegister (void (*handler)(void))

Setter function for the CAN1_FIFO2NotEmpty callback.

Parameters:
in handler

- Pointer to the callback routine.

Returns:

None.

CAN1_FIFO3FullCallbackRegister()

void CAN1_FIFO3FullCallbackRegister (void (*handler)(void))

Setter function for the CAN1_FIFO3Full callback.

Parameters:
in handler

- Pointer to the callback routine.

Returns:

None.

CAN1_GetRxFifoDepth()

static uint8_t CAN1_GetRxFifoDepth (uint8_t validChannel)[static]

Returns the CAN1 Receive FIFO depth.

Parameters:
in validChannel

- Receive FIFO channel as described in CAN_RX_FIFO_CHANNELS.

Returns:

Depth of the Receive FIFO.

CAN1_GetRxFifoStatus()

static uint8_t CAN1_GetRxFifoStatus (uint8_t validChannel)[static]

Returns the CAN1 Receive FIFO status.

Parameters:
in validChannel

- Receive FIFO channel as described in CAN_RX_FIFO_CHANNELS.

Returns:

Status of the CAN1 Receive FIFO. Refer CAN_RX_FIFO_STATUS for details.

CAN1_GetTxFifoStatus()

static enum CAN_TX_FIFO_STATUS CAN1_GetTxFifoStatus (uint8_t validChannel)[static]

Returns the CAN1 transmit FIFO status.

Parameters:
in channel

- Transmit FIFO channel as described in CAN_TX_FIFO_CHANNELS.

Returns:

Status of the CAN1 Transmit FIFO as described in CAN_TX_FIFO_STATUS.

CAN1_Initialize()

void CAN1_Initialize (void )

Initializes the CAN1 module.

Parameters:
None.
Returns:

None.

CAN1_InvalidMessageCallbackRegister()

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

Setter function for the CAN1_InvalidMessage callback.

Parameters:
in handler

- Pointer to the callback routine.

Returns:

None.

CAN1_IsBusOff()

bool CAN1_IsBusOff (void )

Returns the Bus Off status.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
None.
Return values:
True

- CAN1 node is in Bus Off state.

False

- CAN1 node is not in Bus Off state.

CAN1_IsRxChannel()

static bool CAN1_IsRxChannel (uint8_t channel)[static]

Checks if a valid channel is configured as receiver or not.

Parameters:
in channel

- Receive FIFO channel as described in CAN_RX_FIFO_CHANNELS.

Return values:
True

- FIFO channel is configured as receiver.

False

- FIFO channel is not configured as receiver.

CAN1_IsRxErrorActive()

bool CAN1_IsRxErrorActive (void )

Returns the Receive Error Active state. If the Receive Error Counter is above 0 and below 128, then the receiver is in Error Active state.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
None.
Return values:
True

- CAN1 node is in Receive Error Active state.

False

- CAN1 node is not in Receive Error Active state.

CAN1_IsRxErrorPassive()

bool CAN1_IsRxErrorPassive (void )

Returns the Receive Error Passive state. If the Receive Error Counter is above 127, then the receiver is in Error Passive state.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
None.
Return values:
True

- CAN1 node is in Receive Error Passive state.

False

- CAN1 node is not in Receive Error Passive state.

CAN1_IsRxErrorWarning()

bool CAN1_IsRxErrorWarning (void )

Returns the Receive Error Warning state. If the Receive Error Counter is above 95 and below 128, then the receiver is in Error Warning state.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
None.
Return values:
True

- CAN1 node is in Receive Error Warning state.

False

- CAN1 node is not in Receive Error Warning state.

CAN1_IsTxChannel()

static bool CAN1_IsTxChannel (uint8_t channel)[static]

Check if a valid channel is configured as transmitter or not.

Parameters:
in channel

- Transmit FIFO channel as described in CAN_TX_FIFO_CHANNELS.

Return values:
True

- FIFO channel is configured as transmitter.

False

- FIFO channel is not configured as transmitter.

CAN1_IsTxErrorActive()

bool CAN1_IsTxErrorActive (void )

Returns the Transmit Error Active state. If the Transmit Error Counter is above 0 and below 128, then the transmitter is in Error Active state.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
None.
Return values:
True

- CAN1 node is in Transmit Error Active state.

False

- CAN1 node is not in Transmit Error Active state.

CAN1_IsTxErrorPassive()

bool CAN1_IsTxErrorPassive (void )

Returns the Transmit Error Passive state. If the Transmit Error Counter is above 127, then the transmitter is in Error Passive state.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
None.
Return values:
True

- CAN1 node is in Transmit Error Passive state.

False

- CAN1 node is not in Transmit Error Passive state.

CAN1_IsTxErrorWarning()

bool CAN1_IsTxErrorWarning (void )

Returns the Transmit Error Warning state. If the Transmit Error Counter is above 95 and below 128, then the transmitter is in Error Warning state.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
None.
Return values:
True

- CAN1 node is in Transmit Error Warning state.

False

- CAN1 node is not in Transmit Error Warning state.

CAN1_MessageReadFromFifo()

static void CAN1_MessageReadFromFifo (uint8_t * rxFifoObj, struct CAN_MSG_OBJ * rxCanMsg)[static]

Reads the message object from Receive FIFO and updates the user message object.

Parameters:
in rxFifoObj

- Receive FIFO message object.

out rxCanMsg

- Pointer to the message object of type CAN_MSG_OBJ.

Returns:

None.

CAN1_MessageWriteToFifo()

static void CAN1_MessageWriteToFifo (uint8_t * txFifoObj, struct CAN_MSG_OBJ * txCanMsg)[static]

Reads the message object from user input and updates the CAN1 TX FIFO.

Parameters:
out txFifoObj

- Transmit FIFO message object.

in txCanMsg

- Pointer to the message object of type CAN_MSG_OBJ.

Returns:

None.

CAN1_ModeChangeCallbackRegister()

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

Setter function for the CAN1_ModeChange callback.

Parameters:
in handler

- Pointer to the callback routine.

Returns:

None.

CAN1_OperationModeGet()

enum CAN_OP_MODES CAN1_OperationModeGet (void )

Gets the CAN1 Operation mode.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
None.
Returns:

The present CAN1 Operation mode as described in CAN_OP_MODES.

CAN1_OperationModeSet()

enum CAN_OP_MODE_STATUS CAN1_OperationModeSet (const enum CAN_OP_MODES requestMode)

Sets the CAN1 Operation mode.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
in requestMode

- CAN1 Operation mode as described in CAN_OP_MODES.

Returns:

Status of request to set the CAN1 Operation mode as described in CAN_OP_MODE_STATUS.

CAN1_PLSIZEToPayloadBytesGet()

static uint8_t CAN1_PLSIZEToPayloadBytesGet (uint8_t plsize)[static]

Get the Payload size in bytes for PLSIZE register value.

Parameters:
in plsize

- The value in PLSIZE register.

Returns:

The number of data bytes corresponding to PLSIZE register value.

CAN1_Receive()

bool CAN1_Receive (struct CAN_MSG_OBJ * rxCanMsg)

Reads a message object.

Precondition:

CAN1_Initialize() function is already called. The CAN1_ReceivedMessageCountGet() function is called to check if any CAN message is received.

Parameters:
out rxCanMsg

- Pointer to the message object of type CAN_MSG_OBJ.

Return values:
True

- CAN1 message read succeeded.

False

- CAN1 message read failed.

CAN1_ReceivedMessageCountGet()

uint8_t CAN1_ReceivedMessageCountGet (void )

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

Precondition:

CAN1_Initialize() function is already called.

Parameters:
None.
Returns:

Number of messages received.

CAN1_ReceiveFIFOStatusGet()

uint8_t CAN1_ReceiveFIFOStatusGet (const enum CAN_RX_FIFO_CHANNELS fifoChannel)

Returns the CAN1 receiver FIFO status.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
in fifoChannel

- Receive FIFO channel as described in CAN_RX_FIFO_CHANNELS.

Returns:

Status of the CAN1 Receive FIFO. Refer to CAN_RX_FIFO_STATUS for details.

CAN1_ReceiveFromFiFo()

static bool CAN1_ReceiveFromFiFo (uint8_t index, enum CAN_RX_FIFO_CHANNELS channel, struct CAN_MSG_OBJ * rxCanMsg)[static]

Reads the data object from a particular CAN receive FIFO.

Parameters:
in index

- Instance of Receive FIFO.

in channel

- Receive FIFO channel as described in CAN_RX_FIFO_CHANNELS.

out rxCanMsg

- Pointer to the message object of type CAN_MSG_OBJ.

Return values:
True

- CAN1 message read succeeded.

False

- CAN1 message read failed.

CAN1_ReceiveMessageGet()

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

Reads a message object from the selected CAN1 receive FIFO.

Precondition:

CAN1_Initialize() function is already called. The CAN1_ReceiveFIFOStatusGet() function is called to check the status of the respective CAN1 receive FIFO.

Parameters:
in fifoChannel

- Receive FIFO channel as described in CAN_RX_FIFO_CHANNELS from where the message object is to be read.

out rxCanMsg

- Pointer to the message object of type CAN_MSG_OBJ.

Return values:
True

- CAN1 message read succeeded.

False

- CAN1 message read failed.

CAN1_RX_FIFO_Configuration()

static void CAN1_RX_FIFO_Configuration (void )[static]

Configures the CAN1 Receive FIFO settings.

Parameters:
None.
Returns:

None.

CAN1_RX_FIFO_FilterMaskConfiguration()

static void CAN1_RX_FIFO_FilterMaskConfiguration (void )[static]

Configures the CAN1 RX FIFO filter and mask settings.

Parameters:
None.
Returns:

None.

CAN1_RX_FIFO_ResetInfo()

static void CAN1_RX_FIFO_ResetInfo (void )[static]

Resets the CAN1 receive message head count.

Parameters:
None.
Returns:

None.

CAN1_RxBufferOverFlowCallbackRegister()

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

Setter function for the CAN1_RxBufferOverFlow callback.

Parameters:
in handler

- Pointer to the callback routine.

Returns:

None.

CAN1_Sleep()

void CAN1_Sleep (void )

Puts the CAN1 node into Sleep mode.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
None.
Returns:

None.

CAN1_SystemErrorCallbackRegister()

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

Setter function for the CAN1_SystemError callback.

Parameters:
in handler

- Pointer to the callback routine.

Returns:

None.

CAN1_Tasks()

void CAN1_Tasks (void )

Used to implement the tasks for polled implementations.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
None.
Returns:

None.

CAN1_Transmit()

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

Writes the CAN message object to the specified transmit FIFO channel.

Precondition:

CAN1_Initialize() function is already called. CAN1_TransmitFIFOStatusGet function is called to check buffer availability in the Transmit FIFO.

Parameters:
in fifoChannel

- Transmit FIFO channel as described in CAN_TX_FIFO_CHANNELS where the message object is to be written.

in txCanMsg

- Pointer to the message object of type CAN_MSG_OBJ.

Returns:

Status of the CAN1 Transmit operation as described in CAN_TX_MSG_REQUEST_STATUS.

CAN1_TransmitFIFOStatusGet()

enum CAN_TX_FIFO_STATUS CAN1_TransmitFIFOStatusGet (const enum CAN_TX_FIFO_CHANNELS fifoChannel)

Returns the CAN1 transmitter FIFO status.

Precondition:

CAN1_Initialize() function is already called.

Parameters:
in fifoChannel

- Transmit FIFO channel as described in CAN_TX_FIFO_CHANNELS.

Returns:

Status of the CAN1 Transmit FIFO as described in CAN_TX_FIFO_STATUS.

CAN1_TX_FIFO_Configuration()

static void CAN1_TX_FIFO_Configuration (void )[static]

Configures the CAN1 TX FIFO settings.

Parameters:
None.
Returns:

None.

CAN1_TxAttemptCallbackRegister()

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

Setter function for the CAN1_TxAttempt callback.

Parameters:
in handler

- Pointer to the callback routine.

Returns:

None.

CAN1_TXQEmptyCallbackRegister()

void CAN1_TXQEmptyCallbackRegister (void (*handler)(void))

Setter function for the CAN1_TXQEmpty callback.

Parameters:
in handler

- Pointer to the callback routine.

Returns:

None.

CAN1_ValidateTransmission()

static enum CAN_TX_MSG_REQUEST_STATUS CAN1_ValidateTransmission (uint8_t channel, struct CAN_MSG_OBJ * txCanMsg)[static]

Validates transmission.

Parameters:
in channel

- Transmit FIFO channel as described in CAN_TX_FIFO_CHANNELS.

in txCanMsg

- Pointer to the message object of type CAN_MSG_OBJ.

Returns:

Status of the CAN1 Transmit operation as described in CAN_TX_MSG_REQUEST_STATUS.

4.3.4.1.4 Enumeration Type Documentation

CAN_DLC

enum CAN_DLC

Defines the CAN message payload sizes 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 (Supported only in CAN FD mode)

DLC_16

Data length count 16 (Supported only in CAN FD mode)

DLC_20

Data length count 20 (Supported only in CAN FD mode)

DLC_24

Data length count 24 (Supported only in CAN FD mode)

DLC_32

Data length count 32 (Supported only in CAN FD mode)

DLC_48

Data length count 48 (Supported only in CAN FD mode)

DLC_64

Data length count 64 (Supported only in CAN FD mode)

CAN_MSG_OBJ_BRS_MODE

enum CAN_MSG_OBJ_BRS_MODE

Defines if the bit rate switching is enabled or disabled in 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)

CAN_MSG_OBJ_FRAME_TYPE

enum CAN_MSG_OBJ_FRAME_TYPE

Defines if the frame type is 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 (Supported only in CAN 2.0 mode)

CAN_MSG_OBJ_ID_TYPE

enum CAN_MSG_OBJ_ID_TYPE

Defines if the message ID is 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

CAN_MSG_OBJ_TYPE

enum CAN_MSG_OBJ_TYPE

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

CAN_2_0_FORMAT

CAN 2.0 Message format

CAN_FD_FORMAT

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

CAN_OP_MODE_STATUS

enum CAN_OP_MODE_STATUS

Defines the return status of CAN operation mode set API.

CAN_OP_MODE_REQUEST_SUCCESS

The requested operation mode set successfully

CAN_OP_MODE_REQUEST_FAIL

The requested operation mode set failure

CAN_OP_MODE_SYS_ERROR_OCCURED

The system error occurred while setting operation mode.

CAN_OP_MODES

enum CAN_OP_MODES

Defines the CAN operation modes that 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

CAN_RX_FIFO_CHANNELS

enum CAN_RX_FIFO_CHANNELS

Defines the CAN FIFOs configured as receive.

CAN1_FIFO_2

CAN1 Receive FIFO 2

CAN1_FIFO_3

CAN1 Receive FIFO 3

CAN_RX_FIFO_MAX

This is added to avoid empty enum

CAN_RX_FIFO_STATUS

enum CAN_RX_FIFO_STATUS

Defines the CAN FD receive FIFO status bit mask values.

CAN_RX_MSG_NOT_AVAILABLE

Message is not available in receive FIFO

CAN_RX_MSG_AVAILABLE

Message is available in receive FIFO

CAN_RX_MSG_OVERFLOW

Receive FIFO has overflowed

CAN_TX_FIFO_CHANNELS

enum CAN_TX_FIFO_CHANNELS

Defines the CAN FIFOs configured as transmit.

CAN1_TXQ

CAN1 Transmit FIFO TXQ

CAN1_FIFO_1

CAN1 Transmit FIFO 1

CAN_TX_FIFO_MAX

This is added to avoid empty enum

CAN_TX_FIFO_STATUS

enum CAN_TX_FIFO_STATUS

Defines the status of CAN FD transmit FIFO.

CAN_TX_FIFO_FULL

Transmit FIFO is full

CAN_TX_FIFO_AVAILABLE

Transmit FIFO is available

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 the Transmit FIFO configured DLC size

CAN_TX_MSG_REQUEST_BRS_ERROR

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

CAN_TX_MSG_REQUEST_FIFO_FULL

Transmit FIFO is Full

4.3.4.1.5 Variable Documentation

CAN_FD1

const struct CAN_INTERFACE CAN_FD1

Structure object of type CAN_INTERFACE with the custom name given by the user.

4.3.5 Class Documentation

4.3.5.1 CAN1_FIFOREG Struct Reference

Defines a structure to access CAN1 FIFO Registers.

4.3.5.1.1 Detailed Description

Defines a structure to access CAN1 FIFO Registers.

4.3.5.1.2 Member Data Documentation

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

source/

can1_interrupt.c

source/

can1_polling.c

CONH

uint8_t CONH

CONL

uint8_t CONL

CONT

uint8_t CONT

CONU

uint8_t CONU

STAH

uint8_t STAH

STAL

uint8_t STAL

STAT

uint8_t STAT

STAU

uint8_t STAU

UA

uint32_t UA

4.3.5.2 CAN1_RX_FIFO_MSG Struct Reference

CAN1 Receive FIFO Message Object head count information maintenance data structure.

4.3.5.2.1 Detailed Description

CAN1 Receive FIFO Message Object head count information maintenance data structure.

4.3.5.2.2 Member Data Documentation

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

source/

can1_interrupt.c

source/

can1_polling.c

channel

enum CAN_RX_FIFO_CHANNELS channel

headCount

uint8_t headCount

4.3.5.3 CAN_MSG_FIELD Struct Reference

Used to configure the message fields of CAN frame.

4.3.5.3.1 Detailed Description

Used to configure the message fields of CAN frame.

#include <can_types.h>

4.3.5.3.2 Member Data Documentation

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

source/

can_types.h

brs

uint8_t brs

Enables or Disables the Bit Rate Switch (width:1 bit)

dlc

uint8_t dlc

Defines the size of the data bytes in a message frame. The maximum DLC is 8 for CAN 2.0 and 64 for CAN FD (width: 4 bit)

formatType

uint8_t formatType

Defines the message type as CAN 2.0 Format or CAN_FD Format (width: 1 bit)

frameType

uint8_t frameType

Defines the message frame type as Data Frame or RTR Frame (1 bit)

idType

uint8_t idType

Defines the message ID type as Standard ID or Extended ID (width: 1 bit)

4.3.5.4 CAN_MSG_OBJ Struct Reference

Used to configure the message object of CAN frame.

4.3.5.4.1 Detailed Description

Used to configure the message object of CAN frame.

#include <can_types.h>

4.3.5.4.2 Member Data Documentation

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

source/

can_types.h

data

uint8_t* data

Pointer to message data

field

struct CAN_MSG_FIELD field

For CAN TX/RX Message Object Control

msgId

uint32_t msgId

Set the CAN Message ID (EID <17:0> | SID <10:0>)

4.3.6 File Documentation

4.3.6.1 source/can1_interrupt.c File Reference

#include <string.h>
#include "../can1.h"

4.3.6.1.1 Data structures

  • struct CAN1_FIFOREG

    Defines a structure to access CAN1 FIFO Registers.

  • struct CAN1_RX_FIFO_MSG

    CAN1 Receive FIFO Message Object head count information maintenance data structure.

4.3.6.1.2 Functions

4.3.6.1.4 CAN1 Message object arbitration and control field information

Macros for the CAN1 Message object arbitration and control field.

4.3.6.1.5 Variables

4.3.6.1.6 Function Documentation

__interrupt(irq(CAN))

void __interrupt (irq(CAN) , base(8) )

__interrupt(irq(CANRX))

void __interrupt (irq(CANRX) , base(8) )

__interrupt(irq(CANTX))

void __interrupt (irq(CANTX) , base(8) )

4.3.6.1.7 Macro Definition Documentation

CAN1_NUM_OF_RX_FIFO

#define CAN1_NUM_OF_RX_FIFO (2U)

CAN1_RX_FIFO_MSG_DATA

#define CAN1_RX_FIFO_MSG_DATA (64U)

CAN_MSG_OBJ_BRS_FIELD_MASK

#define CAN_MSG_OBJ_BRS_FIELD_MASK (0x40U)

CAN_MSG_OBJ_BRS_POSN

#define CAN_MSG_OBJ_BRS_POSN (0x6U)

CAN_MSG_OBJ_DLC_FIELD_MASK

#define CAN_MSG_OBJ_DLC_FIELD_MASK (0xFU)

CAN_MSG_OBJ_EID_HIGH_MASK

#define CAN_MSG_OBJ_EID_HIGH_MASK (0x1FU)

CAN_MSG_OBJ_EID_HIGH_WIDTH

#define CAN_MSG_OBJ_EID_HIGH_WIDTH (0x5U)

CAN_MSG_OBJ_EID_LOW_MASK

#define CAN_MSG_OBJ_EID_LOW_MASK (0xF8U)

CAN_MSG_OBJ_EID_LOW_POSN

#define CAN_MSG_OBJ_EID_LOW_POSN (0x3U)

CAN_MSG_OBJ_EID_LOW_WIDTH

#define CAN_MSG_OBJ_EID_LOW_WIDTH (0x5U)

CAN_MSG_OBJ_EID_MID_MASK

#define CAN_MSG_OBJ_EID_MID_MASK (0xFFU)

CAN_MSG_OBJ_EID_MID_WIDTH

#define CAN_MSG_OBJ_EID_MID_WIDTH (0x8U)

CAN_MSG_OBJ_FDF_FIELD_MASK

#define CAN_MSG_OBJ_FDF_FIELD_MASK (0x80U)

CAN_MSG_OBJ_FDF_POSN

#define CAN_MSG_OBJ_FDF_POSN (0x7U)

CAN_MSG_OBJ_FRAME_TYPE_FIELD_MASK

#define CAN_MSG_OBJ_FRAME_TYPE_FIELD_MASK (0x20U)

CAN_MSG_OBJ_ID_TYPE_FIELD_MASK

#define CAN_MSG_OBJ_ID_TYPE_FIELD_MASK (0x10U)

CAN_MSG_OBJ_IDE_POSN

#define CAN_MSG_OBJ_IDE_POSN (0x4U)

CAN_MSG_OBJ_RTR_POSN

#define CAN_MSG_OBJ_RTR_POSN (0x5U)

CAN_MSG_OBJ_SID_HIGH_MASK

#define CAN_MSG_OBJ_SID_HIGH_MASK (0x7U)

CAN_MSG_OBJ_SID_HIGH_WIDTH

#define CAN_MSG_OBJ_SID_HIGH_WIDTH (0x3U)

CAN_MSG_OBJ_SID_LOW_MASK

#define CAN_MSG_OBJ_SID_LOW_MASK (0xFFU)

CAN_MSG_OBJ_SID_LOW_WIDTH

#define CAN_MSG_OBJ_SID_LOW_WIDTH (0x8U)

CAN_STD_MSG_ID_SIZE

#define CAN_STD_MSG_ID_SIZE (CAN_MSG_OBJ_SID_LOW_WIDTH + CAN_MSG_OBJ_SID_HIGH_WIDTH)

4.3.6.1.8 Variable Documentation

CAN1_BusErrorHandler

void(* CAN1_BusErrorHandler) (void) = NULL[static]

CAN1_BusWakeUpActivityHandler

void(* CAN1_BusWakeUpActivityHandler) (void) = NULL[static]

CAN1_FIFO1HalfEmptyHandler

void(* CAN1_FIFO1HalfEmptyHandler) (void) = NULL[static]

CAN1_FIFO2NotEmptyHandler

void(* CAN1_FIFO2NotEmptyHandler) (void) = NULL[static]

CAN1_FIFO3FullHandler

void(* CAN1_FIFO3FullHandler) (void) = NULL[static]

CAN1_InvalidMessageHandler

void(* CAN1_InvalidMessageHandler) (void) = NULL[static]

CAN1_ModeChangeHandler

void(* CAN1_ModeChangeHandler) (void) = NULL[static]

CAN1_RxBufferOverFlowHandler

void(* CAN1_RxBufferOverFlowHandler) (void) = NULL[static]

CAN1_SystemErrorHandler

void(* CAN1_SystemErrorHandler) (void) = NULL[static]

CAN1_TxAttemptHandler

void(* CAN1_TxAttemptHandler) (void) = NULL[static]

CAN1_TXQEmptyHandler

void(* CAN1_TXQEmptyHandler) (void) = NULL[static]

FIFO

volatile struct CAN1_FIFOREG* const FIFO = (struct CAN1_FIFOREG *)&C1TXQCONL[static]

rxFIFOMsg

volatile struct CAN1_RX_FIFO_MSG rxFIFOMsg[CAN1_NUM_OF_RX_FIFO][static]

Initial value:

= 
{
    
    {CAN1_FIFO_2, 0U},
    {CAN1_FIFO_3, 0U},
}
rxMsgData

uint8_t rxMsgData[CAN1_RX_FIFO_MSG_DATA][static]

4.3.6.2 source/can1_interrupt.h File Reference

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

4.3.6.2.1 Functions

4.3.6.2.2 Macros

4.3.6.2.3 Variables

  • const struct CAN_INTERFACE CAN_FD1

    Structure object of type CAN_INTERFACE with the custom name given by the user.

4.3.6.3 source/can1_polling.c File Reference

#include <string.h>
#include "../can1.h"

4.3.6.3.1 Data structures

  • struct CAN1_FIFOREG

    Defines a structure to access CAN1 FIFO Registers.

  • struct CAN1_RX_FIFO_MSG

    CAN1 Receive FIFO Message Object head count information maintenance data structure.

4.3.6.3.2 Functions

4.3.6.3.4 CAN1 Message object arbitration and control field information

Macros for the CAN1 Message object arbitration and control field.

4.3.6.3.5 Variables

4.3.6.3.6 Function Documentation

__interrupt()

void __interrupt (irq(CAN) , base(8) )

CAN1_BitRateConfiguration()

static void CAN1_BitRateConfiguration (void )[static]

Configures the CAN1 Bit rate settings.

Parameters:
None.
Returns:

None.

CAN1_DlcToDataBytesGet()

static uint8_t CAN1_DlcToDataBytesGet (const enum CAN_DLC dlc)[static]

Get the DLC enum based data byte value.

Parameters:
in dlc

- DLC value as described in CAN_DLC.

Returns:

The data byte value coresponding to DLC.

CAN1_GetRxFifoDepth()

static uint8_t CAN1_GetRxFifoDepth (uint8_t validChannel)[static]

Returns the CAN1 Receive FIFO depth.

Parameters:
in validChannel

- Receive FIFO channel as described in CAN_RX_FIFO_CHANNELS.

Returns:

Depth of the Receive FIFO.

CAN1_GetRxFifoStatus()

static uint8_t CAN1_GetRxFifoStatus (uint8_t validChannel)[static]

Returns the CAN1 Receive FIFO status.

Parameters:
in validChannel

- Receive FIFO channel as described in CAN_RX_FIFO_CHANNELS.

Returns:

Status of the CAN1 Receive FIFO. Refer CAN_RX_FIFO_STATUS for details.

CAN1_GetTxFifoStatus()

static enum CAN_TX_FIFO_STATUS CAN1_GetTxFifoStatus (uint8_t validChannel)[static]

Returns the CAN1 transmit FIFO status.

Parameters:
in channel

- Transmit FIFO channel as described in CAN_TX_FIFO_CHANNELS.

Returns:

Status of the CAN1 Transmit FIFO as described in CAN_TX_FIFO_STATUS.

CAN1_IsRxChannel()

static bool CAN1_IsRxChannel (uint8_t channel)[static]

Checks if a valid channel is configured as receiver or not.

Parameters:
in channel

- Receive FIFO channel as described in CAN_RX_FIFO_CHANNELS.

Return values:
True

- FIFO channel is configured as receiver.

False

- FIFO channel is not configured as receiver.

CAN1_IsTxChannel()

static bool CAN1_IsTxChannel (uint8_t channel)[static]

Check if a valid channel is configured as transmitter or not.

Parameters:
in channel

- Transmit FIFO channel as described in CAN_TX_FIFO_CHANNELS.

Return values:
True

- FIFO channel is configured as transmitter.

False

- FIFO channel is not configured as transmitter.

CAN1_MessageReadFromFifo()

static void CAN1_MessageReadFromFifo (uint8_t * rxFifoObj, struct CAN_MSG_OBJ * rxCanMsg)[static]

Reads the message object from Receive FIFO and updates the user message object.

Parameters:
in rxFifoObj

- Receive FIFO message object.

out rxCanMsg

- Pointer to the message object of type CAN_MSG_OBJ.

Returns:

None.

CAN1_MessageWriteToFifo()

static void CAN1_MessageWriteToFifo (uint8_t * txFifoObj, struct CAN_MSG_OBJ * txCanMsg)[static]

Reads the message object from user input and updates the CAN1 TX FIFO.

Parameters:
out txFifoObj

- Transmit FIFO message object.

in txCanMsg

- Pointer to the message object of type CAN_MSG_OBJ.

Returns:

None.

CAN1_PLSIZEToPayloadBytesGet()

static uint8_t CAN1_PLSIZEToPayloadBytesGet (uint8_t plsize)[static]

Get the Payload size in bytes for PLSIZE register value.

Parameters:
in plsize

- The value in PLSIZE register.

Returns:

The number of data bytes corresponding to PLSIZE register value.

CAN1_ReceiveFromFiFo()

static bool CAN1_ReceiveFromFiFo (uint8_t index, enum CAN_RX_FIFO_CHANNELS channel, struct CAN_MSG_OBJ * rxCanMsg)[static]

Reads the data object from a particular CAN receive FIFO.

Parameters:
in index

- Instance of Receive FIFO.

in channel

- Receive FIFO channel as described in CAN_RX_FIFO_CHANNELS.

out rxCanMsg

- Pointer to the message object of type CAN_MSG_OBJ.

Return values:
True

- CAN1 message read succeeded.

False

- CAN1 message read failed.

CAN1_RX_FIFO_Configuration()

static void CAN1_RX_FIFO_Configuration (void )[static]

Configures the CAN1 Receive FIFO settings.

Parameters:
None.
Returns:

None.

CAN1_RX_FIFO_FilterMaskConfiguration()

static void CAN1_RX_FIFO_FilterMaskConfiguration (void )[static]

Configures the CAN1 RX FIFO filter and mask settings.

Parameters:
None.
Returns:

None.

CAN1_RX_FIFO_ResetInfo()

static void CAN1_RX_FIFO_ResetInfo (void )[static]

Resets the CAN1 receive message head count.

Parameters:
None.
Returns:

None.

CAN1_TX_FIFO_Configuration()

static void CAN1_TX_FIFO_Configuration (void )[static]

Configures the CAN1 TX FIFO settings.

Parameters:
None.
Returns:

None.

CAN1_ValidateTransmission()

static enum CAN_TX_MSG_REQUEST_STATUS CAN1_ValidateTransmission (uint8_t channel, struct CAN_MSG_OBJ * txCanMsg)[static]

Validates transmission.

Parameters:
in channel

- Transmit FIFO channel as described in CAN_TX_FIFO_CHANNELS.

in txCanMsg

- Pointer to the message object of type CAN_MSG_OBJ.

Returns:

Status of the CAN1 Transmit operation as described in CAN_TX_MSG_REQUEST_STATUS.

4.3.6.3.7 Macro Definition Documentation

CAN1_NUM_OF_RX_FIFO

#define CAN1_NUM_OF_RX_FIFO (2U)

CAN1_RX_FIFO_MSG_DATA

#define CAN1_RX_FIFO_MSG_DATA (64U)

CAN_MSG_OBJ_BRS_FIELD_MASK

#define CAN_MSG_OBJ_BRS_FIELD_MASK (0x40U)

CAN_MSG_OBJ_BRS_POSN

#define CAN_MSG_OBJ_BRS_POSN (0x6U)

CAN_MSG_OBJ_DLC_FIELD_MASK

#define CAN_MSG_OBJ_DLC_FIELD_MASK (0xFU)

CAN_MSG_OBJ_EID_HIGH_MASK

#define CAN_MSG_OBJ_EID_HIGH_MASK (0x1FU)

CAN_MSG_OBJ_EID_HIGH_WIDTH

#define CAN_MSG_OBJ_EID_HIGH_WIDTH (0x5U)

CAN_MSG_OBJ_EID_LOW_MASK

#define CAN_MSG_OBJ_EID_LOW_MASK (0xF8U)

CAN_MSG_OBJ_EID_LOW_POSN

#define CAN_MSG_OBJ_EID_LOW_POSN (0x3U)

CAN_MSG_OBJ_EID_LOW_WIDTH

#define CAN_MSG_OBJ_EID_LOW_WIDTH (0x5U)

CAN_MSG_OBJ_EID_MID_MASK

#define CAN_MSG_OBJ_EID_MID_MASK (0xFFU)

CAN_MSG_OBJ_EID_MID_WIDTH

#define CAN_MSG_OBJ_EID_MID_WIDTH (0x8U)

CAN_MSG_OBJ_FDF_FIELD_MASK

#define CAN_MSG_OBJ_FDF_FIELD_MASK (0x80U)

CAN_MSG_OBJ_FDF_POSN

#define CAN_MSG_OBJ_FDF_POSN (0x7U)

CAN_MSG_OBJ_FRAME_TYPE_FIELD_MASK

#define CAN_MSG_OBJ_FRAME_TYPE_FIELD_MASK (0x20U)

CAN_MSG_OBJ_ID_TYPE_FIELD_MASK

#define CAN_MSG_OBJ_ID_TYPE_FIELD_MASK (0x10U)

CAN_MSG_OBJ_IDE_POSN

#define CAN_MSG_OBJ_IDE_POSN (0x4U)

CAN_MSG_OBJ_RTR_POSN

#define CAN_MSG_OBJ_RTR_POSN (0x5U)

CAN_MSG_OBJ_SID_HIGH_MASK

#define CAN_MSG_OBJ_SID_HIGH_MASK (0x7U)

CAN_MSG_OBJ_SID_HIGH_WIDTH

#define CAN_MSG_OBJ_SID_HIGH_WIDTH (0x3U)

CAN_MSG_OBJ_SID_LOW_MASK

#define CAN_MSG_OBJ_SID_LOW_MASK (0xFFU)

CAN_MSG_OBJ_SID_LOW_WIDTH

#define CAN_MSG_OBJ_SID_LOW_WIDTH (0x8U)

CAN_STD_MSG_ID_SIZE

#define CAN_STD_MSG_ID_SIZE (CAN_MSG_OBJ_SID_LOW_WIDTH + CAN_MSG_OBJ_SID_HIGH_WIDTH)

4.3.6.3.8 Variable Documentation

CAN1_BusErrorHandler

void(* CAN1_BusErrorHandler) (void) = NULL[static]

CAN1_BusWakeUpActivityHandler

void(* CAN1_BusWakeUpActivityHandler) (void) = NULL[static]

CAN1_InvalidMessageHandler

void(* CAN1_InvalidMessageHandler) (void) = NULL[static]

CAN1_ModeChangeHandler

void(* CAN1_ModeChangeHandler) (void) = NULL[static]

CAN1_RxBufferOverFlowHandler

void(* CAN1_RxBufferOverFlowHandler) (void) = NULL[static]

CAN1_SystemErrorHandler

void(* CAN1_SystemErrorHandler) (void) = NULL[static]

CAN1_TxAttemptHandler

void(* CAN1_TxAttemptHandler) (void) = NULL[static]

FIFO

volatile struct CAN1_FIFOREG* const FIFO = (struct CAN1_FIFOREG *)&C1TXQCONL[static]

rxFIFOMsg

volatile struct CAN1_RX_FIFO_MSG rxFIFOMsg[CAN1_NUM_OF_RX_FIFO][static]

Initial value:

= 
{
    
    {CAN1_FIFO_2, 0U},
    {CAN1_FIFO_3, 0U},
}
rxMsgData

uint8_t rxMsgData[CAN1_RX_FIFO_MSG_DATA][static]

4.3.6.4 source/can1_polling.h File Reference

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

4.3.6.4.1 Functions

4.3.6.4.2 Macros

4.3.6.4.3 Variables

  • const struct CAN_INTERFACE CAN_FD1

    Structure object of type CAN_INTERFACE with the custom name given by the user.

4.3.6.5 source/can_features.h File Reference

This is the generated module feature header file for CAN driver. This file provides module feature list available on the selected device.

4.3.6.5.2 Detailed Description

This is the generated module feature header file for CAN driver. This file provides module feature list available on the selected device.

CAN Generated Feature Header File

Note:

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

The file has to be manually included in main.c, if the user intends to migrate the application to another device which might have varied feature list.

Attention:

The content in this file is strictly "read only" and should not be altered. Failing to do so, the migration is not guaranteed.  

Version:

CAN Driver Version 1.0.0

4.3.6.6 source/can_types.h File Reference

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

#include <stdint.h>

4.3.6.6.1 Data structures

  • struct CAN_MSG_FIELD

    Used to configure the message fields of CAN frame.

  • struct CAN_MSG_OBJ

    Used to configure the message object of CAN frame.

4.3.6.6.2 Enumerations

4.3.6.6.3 Detailed Description

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

CAN Generated Driver Types Header File

Version: CAN Driver Version 1.0.0