MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
FlexCAN Driver

Read Guidance

This document consists of sections titled with Driver Overview, Data Structures, Enumerations, Functions, etc., each with an overview list and detailed documentation. It is recommended to read the Driver Overview first for it includes a comprehensive description of the peripheral, driver and driver changes. Other sections give detailed information for APIs, enums, macros, etc., for your further reference.

Driver Overview

 FlexCAN Peripheral and Driver Overview
 Content including 1) peripheral features, work logic and work method; 2) driver design logic and use method; 3) typical use case.
 
 The Driver Change Log
 The current FLEXCAN driver version is 2.0.1.
 

Data Structures

struct  flexcan_frame_t
 FlexCAN message frame structure. More...
 
struct  flexcan_fd_frame_t
 CAN FDmessage frame structure. More...
 
struct  flexcan_timing_config_t
 FlexCAN protocol timing characteristic configuration structure. More...
 
struct  flexcan_fd_config_t
 Configuration for the Flexcan CAN FD mode. More...
 
struct  flexcan_config_t
 FlexCAN module configuration structure. More...
 
struct  flexcan_rx_mb_config_t
 FlexCAN Receive Message Buffer configuration structure. More...
 
struct  flexcan_rx_fifo_config_t
 FlexCAN Rx FIFO configuration structure. More...
 
struct  flexcan_mb_transfer_t
 FlexCAN Message Buffer transfer. More...
 
struct  flexcan_fifo_transfer_t
 FlexCAN Rx FIFO transfer. More...
 
struct  flexcan_handle_t
 FlexCAN handle structure. More...
 

Macros

#define FLEXCAN_ID_STD(id)   (((uint32_t)(((uint32_t)(id)) << CAN_ID_STD_SHIFT)) & CAN_ID_STD_MASK)
 FlexCAN Frame ID helper macro. More...
 
#define FLEXCAN_ID_EXT(id)
 Extend Frame ID helper macro. More...
 
#define FLEXCAN_RX_MB_STD_MASK(id, rtr, ide)
 FlexCAN Rx Message Buffer Mask helper macro. More...
 
#define FLEXCAN_RX_MB_EXT_MASK(id, rtr, ide)
 Extend Rx Message Buffer Mask helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(id, rtr, ide)
 FlexCAN Rx FIFO Mask helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH(id, rtr, ide)
 Standard Rx FIFO Mask helper macro Type B upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW(id, rtr, ide)
 Standard Rx FIFO Mask helper macro Type B lower part helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_HIGH(id)   (((uint32_t)(id)&0x7F8) << 21)
 Standard Rx FIFO Mask helper macro Type C upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_HIGH(id)   (((uint32_t)(id)&0x7F8) << 13)
 Standard Rx FIFO Mask helper macro Type C mid-upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_LOW(id)   (((uint32_t)(id)&0x7F8) << 5)
 Standard Rx FIFO Mask helper macro Type C mid-lower part helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_LOW(id)   (((uint32_t)(id)&0x7F8) >> 3)
 Standard Rx FIFO Mask helper macro Type C lower part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A(id, rtr, ide)
 Extend Rx FIFO Mask helper macro Type A helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH(id, rtr, ide)
 Extend Rx FIFO Mask helper macro Type B upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW(id, rtr, ide)
 Extend Rx FIFO Mask helper macro Type B lower part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_HIGH(id)   ((FLEXCAN_ID_EXT(id) & 0x1FE00000) << 3)
 Extend Rx FIFO Mask helper macro Type C upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_HIGH(id)
 Extend Rx FIFO Mask helper macro Type C mid-upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW(id)
 Extend Rx FIFO Mask helper macro Type C mid-lower part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW(id)   ((FLEXCAN_ID_EXT(id) & 0x1FE00000) >> 21)
 Extend Rx FIFO Mask helper macro Type C lower part helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_A(id, rtr, ide)   FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(id, rtr, ide)
 FlexCAN Rx FIFO Filter helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_HIGH(id, rtr, ide)
 Standard Rx FIFO Filter helper macro Type B upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_LOW(id, rtr, ide)
 Standard Rx FIFO Filter helper macro Type B lower part helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_HIGH(id)
 Standard Rx FIFO Filter helper macro Type C upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_HIGH(id)
 Standard Rx FIFO Filter helper macro Type C mid-upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_LOW(id)
 Standard Rx FIFO Filter helper macro Type C mid-lower part helper macro. More...
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_LOW(id)
 Standard Rx FIFO Filter helper macro Type C lower part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_A(id, rtr, ide)   FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A(id, rtr, ide)
 Extend Rx FIFO Filter helper macro Type A helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_HIGH(id, rtr, ide)
 Extend Rx FIFO Filter helper macro Type B upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_LOW(id, rtr, ide)
 Extend Rx FIFO Filter helper macro Type B lower part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_HIGH(id)
 Extend Rx FIFO Filter helper macro Type C upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_HIGH(id)
 Extend Rx FIFO Filter helper macro Type C mid-upper part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_LOW(id)
 Extend Rx FIFO Filter helper macro Type C mid-lower part helper macro. More...
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_LOW(id)   FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW(id)
 Extend Rx FIFO Filter helper macro Type C lower part helper macro. More...
 

Typedefs

typedef void(* flexcan_transfer_callback_t )(flexcan_handle_t *psHandle, status_t status, uint32_t result, void *pUserData)
 FlexCAN transfer callback function. More...
 

Enumerations

enum  {
  kStatus_FLEXCAN_TxBusy = MAKE_STATUS(kStatusGroup_FLEXCAN, 0),
  kStatus_FLEXCAN_TxIdle = MAKE_STATUS(kStatusGroup_FLEXCAN, 1),
  kStatus_FLEXCAN_TxSwitchToRx = MAKE_STATUS(kStatusGroup_FLEXCAN, 2),
  kStatus_FLEXCAN_RxBusy = MAKE_STATUS(kStatusGroup_FLEXCAN, 3),
  kStatus_FLEXCAN_RxIdle = MAKE_STATUS(kStatusGroup_FLEXCAN, 4),
  kStatus_FLEXCAN_RxOverflow = MAKE_STATUS(kStatusGroup_FLEXCAN, 5),
  kStatus_FLEXCAN_RxFifoBusy = MAKE_STATUS(kStatusGroup_FLEXCAN, 6),
  kStatus_FLEXCAN_RxFifoIdle = MAKE_STATUS(kStatusGroup_FLEXCAN, 7),
  kStatus_FLEXCAN_RxFifoOverflow = MAKE_STATUS(kStatusGroup_FLEXCAN, 8),
  kStatus_FLEXCAN_RxFifoWarning = MAKE_STATUS(kStatusGroup_FLEXCAN, 9),
  kStatus_FLEXCAN_ErrorStatus = MAKE_STATUS(kStatusGroup_FLEXCAN, 10),
  kStatus_FLEXCAN_WakeUp = MAKE_STATUS(kStatusGroup_FLEXCAN, 11),
  kStatus_FLEXCAN_UnHandled = MAKE_STATUS(kStatusGroup_FLEXCAN, 12),
  kStatus_FLEXCAN_RxRemote = MAKE_STATUS(kStatusGroup_FLEXCAN, 13)
}
 FlexCAN transfer status codes, used by bus operation APIs and transactional APIs as return value to indicate the current status as the API's execution result, or used in the callback to indicate transfer results. More...
 
enum  flexcan_frame_format_t {
  kFLEXCAN_FrameFormatStandard = 0x0U,
  kFLEXCAN_FrameFormatExtend = 0x1U
}
 FlexCAN frame format. More...
 
enum  flexcan_frame_type_t {
  kFLEXCAN_FrameTypeData = 0x0U,
  kFLEXCAN_FrameTypeRemote = 0x1U
}
 FlexCAN frame type. More...
 
enum  flexcan_clock_source_t {
  kFLEXCAN_ClkSrc0 = 0x0U,
  kFLEXCAN_ClkSrc1 = 0x1U
}
 FlexCAN clock source. More...
 
enum  flexcan_wake_up_source_t {
  kFLEXCAN_WakeupSrcUnfiltered = 0x0U,
  kFLEXCAN_WakeupSrcFiltered = 0x1U
}
 FlexCAN wake up source. More...
 
enum  flexcan_rx_fifo_filter_type_t {
  kFLEXCAN_RxFifoFilterTypeA = 0x0U,
  kFLEXCAN_RxFifoFilterTypeB = 0x1U,
  kFLEXCAN_RxFifoFilterTypeC = 0x2U,
  kFLEXCAN_RxFifoFilterTypeD = 0x3U
}
 FlexCAN Rx Fifo Filter type. More...
 
enum  flexcan_mb_size_t {
  kFLEXCAN_8BperMB = 0x0U,
  kFLEXCAN_16BperMB = 0x1U,
  kFLEXCAN_32BperMB = 0x2U,
  kFLEXCAN_64BperMB = 0x3U
}
 FlexCAN Message Buffer Data Size. More...
 
enum  flexcan_rx_fifo_priority_t {
  kFLEXCAN_RxFifoPriorityLow = 0x0U,
  kFLEXCAN_RxFifoPriorityHigh = 0x1U
}
 FlexCAN Rx FIFO priority. More...
 
enum  _flexcan_interrupt_enable {
  kFLEXCAN_BusOffInterruptEnable = CAN_CTRL1_BOFFMSK_MASK,
  kFLEXCAN_ErrorInterruptEnable = CAN_CTRL1_ERRMSK_MASK,
  kFLEXCAN_RxWarningInterruptEnable = CAN_CTRL1_RWRNMSK_MASK,
  kFLEXCAN_TxWarningInterruptEnable = CAN_CTRL1_TWRNMSK_MASK,
  kFLEXCAN_WakeUpInterruptEnable = CAN_MCR_WAKMSK_MASK
}
 FlexCAN interrupt configuration structure, default settings all disabled. More...
 
enum  _flexcan_status_flags {
  kFLEXCAN_FDStuffingError = CAN_ESR1_STFERR_FAST_MASK,
  kFLEXCAN_FDFormError = CAN_ESR1_FRMERR_FAST_MASK,
  kFLEXCAN_FDCrcError = CAN_ESR1_CRCERR_FAST_MASK,
  kFLEXCAN_FDBit0Error = CAN_ESR1_BIT0ERR_FAST_MASK,
  kFLEXCAN_FDBit1Error = (int)CAN_ESR1_BIT1ERR_FAST_MASK,
  kFLEXCAN_StuffingError = CAN_ESR1_STFERR_MASK,
  kFLEXCAN_FormError = CAN_ESR1_FRMERR_MASK,
  kFLEXCAN_CrcError = CAN_ESR1_CRCERR_MASK,
  kFLEXCAN_AckError = CAN_ESR1_ACKERR_MASK,
  kFLEXCAN_Bit0Error = CAN_ESR1_BIT0ERR_MASK,
  kFLEXCAN_Bit1Error = CAN_ESR1_BIT1ERR_MASK ,
  kFLEXCAN_FDErrorIntFlag = CAN_ESR1_ERRINT_FAST_MASK,
  kFLEXCAN_BusoffDoneIntFlag = CAN_ESR1_BOFFDONEINT_MASK,
  kFLEXCAN_OverrunError = CAN_ESR1_ERROVR_MASK,
  kFLEXCAN_TxWarningIntFlag = CAN_ESR1_TWRNINT_MASK,
  kFLEXCAN_RxWarningIntFlag = CAN_ESR1_RWRNINT_MASK,
  kFLEXCAN_BusOffIntFlag = CAN_ESR1_BOFFINT_MASK,
  kFLEXCAN_ErrorIntFlag = CAN_ESR1_ERRINT_MASK,
  kFLEXCAN_WakeUpIntFlag = CAN_ESR1_WAKINT_MASK,
  kFLEXCAN_SynchFlag = CAN_ESR1_SYNCH_MASK,
  kFLEXCAN_TxErrorWarningFlag = CAN_ESR1_TXWRN_MASK,
  kFLEXCAN_RxErrorWarningFlag = CAN_ESR1_RXWRN_MASK,
  kFLEXCAN_IdleFlag = CAN_ESR1_IDLE_MASK,
  kFLEXCAN_FaultConfinementFlag = CAN_ESR1_FLTCONF_MASK,
  kFLEXCAN_TransmittingFlag = CAN_ESR1_TX_MASK,
  kFLEXCAN_ReceivingFlag = CAN_ESR1_RX_MASK,
  kFLEXCAN_StatusAllFlags
}
 FlexCAN status flags. More...
 
enum  _flexcan_mb_flags {
  kFLEXCAN_RxFifoOverflowFlag = CAN_IFLAG1_BUF7I_MASK,
  kFLEXCAN_RxFifoWarningFlag = CAN_IFLAG1_BUF6I_MASK,
  kFLEXCAN_RxFifoFrameAvlFlag = CAN_IFLAG1_BUF5I_MASK
}
 FlexCAN Rx FIFO status flags. More...
 

Driver version

#define FSL_FLEXCAN_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 FlexCAN driver version 2.0.0. More...
 

Unsorted @todo

uint32_t FLEXCAN_GetInstance (CAN_Type *base)
 Get the FlexCAN instance from peripheral base address. More...
 

Initialization and deinitialization

void FLEXCAN_Init (CAN_Type *base, const flexcan_config_t *psConfig)
 Initializes a FlexCAN instance with classic / FD mode supported. More...
 
void FLEXCAN_Deinit (CAN_Type *base)
 De-initializes a FlexCAN instance. More...
 
void FLEXCAN_GetDefaultConfig (flexcan_config_t *psConfig, uint32_t u32ClkFreqHz)
 Gets the default configuration structure. More...
 
void FLEXCAN_GetFDDefaultConfig (flexcan_fd_config_t *psConfig)
 Gets the default configuration structure for Flexcan FD mode. More...
 

Freeze Mode Operation

void FLEXCAN_EnterFreezeMode (CAN_Type *base)
 Enter FlexCAN Freeze Mode. More...
 
void FLEXCAN_ExitFreezeMode (CAN_Type *base)
 Exit FlexCAN Freeze Mode. More...
 

Timing Calculation Helper Functions

bool FLEXCAN_FDCalculateImprovedTimingValues (flexcan_timing_config_t *psTimingConfig, flexcan_timing_config_t *psFDTimingConfig, uint32_t u32BaudRateBps, uint32_t u32FDBaudRateBps, uint32_t u32SrcClkHz)
 Calculates the improved timing values by specific baudrates for CANFD. More...
 
bool FLEXCAN_CalculateImprovedTimingValues (flexcan_timing_config_t *psTimingConfig, uint32_t u32BaudRateBps, uint32_t u32SrcClkHz)
 Calculates the improved timing values by specific baudrates for classical CAN. More...
 

Timing Configuration

void FLEXCAN_SetFDTimingConfig (CAN_Type *base, const flexcan_timing_config_t *psConfig)
 Sets the FlexCAN FD protocol timing characteristic. More...
 
void FLEXCAN_SetTimingConfig (CAN_Type *base, const flexcan_timing_config_t *psConfig)
 Sets the FlexCAN protocol timing characteristic. More...
 

Message Buffer Configuration

void FLEXCAN_SetRxMbGlobalMask (CAN_Type *base, uint32_t u32RecMsgBufs)
 Sets the FlexCAN receive message buffer global mask. More...
 
void FLEXCAN_SetRxFifoGlobalMask (CAN_Type *base, uint32_t u32RecFifos)
 Sets the FlexCAN receive FIFO global mask. More...
 
void FLEXCAN_SetRxIndividualMask (CAN_Type *base, uint8_t u8MaskIdx, uint32_t u32Mask)
 Sets the FlexCAN receive individual mask. More...
 
void FLEXCAN_SetTxMbConfig (CAN_Type *base, uint8_t u8MsgBufIdx, bool bEnable)
 Configures a FlexCAN transmit message buffer. More...
 
void FLEXCAN_SetFDTxMbConfig (CAN_Type *base, uint8_t u8MsgBufIdx, bool bEnable)
 Configures a FlexCAN transmit message buffer. More...
 
void FLEXCAN_SetRxMbConfig (CAN_Type *base, uint8_t u8MsgBufIdx, const flexcan_rx_mb_config_t *psRxMsgBufConfig, bool bEnable)
 Configures a FlexCAN Receive Message Buffer. More...
 
void FLEXCAN_SetFDRxMbConfig (CAN_Type *base, uint8_t u8MsgBufIdx, const flexcan_rx_mb_config_t *psRxMsgBufConfig, bool bEnable)
 Configures a FlexCAN Receive Message Buffer. More...
 
void FLEXCAN_SetRxFifoConfig (CAN_Type *base, const flexcan_rx_fifo_config_t *psRxFifoConfig, bool bEnable)
 Configures the FlexCAN Rx FIFO. More...
 

Status Interface

static uint32_t FLEXCAN_GetStatusFlags (CAN_Type *base)
 Gets the FlexCAN module interrupt flags. More...
 
static void FLEXCAN_ClearStatusFlags (CAN_Type *base, uint32_t u32StatusFlags)
 Clears status flags with the provided mask. More...
 
static void FLEXCAN_GetBusErrCount (CAN_Type *base, uint8_t *pu8TxErrBuf, uint8_t *pu8RxErrBuf)
 Gets the FlexCAN Bus Error Counter value. More...
 

Message Buffer Status Get/Clear Interfaces

static uint32_t FLEXCAN_GetMbStatusFlags (CAN_Type *base, uint32_t mask)
 Gets the FlexCAN Message Buffer interrupt flags. More...
 
static void FLEXCAN_ClearMbStatusFlags (CAN_Type *base, uint32_t mask)
 Clears the FlexCAN Message Buffer interrupt flags. More...
 

Interrupt Interfaces

static void FLEXCAN_EnableInterrupts (CAN_Type *base, uint32_t u32InterruptFlags)
 Enables FlexCAN interrupts according to the provided mask. More...
 
static void FLEXCAN_DisableInterrupts (CAN_Type *base, uint32_t u32InterruptFlags)
 Disables FlexCAN interrupts according to the provided mask. More...
 

Message Buffer Interrupts Interfaces

static void FLEXCAN_EnableMbInterrupts (CAN_Type *base, uint32_t mask)
 Enables FlexCAN Message Buffer interrupts. More...
 
static void FLEXCAN_DisableMbInterrupts (CAN_Type *base, uint32_t mask)
 Disables FlexCAN Message Buffer interrupts. More...
 

DMA Control Interfaces

void FLEXCAN_EnableRxFifoDMA (CAN_Type *base, bool bEnable)
 Enables or disables the FlexCAN Rx FIFO DMA request. More...
 
static uint32_t FLEXCAN_GetRxFifoHeadAddr (CAN_Type *base)
 Gets the Rx FIFO Head address. More...
 

Bus Operations

static void FLEXCAN_Enable (CAN_Type *base, bool bEnable)
 Enables or disables the FlexCAN module operation. More...
 
status_t FLEXCAN_WriteTxMb (CAN_Type *base, uint8_t u8MsgBufIdx, const flexcan_frame_t *psTxFrame)
 Writes a FlexCAN Message to the Transmit Message Buffer. More...
 
status_t FLEXCAN_ReadRxMb (CAN_Type *base, uint8_t u8MsgBufIdx, flexcan_frame_t *psRxFrame)
 Reads a FlexCAN Message from Receive Message Buffer. More...
 
status_t FLEXCAN_ReadRxFifo (CAN_Type *base, flexcan_frame_t *psRxFrame)
 Reads a FlexCAN Message from Rx FIFO. More...
 
status_t FLEXCAN_WriteFDTxMb (CAN_Type *base, uint8_t u8MsgBufIdx, const flexcan_fd_frame_t *psTxFrame)
 Writes a FlexCAN FD Message to the Transmit Message Buffer. More...
 
status_t FLEXCAN_ReadFDRxMb (CAN_Type *base, uint8_t u8MsgBufIdx, flexcan_fd_frame_t *psRxFrame)
 Reads a FlexCAN FD Message from Receive Message Buffer. More...
 

Transactional Blocking Interface

status_t FLEXCAN_TransferSendBlocking (CAN_Type *base, uint8_t u8MsgBufIdx, flexcan_frame_t *psTxFrame)
 Performs a polling send transaction on the CAN bus. More...
 
status_t FLEXCAN_TransferReceiveBlocking (CAN_Type *base, uint8_t u8MsgBufIdx, flexcan_frame_t *psRxFrame)
 Performs a polling receive transaction on the CAN bus. More...
 
status_t FLEXCAN_TransferReceiveFifoBlocking (CAN_Type *base, flexcan_frame_t *psRxFrame)
 Performs a polling receive transaction from Rx FIFO on the CAN bus. More...
 
status_t FLEXCAN_TransferFDSendBlocking (CAN_Type *base, uint8_t u8MsgBufIdx, flexcan_fd_frame_t *psTxFrame)
 Performs a polling send transaction on the CAN bus. More...
 
status_t FLEXCAN_TransferFDReceiveBlocking (CAN_Type *base, uint8_t u8MsgBufIdx, flexcan_fd_frame_t *psRxFrame)
 Performs a polling receive transaction on the CAN bus. More...
 

Transactional Non-Blocking Interfaces

void FLEXCAN_TransferCreateHandle (CAN_Type *base, flexcan_handle_t *psHandle, flexcan_transfer_callback_t pfCallback, void *pUserData)
 Initializes the FlexCAN handle. More...
 
status_t FLEXCAN_TransferSendNonBlocking (flexcan_handle_t *psHandle, flexcan_mb_transfer_t *psMsgBufXfer)
 Sends a message using IRQ. More...
 
status_t FLEXCAN_TransferReceiveNonBlocking (flexcan_handle_t *psHandle, flexcan_mb_transfer_t *psMsgBufXfer)
 Receives a message using IRQ. More...
 
status_t FLEXCAN_TransferReceiveFifoNonBlocking (flexcan_handle_t *psHandle, flexcan_fifo_transfer_t *psFifoXfer)
 Receives a message from Rx FIFO using IRQ. More...
 
uint32_t FLEXCAN_GetTimeStamp (flexcan_handle_t *psHandle, uint8_t u8MsgBufIdx)
 Gets the detail index of Mailbox's Timestamp by handle. More...
 
void FLEXCAN_TransferAbortSend (flexcan_handle_t *psHandle, uint8_t u8MsgBufIdx)
 Aborts the interrupt driven message send process. More...
 
void FLEXCAN_TransferAbortReceive (flexcan_handle_t *psHandle, uint8_t u8MsgBufIdx)
 Aborts the interrupt driven message receive process. More...
 
void FLEXCAN_TransferAbortReceiveFifo (flexcan_handle_t *psHandle)
 Aborts the interrupt driven message receive from Rx FIFO process. More...
 
void FLEXCAN_TransferHandleIRQ (flexcan_handle_t *psHandle)
 FlexCAN IRQ handle function. More...
 
status_t FLEXCAN_TransferFDSendNonBlocking (flexcan_handle_t *psHandle, flexcan_mb_transfer_t *psMsgBufXfer)
 Sends a message using IRQ. More...
 
status_t FLEXCAN_TransferFDReceiveNonBlocking (flexcan_handle_t *psHandle, flexcan_mb_transfer_t *psMsgBufXfer)
 Receives a message using IRQ. More...
 
void FLEXCAN_TransferFDAbortSend (flexcan_handle_t *psHandle, uint8_t u8MsgBufIdx)
 Aborts the interrupt driven message send process. More...
 
void FLEXCAN_TransferFDAbortReceive (flexcan_handle_t *psHandle, uint8_t u8MsgBufIdx)
 Aborts the interrupt driven message receive process. More...
 

Data Structure Documentation

struct flexcan_frame_t

Field Documentation

uint32_t flexcan_frame_t::bitsTimestamp
uint32_t flexcan_frame_t::bitsLength
uint32_t flexcan_frame_t::bitType
uint32_t flexcan_frame_t::bitFormat
uint32_t flexcan_frame_t::__pad0__
uint32_t flexcan_frame_t::bitsIdHit
uint32_t flexcan_frame_t::bitsId
uint32_t flexcan_frame_t::u32DataWord0
uint32_t flexcan_frame_t::u32DataWord1
uint8_t flexcan_frame_t::u8DataByte3
uint8_t flexcan_frame_t::u8DataByte2
uint8_t flexcan_frame_t::u8DataByte1
uint8_t flexcan_frame_t::u8DataByte0
uint8_t flexcan_frame_t::u8DataByte7
uint8_t flexcan_frame_t::u8DataByte6
uint8_t flexcan_frame_t::u8DataByte5
uint8_t flexcan_frame_t::u8DataByte4
struct flexcan_fd_frame_t

Field Documentation

uint32_t flexcan_fd_frame_t::bitsTimestamp
uint32_t flexcan_fd_frame_t::bitsLength
uint32_t flexcan_fd_frame_t::bitType
uint32_t flexcan_fd_frame_t::bitFormat
uint32_t flexcan_fd_frame_t::bitSrr
uint32_t flexcan_fd_frame_t::__pad0__
uint32_t flexcan_fd_frame_t::bitsCode
uint32_t flexcan_fd_frame_t::bitEsi
uint32_t flexcan_fd_frame_t::bitBrs
uint32_t flexcan_fd_frame_t::bitEdl
uint32_t flexcan_fd_frame_t::bitsId
uint32_t flexcan_fd_frame_t::u32DataWord[16]
uint8_t flexcan_fd_frame_t::u8DataByte3
uint8_t flexcan_fd_frame_t::u8DataByte2
uint8_t flexcan_fd_frame_t::u8DataByte1
uint8_t flexcan_fd_frame_t::u8DataByte0
uint8_t flexcan_fd_frame_t::u8DataByte7
uint8_t flexcan_fd_frame_t::u8DataByte6
uint8_t flexcan_fd_frame_t::u8DataByte5
uint8_t flexcan_fd_frame_t::u8DataByte4
struct flexcan_timing_config_t

Data Fields

uint16_t u16PreDivider
 Clock Pre-scaler Division Factor. More...
 
uint8_t u8RJumpWidth
 Re-sync Jump Width. More...
 
uint8_t u8PhaseSeg1
 Phase Segment 1. More...
 
uint8_t u8PhaseSeg2
 Phase Segment 2. More...
 
uint8_t u8PropSeg
 Propagation Segment. More...
 

Field Documentation

uint16_t flexcan_timing_config_t::u16PreDivider
uint8_t flexcan_timing_config_t::u8RJumpWidth
uint8_t flexcan_timing_config_t::u8PhaseSeg1
uint8_t flexcan_timing_config_t::u8PhaseSeg2
uint8_t flexcan_timing_config_t::u8PropSeg
struct flexcan_fd_config_t

It only cover FD related parts.

It is used as member of _flexcan_config to do the CAN FD specific init on init this peripheral.

struct flexcan_config_t

Data Fields

uint32_t u32BaudRateBps
 FlexCAN baud rate in bps. More...
 
uint32_t u32ClkFreqHz
 Clock Frequency.
 
flexcan_clock_source_t eClkSrc
 Clock source for FlexCAN Protocol Engine. More...
 
uint8_t u8MaxMsgBufNum
 The maximum number of Message Buffers used by user. More...
 
bool bEnableIndividMask
 Enable or Disable Rx Individual Mask. More...
 
flexcan_wake_up_source_t eWakeupSrc
 Wake up source selection. More...
 
bool bEnableSelfWakeup
 Enable or Disable Self Wakeup Mode. More...
 
bool bEnableLoopBack
 Enable or Disable Loop Back Self Test Mode. More...
 
bool bEnableTimerSync
 Enable or Disable Timer Synchronization. More...
 
bool bDisableSelfReception
 Enable or Disable Self Reflection. More...
 
bool bEnableListenOnlyMode
 Enable or Disable Listen Only Mode. More...
 
bool bEnableDoze
 Enable or Disable Doze Mode. More...
 

Field Documentation

uint32_t flexcan_config_t::u32BaudRateBps
flexcan_clock_source_t flexcan_config_t::eClkSrc
uint8_t flexcan_config_t::u8MaxMsgBufNum
bool flexcan_config_t::bEnableIndividMask
flexcan_wake_up_source_t flexcan_config_t::eWakeupSrc
bool flexcan_config_t::bEnableSelfWakeup
bool flexcan_config_t::bEnableLoopBack
bool flexcan_config_t::bEnableTimerSync
bool flexcan_config_t::bDisableSelfReception
bool flexcan_config_t::bEnableListenOnlyMode
bool flexcan_config_t::bEnableDoze
struct flexcan_rx_mb_config_t

This structure is used as the parameter of FLEXCAN_SetRxMbConfig() function. The FLEXCAN_SetRxMbConfig() function is used to configure FlexCAN Receive Message Buffer. The function abort previous receiving process, clean the Message Buffer and activate the Rx Message Buffer using given Message Buffer setting.

Data Fields

uint32_t u32Id
 CAN Message Buffer Frame Identifier, should be set using FLEXCAN_ID_EXT() or FLEXCAN_ID_STD() macro. More...
 
flexcan_frame_format_t eFormat
 CAN Frame Identifier format(Standard of Extend). More...
 
flexcan_frame_type_t eType
 CAN Frame Type(Data or Remote). More...
 

Field Documentation

uint32_t flexcan_rx_mb_config_t::u32Id
flexcan_frame_format_t flexcan_rx_mb_config_t::eFormat
flexcan_frame_type_t flexcan_rx_mb_config_t::eType
struct flexcan_rx_fifo_config_t

Data Fields

uint32_t * pu32IdFilterTable
 Pointer to the FlexCAN Rx FIFO identifier filter table. More...
 
uint8_t u8IdFilterNum
 The quantity of filter elements. More...
 
flexcan_rx_fifo_filter_type_t eIdFilterType
 The FlexCAN Rx FIFO Filter type. More...
 
flexcan_rx_fifo_priority_t ePriority
 The FlexCAN Rx FIFO receive priority. More...
 

Field Documentation

uint32_t* flexcan_rx_fifo_config_t::pu32IdFilterTable
uint8_t flexcan_rx_fifo_config_t::u8IdFilterNum
flexcan_rx_fifo_filter_type_t flexcan_rx_fifo_config_t::eIdFilterType
flexcan_rx_fifo_priority_t flexcan_rx_fifo_config_t::ePriority
struct flexcan_mb_transfer_t

Data Fields

flexcan_frame_tpsFrame
 The buffer of CAN Message to be transfer. More...
 
uint8_t u8MsgBufIdx
 The index of Message buffer used to transfer Message. More...
 

Field Documentation

flexcan_frame_t* flexcan_mb_transfer_t::psFrame
uint8_t flexcan_mb_transfer_t::u8MsgBufIdx
struct flexcan_fifo_transfer_t

Data Fields

flexcan_frame_tpsFrame
 The buffer of CAN Message to be received from Rx FIFO. More...
 

Field Documentation

flexcan_frame_t* flexcan_fifo_transfer_t::psFrame
struct _flexcan_handle

FlexCAN handle structure definition.

Data Fields

flexcan_transfer_callback_t pfCallback
 Callback function. More...
 
void * pUserData
 FlexCAN callback function parameter. More...
 
flexcan_fd_frame_t *volatile psFDMbFrameBufs [CAN_WORD1_COUNT]
 The buffer for received data from Message Buffers. More...
 
flexcan_frame_t *volatile psRxFifoFrameBuf
 The buffer for received data from Rx FIFO. More...
 
volatile uint8_t u8MsgBufStates [CAN_WORD1_COUNT]
 Message Buffer transfer state. More...
 
volatile uint8_t u8RxFifoState
 Rx FIFO transfer state. More...
 
volatile uint32_t u32TimeStamps [CAN_WORD1_COUNT]
 Mailbox transfer timestamp. More...
 

Field Documentation

flexcan_transfer_callback_t flexcan_handle_t::pfCallback
void* flexcan_handle_t::pUserData
flexcan_fd_frame_t* volatile flexcan_handle_t::psFDMbFrameBufs[CAN_WORD1_COUNT]
flexcan_frame_t* volatile flexcan_handle_t::psRxFifoFrameBuf
volatile uint8_t flexcan_handle_t::u8MsgBufStates[CAN_WORD1_COUNT]
volatile uint8_t flexcan_handle_t::u8RxFifoState
volatile uint32_t flexcan_handle_t::u32TimeStamps[CAN_WORD1_COUNT]

Macro Definition Documentation

#define FSL_FLEXCAN_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
#define FLEXCAN_ID_STD (   id)    (((uint32_t)(((uint32_t)(id)) << CAN_ID_STD_SHIFT)) & CAN_ID_STD_MASK)

Standard Frame ID helper macro.

#define FLEXCAN_ID_EXT (   id)
Value:
(((uint32_t)(((uint32_t)(id)) << CAN_ID_EXT_SHIFT)) & \
(CAN_ID_EXT_MASK | CAN_ID_STD_MASK))
#define FLEXCAN_RX_MB_STD_MASK (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
#define FLEXCAN_ID_STD(id)
FlexCAN Frame ID helper macro.
Definition: fsl_flexcan.h:302

Standard Rx Message Buffer Mask helper macro.

#define FLEXCAN_RX_MB_EXT_MASK (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
#define FLEXCAN_ID_EXT(id)
Extend Frame ID helper macro.
Definition: fsl_flexcan.h:305
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_A (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
(FLEXCAN_ID_STD(id) << 1))
#define FLEXCAN_ID_STD(id)
FlexCAN Frame ID helper macro.
Definition: fsl_flexcan.h:302

Standard Rx FIFO Mask helper macro Type A helper macro.

#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
(((uint32_t)(id)&0x7FF) << 19))
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 15) | (uint32_t)((uint32_t)(ide) << 14)) | \
(((uint32_t)(id)&0x7FF) << 3))
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_HIGH (   id)    (((uint32_t)(id)&0x7F8) << 21)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_HIGH (   id)    (((uint32_t)(id)&0x7F8) << 13)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_LOW (   id)    (((uint32_t)(id)&0x7F8) << 5)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_LOW (   id)    (((uint32_t)(id)&0x7F8) >> 3)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
(FLEXCAN_ID_EXT(id) << 1))
#define FLEXCAN_ID_EXT(id)
Extend Frame ID helper macro.
Definition: fsl_flexcan.h:305
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH (   id,
  rtr,
  ide 
)
Value:
( \
((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
((FLEXCAN_ID_EXT(id) & 0x1FFF8000) \
<< 1))
#define FLEXCAN_ID_EXT(id)
Extend Frame ID helper macro.
Definition: fsl_flexcan.h:305
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 15) | (uint32_t)((uint32_t)(ide) << 14)) | \
((FLEXCAN_ID_EXT(id) & 0x1FFF8000) >> \
15))
#define FLEXCAN_ID_EXT(id)
Extend Frame ID helper macro.
Definition: fsl_flexcan.h:305
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_HIGH (   id)    ((FLEXCAN_ID_EXT(id) & 0x1FE00000) << 3)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_HIGH (   id)
Value:
((FLEXCAN_ID_EXT(id) & 0x1FE00000) >> \
5)
#define FLEXCAN_ID_EXT(id)
Extend Frame ID helper macro.
Definition: fsl_flexcan.h:305
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW (   id)
Value:
((FLEXCAN_ID_EXT(id) & 0x1FE00000) >> \
13)
#define FLEXCAN_ID_EXT(id)
Extend Frame ID helper macro.
Definition: fsl_flexcan.h:305
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW (   id)    ((FLEXCAN_ID_EXT(id) & 0x1FE00000) >> 21)
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_A (   id,
  rtr,
  ide 
)    FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(id, rtr, ide)

Standard Rx FIFO Filter helper macro Type A helper macro.

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_HIGH (   id,
  rtr,
  ide 
)
Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH(id, rtr, ide)
Standard Rx FIFO Mask helper macro Type B upper part helper macro.
Definition: fsl_flexcan.h:329
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_LOW (   id,
  rtr,
  ide 
)
Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW(id, rtr, ide)
Standard Rx FIFO Mask helper macro Type B lower part helper macro.
Definition: fsl_flexcan.h:334
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_HIGH (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_HIGH(id)
Standard Rx FIFO Mask helper macro Type C upper part helper macro.
Definition: fsl_flexcan.h:339
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_HIGH (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_HIGH(id)
Standard Rx FIFO Mask helper macro Type C mid-upper part helper macro.
Definition: fsl_flexcan.h:342
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_LOW (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_LOW(id)
Standard Rx FIFO Mask helper macro Type C mid-lower part helper macro.
Definition: fsl_flexcan.h:345
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_LOW (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_LOW(id)
Standard Rx FIFO Mask helper macro Type C lower part helper macro.
Definition: fsl_flexcan.h:348
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_A (   id,
  rtr,
  ide 
)    FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A(id, rtr, ide)
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_HIGH (   id,
  rtr,
  ide 
)
Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH(id, rtr, ide)
Extend Rx FIFO Mask helper macro Type B upper part helper macro.
Definition: fsl_flexcan.h:356
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_LOW (   id,
  rtr,
  ide 
)
Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW(id, rtr, ide)
Extend Rx FIFO Mask helper macro Type B lower part helper macro.
Definition: fsl_flexcan.h:365
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_HIGH (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_HIGH(id)
Extend Rx FIFO Mask helper macro Type C upper part helper macro.
Definition: fsl_flexcan.h:372
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_HIGH (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_HIGH(id)
Extend Rx FIFO Mask helper macro Type C mid-upper part helper macro.
Definition: fsl_flexcan.h:375
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_LOW (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW(id)
Extend Rx FIFO Mask helper macro Type C mid-lower part helper macro.
Definition: fsl_flexcan.h:380
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_LOW (   id)    FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW(id)

Typedef Documentation

typedef void(* flexcan_transfer_callback_t)(flexcan_handle_t *psHandle, status_t status, uint32_t result, void *pUserData)

The FlexCAN transfer callback returns a value from the underlying layer. If the status equals to kStatus_FLEXCAN_ErrorStatus, the result parameter is the Content of FlexCAN status register which can be used to get the working status(or error status) of FlexCAN module. If the status equals to other FlexCAN Message Buffer transfer status, the result is the index of Message Buffer that generate transfer event. If the status equals to other FlexCAN Message Buffer transfer status, the result is meaningless and should be Ignored.

Enumeration Type Documentation

anonymous enum
Enumerator
kStatus_FLEXCAN_TxBusy 

Tx Message Buffer is Busy.

kStatus_FLEXCAN_TxIdle 

Tx Message Buffer is Idle.

kStatus_FLEXCAN_TxSwitchToRx 

Remote Message is send out and Message buffer changed to Receive one.

kStatus_FLEXCAN_RxBusy 

Rx Message Buffer is Busy.

kStatus_FLEXCAN_RxIdle 

Rx Message Buffer is Idle.

kStatus_FLEXCAN_RxOverflow 

Rx Message Buffer is Overflowed.

kStatus_FLEXCAN_RxFifoBusy 

Rx Message FIFO is Busy.

kStatus_FLEXCAN_RxFifoIdle 

Rx Message FIFO is Idle.

kStatus_FLEXCAN_RxFifoOverflow 

Rx Message FIFO is overflowed.

kStatus_FLEXCAN_RxFifoWarning 

Rx Message FIFO is almost overflowed.

kStatus_FLEXCAN_ErrorStatus 

FlexCAN Module Error and Status.

kStatus_FLEXCAN_WakeUp 

FlexCAN is waken up from STOP mode.

kStatus_FLEXCAN_UnHandled 

UnHadled Interrupt asserted.

kStatus_FLEXCAN_RxRemote 

Rx Remote Message Received in Mail box.

Enumerator
kFLEXCAN_FrameFormatStandard 

Standard frame format attribute.

kFLEXCAN_FrameFormatExtend 

Extend frame format attribute.

Enumerator
kFLEXCAN_FrameTypeData 

Data frame type attribute.

kFLEXCAN_FrameTypeRemote 

Remote frame type attribute.

Note
The user must ensure the protocol engine clock tolerance according to the CAN Protocol standard (ISO 11898-1).
Enumerator
kFLEXCAN_ClkSrc0 

FlexCAN Protocol Engine clock selected by user as SRC == 0.

kFLEXCAN_ClkSrc1 

FlexCAN Protocol Engine clock selected by user as SRC == 1.

Enumerator
kFLEXCAN_WakeupSrcUnfiltered 

FlexCAN uses unfiltered Rx input to detect edge.

kFLEXCAN_WakeupSrcFiltered 

FlexCAN uses filtered Rx input to detect edge.

Enumerator
kFLEXCAN_RxFifoFilterTypeA 

One full ID (standard and extended) per ID Filter element.

kFLEXCAN_RxFifoFilterTypeB 

Two full standard IDs or two partial 14-bit ID slices per ID Filter Table element.

kFLEXCAN_RxFifoFilterTypeC 

Four partial 8-bit Standard or extended ID slices per ID Filter Table element.

kFLEXCAN_RxFifoFilterTypeD 

All frames rejected.

Enumerator
kFLEXCAN_8BperMB 

Selects 8 bytes per Message Buffer.

kFLEXCAN_16BperMB 

Selects 16 bytes per Message Buffer.

kFLEXCAN_32BperMB 

Selects 32 bytes per Message Buffer.

kFLEXCAN_64BperMB 

Selects 64 bytes per Message Buffer.

The matching process starts from the Rx MB(or Rx FIFO) with higher priority. If no MB(or Rx FIFO filter) is satisfied, the matching process goes on with the Rx FIFO(or Rx MB) with lower priority.

Enumerator
kFLEXCAN_RxFifoPriorityLow 

Matching process start from Rx Message Buffer first.

kFLEXCAN_RxFifoPriorityHigh 

Matching process start from Rx FIFO first.

This structure contains the settings for all of the FlexCAN Module interrupt configurations. Note: FlexCAN Message Buffers and Rx FIFO have their own interrupts.

Enumerator
kFLEXCAN_BusOffInterruptEnable 

Bus Off interrupt.

kFLEXCAN_ErrorInterruptEnable 

Error interrupt.

kFLEXCAN_RxWarningInterruptEnable 

Rx Warning interrupt.

kFLEXCAN_TxWarningInterruptEnable 

Tx Warning interrupt.

kFLEXCAN_WakeUpInterruptEnable 

Wake Up interrupt.

This provides constants for the FlexCAN status flags for use in the FlexCAN functions. Note: The CPU read action will clears all error flag in FlEXCAN_ErrorFlag. _flexcan_error_flags enumerations.

Enumerator
kFLEXCAN_FDStuffingError 

Stuffing Error.

kFLEXCAN_FDFormError 

Form Error.

kFLEXCAN_FDCrcError 

Cyclic Redundancy Check Error.

kFLEXCAN_FDBit0Error 

Unable to send dominant bit.

kFLEXCAN_FDBit1Error 

Unable to send recessive bit.

kFLEXCAN_StuffingError 

Stuffing Error.

kFLEXCAN_FormError 

Form Error.

kFLEXCAN_CrcError 

Cyclic Redundancy Check Error.

kFLEXCAN_AckError 

Received no ACK on transmission.

kFLEXCAN_Bit0Error 

Unable to send dominant bit.

kFLEXCAN_Bit1Error 

Unable to send recessive bit.

kFLEXCAN_FDErrorIntFlag 

FD frames Error Interrupt Flag.

kFLEXCAN_BusoffDoneIntFlag 

Bus Off Done Interrupt Flag.

kFLEXCAN_OverrunError 

Error Overrun Status.

kFLEXCAN_TxWarningIntFlag 

Tx Warning Interrupt Flag.

kFLEXCAN_RxWarningIntFlag 

Rx Warning Interrupt Flag.

kFLEXCAN_BusOffIntFlag 

Bus Off Interrupt Flag.

kFLEXCAN_ErrorIntFlag 

Error Interrupt Flag.

kFLEXCAN_WakeUpIntFlag 

Wake-Up Interrupt Flag.

kFLEXCAN_SynchFlag 

CAN Synchronization Status Flag.

kFLEXCAN_TxErrorWarningFlag 

Tx Error Warning Status Flag.

kFLEXCAN_RxErrorWarningFlag 

Rx Error Warning Status Flag.

kFLEXCAN_IdleFlag 

CAN IDLE Status Flag.

kFLEXCAN_FaultConfinementFlag 

Fault Confinement Status Flag.

kFLEXCAN_TransmittingFlag 

FlexCAN In Transmission Status Flag.

kFLEXCAN_ReceivingFlag 

FlexCAN In Reception Status Flag.

kFLEXCAN_StatusAllFlags 

All status/interrupt flags which are write clearable.

The FlexCAN Rx FIFO Status enumerations are used to determine the status of the Rx FIFO. Because Rx FIFO occupy the MB0 ~ MB7 (Rx Fifo filter also occupies more Message Buffer space), Rx FIFO status flags are mapped to the corresponding Message Buffer status flags.

Enumerator
kFLEXCAN_RxFifoOverflowFlag 

Rx FIFO overflow flag.

kFLEXCAN_RxFifoWarningFlag 

Rx FIFO almost full flag.

kFLEXCAN_RxFifoFrameAvlFlag 

Frames available in Rx FIFO flag.

Function Documentation

uint32_t FLEXCAN_GetInstance ( CAN_Type *  base)
Parameters
baseFlexCAN peripheral base address.
Returns
FlexCAN instance.
void FLEXCAN_Init ( CAN_Type *  base,
const flexcan_config_t psConfig 
)

This function initializes the FlexCAN module with user-defined settings. User can call the FELXCAN_GetDefaultConfig function an starting point for the needed init configuration structure.

Note
If user want to initialize the peripheral in CAN FD mode, user can call the FLEXCAN_GetFDDefaultConfig to get the _flexcan_fd_config_t and assign the address of the data structure to the member psFDConfig of _flexcan_config_t
Parameters
baseFlexCAN peripheral base address.
psConfigPointer to the user-defined configuration structure.
void FLEXCAN_Deinit ( CAN_Type *  base)

This function disables the FlexCAN module clock and sets all register values to the reset value.

Parameters
baseFlexCAN peripheral base address.
void FLEXCAN_GetDefaultConfig ( flexcan_config_t psConfig,
uint32_t  u32ClkFreqHz 
)

This function initializes the FlexCAN configuration structure to default values. The default values are as follows. User is requested to provide the clock frequency for the peripheral.

Note
By default, CAN FD mode is disabled and not configured.
psConfig->u32ClkFreqHz = u32ClkFreqHz;
psConfig->eClkSrc = kFLEXCAN_ClkSrc0;
psConfig->u32BaudRateBps = 1000000U;
psConfig->u8MaxMsgBufNum = 16;
psConfig->bEnableLoopBack = false;
psConfig->bEnableTimerSync = true;
psConfig->bEnableSelfWakeup = false;
psConfig->eWakeupSrc = kFLEXCAN_WakeupSrcUnfiltered;
psConfig->bEnableIndividMask = false;
psConfig->bDisableSelfReception = false;
psConfig->bEnableListenOnlyMode = false;
#if (defined(FSL_FEATURE_FLEXCAN_HAS_DOZE_MODE_SUPPORT) && FSL_FEATURE_FLEXCAN_HAS_DOZE_MODE_SUPPORT)
psConfig->bEnableDoze = false;
#endif
psConfig->sTimingConfig.u8PhaseSeg1 = 3;
psConfig->sTimingConfig.u8PhaseSeg2 = 2;
psConfig->sTimingConfig.u8PropSeg = 1;
psConfig->sTimingConfig.u8RJumpWidth = 1;
psConfig->psFDConfig = NULL;
Parameters
psConfigPointer to the FlexCAN configuration structure.
u32ClkFreqHzFlexcan peripheral clock
void FLEXCAN_GetFDDefaultConfig ( flexcan_fd_config_t psConfig)

The function provided the default value of the data structure as code below

psConfig->u32BaudRateBps = 2000000U;
psConfig->sTimingConfig.u8PhaseSeg1 = 3;
psConfig->sTimingConfig.u8PhaseSeg2 = 3;
psConfig->sTimingConfig.u8PropSeg = 1;
psConfig->sTimingConfig.u8RJumpWidth = 1;
psConfig->eMsgSize = kFLEXCAN_64BperMB;
psConfig->bEnableTxDelayCompensation = true;
psConfig->bEnableBitRateSwitch = true;
Parameters
psConfigPointer to the FlexCAN configuration structure.
void FLEXCAN_EnterFreezeMode ( CAN_Type *  base)

This function makes the FlexCAN work under Freeze Mode.

Parameters
baseFlexCAN peripheral base address.
void FLEXCAN_ExitFreezeMode ( CAN_Type *  base)

This function makes the FlexCAN leave Freeze Mode.

Parameters
baseFlexCAN peripheral base address.
bool FLEXCAN_FDCalculateImprovedTimingValues ( flexcan_timing_config_t psTimingConfig,
flexcan_timing_config_t psFDTimingConfig,
uint32_t  u32BaudRateBps,
uint32_t  u32FDBaudRateBps,
uint32_t  u32SrcClkHz 
)
Parameters
psTimingConfigPointer to the FlexCAN timing configuration structure.
psFDTimingConfigPointer to the FlexCAN FD timing configuration structure.
u32BaudRateBpsThe CANFD bus control speed in bps defined by user
u32FDBaudRateBpsThe CANFD bus data speed in bps defined by user
u32SrcClkHzThe Source clock data speed in bps. Zero to disable baudrate switching
psTimingConfigPointer to the FlexCAN timing configuration structure.
Returns
TRUE if timing configuration found, FALSE if failed to find configuration
bool FLEXCAN_CalculateImprovedTimingValues ( flexcan_timing_config_t psTimingConfig,
uint32_t  u32BaudRateBps,
uint32_t  u32SrcClkHz 
)
Parameters
psTimingConfigPointer to the FlexCAN timing configuration structure.
u32BaudRateBpsThe classical CAN speed in bps defined by user
u32SrcClkHzThe Source clock data speed in bps. Zero to disable baudrate switching
Returns
TRUE if timing configuration found, FALSE if failed to find configuration
void FLEXCAN_SetFDTimingConfig ( CAN_Type *  base,
const flexcan_timing_config_t psConfig 
)

This function gives user settings to CAN bus timing characteristic. The function is for an experienced user. For less experienced users, call the FLEXCAN_Init() and fill the baud rate field with a desired value. This provides the default timing characteristics to the module.

Note that calling FLEXCAN_SetFDTimingConfig() overrides the baud rate set in FLEXCAN_Init().

Parameters
baseFlexCAN peripheral base address.
psConfigPointer to the timing configuration structure.
void FLEXCAN_SetTimingConfig ( CAN_Type *  base,
const flexcan_timing_config_t psConfig 
)

This function gives user settings to CAN bus timing characteristic. The function is for an experienced user. For less experienced users, call the FLEXCAN_Init() and fill the baud rate field with a desired value. This provides the default timing characteristics to the module.

Note that calling FLEXCAN_SetTimingConfig() overrides the baud rate set in FLEXCAN_Init().

Parameters
baseFlexCAN peripheral base address.
psConfigPointer to the timing configuration structure.
void FLEXCAN_SetRxMbGlobalMask ( CAN_Type *  base,
uint32_t  u32RecMsgBufs 
)

This function sets the global mask for the FlexCAN message buffer in a matching process. The configuration is only effective when the Rx individual mask is disabled in the FLEXCAN_Init().

Parameters
baseFlexCAN peripheral base address.
u32RecMsgBufsRx Message Buffer Global Mask value.
void FLEXCAN_SetRxFifoGlobalMask ( CAN_Type *  base,
uint32_t  u32RecFifos 
)

This function sets the global mask for FlexCAN FIFO in a matching process.

Parameters
baseFlexCAN peripheral base address.
u32RecFifosRx Fifo Global Mask value.
void FLEXCAN_SetRxIndividualMask ( CAN_Type *  base,
uint8_t  u8MaskIdx,
uint32_t  u32Mask 
)

This function sets the individual mask for the FlexCAN matching process. The configuration is only effective when the Rx individual mask is enabled in the FLEXCAN_Init(). If the Rx FIFO is disabled, the individual mask is applied to the corresponding Message Buffer. If the Rx FIFO is enabled, the individual mask for Rx FIFO occupied Message Buffer is applied to the Rx Filter with the same index. Note that only the first 32 individual masks can be used as the Rx FIFO filter mask.

Parameters
baseFlexCAN peripheral base address.
u8MaskIdxThe Index of individual Mask.
u32MaskRx Individual Mask value.
void FLEXCAN_SetTxMbConfig ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
bool  bEnable 
)

This function aborts the previous transmission, cleans the Message Buffer, and configures it as a Transmit Message Buffer.

Parameters
baseFlexCAN peripheral base address.
u8MsgBufIdxThe Message Buffer index.
bEnableEnable/disable Tx Message Buffer.
  • true: Enable Tx Message Buffer.
  • false: Disable Tx Message Buffer.
void FLEXCAN_SetFDTxMbConfig ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
bool  bEnable 
)

This function aborts the previous transmission, cleans the Message Buffer, and configures it as a Transmit Message Buffer.

Parameters
baseFlexCAN peripheral base address.
u8MsgBufIdxThe Message Buffer index.
bEnableEnable/disable Tx Message Buffer.
  • true: Enable Tx Message Buffer.
  • false: Disable Tx Message Buffer.
void FLEXCAN_SetRxMbConfig ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
const flexcan_rx_mb_config_t psRxMsgBufConfig,
bool  bEnable 
)

This function cleans a FlexCAN build-in Message Buffer and configures it as a Receive Message Buffer.

Parameters
baseFlexCAN peripheral base address.
u8MsgBufIdxThe Message Buffer index.
psRxMsgBufConfigPointer to the FlexCAN Message Buffer configuration structure.
bEnableEnable/disable Rx Message Buffer.
  • true: Enable Rx Message Buffer.
  • false: Disable Rx Message Buffer.
void FLEXCAN_SetFDRxMbConfig ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
const flexcan_rx_mb_config_t psRxMsgBufConfig,
bool  bEnable 
)

This function cleans a FlexCAN build-in Message Buffer and configures it as a Receive Message Buffer.

Parameters
baseFlexCAN peripheral base address.
u8MsgBufIdxThe Message Buffer index.
psRxMsgBufConfigPointer to the FlexCAN Message Buffer configuration structure.
bEnableEnable/disable Rx Message Buffer.
  • true: Enable Rx Message Buffer.
  • false: Disable Rx Message Buffer.
void FLEXCAN_SetRxFifoConfig ( CAN_Type *  base,
const flexcan_rx_fifo_config_t psRxFifoConfig,
bool  bEnable 
)

This function configures the Rx FIFO with given Rx FIFO configuration.

Parameters
baseFlexCAN peripheral base address.
psRxFifoConfigPointer to the FlexCAN Rx FIFO configuration structure.
bEnableEnable/disable Rx FIFO.
  • true: Enable Rx FIFO.
  • false: Disable Rx FIFO.
static uint32_t FLEXCAN_GetStatusFlags ( CAN_Type *  base)
inlinestatic

This function gets all FlexCAN status flags. The flags are returned as the logical OR value of the enumerators _flexcan_status_flags. To check the specific status, compare the return value with enumerators in _flexcan_status_flags.

Parameters
baseFlexCAN peripheral base address.
Returns
FlexCAN status flags which are ORed by the enumerators in the _flexcan_status_flags.
static void FLEXCAN_ClearStatusFlags ( CAN_Type *  base,
uint32_t  u32StatusFlags 
)
inlinestatic

This function clears the FlexCAN status flags with a provided mask. An automatically cleared flag can't be cleared by this function.

Parameters
baseFlexCAN peripheral base address.
u32StatusFlagsThe status flags to be cleared, it is logical OR value of _flexcan_status_flags.
static void FLEXCAN_GetBusErrCount ( CAN_Type *  base,
uint8_t *  pu8TxErrBuf,
uint8_t *  pu8RxErrBuf 
)
inlinestatic

This function gets the FlexCAN Bus Error Counter value for both Tx and Rx direction. These values may be needed in the upper layer error handling.

Parameters
baseFlexCAN peripheral base address.
pu8TxErrBufBuffer to store Tx Error Counter value.
pu8RxErrBufBuffer to store Rx Error Counter value.
static uint32_t FLEXCAN_GetMbStatusFlags ( CAN_Type *  base,
uint32_t  mask 
)
inlinestatic

This function gets the interrupt flags of a given Message Buffers.

Parameters
baseFlexCAN peripheral base address.
maskThe ORed FlexCAN Message Buffer mask.
Returns
The status of given Message Buffers.
static void FLEXCAN_ClearMbStatusFlags ( CAN_Type *  base,
uint32_t  mask 
)
inlinestatic

This function clears the interrupt flags of a given Message Buffers.

Parameters
baseFlexCAN peripheral base address.
maskThe ORed FlexCAN Message Buffer mask.
static void FLEXCAN_EnableInterrupts ( CAN_Type *  base,
uint32_t  u32InterruptFlags 
)
inlinestatic

This function enables the FlexCAN interrupts according to the provided mask. The mask is a logical OR of enumeration members, see _flexcan_interrupt_enable.

Parameters
baseFlexCAN peripheral base address.
u32InterruptFlagsThe interrupts to enable. Logical OR of _flexcan_interrupt_enable.
static void FLEXCAN_DisableInterrupts ( CAN_Type *  base,
uint32_t  u32InterruptFlags 
)
inlinestatic

This function disables the FlexCAN interrupts according to the provided mask. The mask is a logical OR of enumeration members, see _flexcan_interrupt_enable.

Parameters
baseFlexCAN peripheral base address.
u32InterruptFlagsThe interrupts to disable. Logical OR of _flexcan_interrupt_enable.
static void FLEXCAN_EnableMbInterrupts ( CAN_Type *  base,
uint32_t  mask 
)
inlinestatic

This function enables the interrupts of given Message Buffers.

Parameters
baseFlexCAN peripheral base address.
maskThe ORed FlexCAN Message Buffer mask.
static void FLEXCAN_DisableMbInterrupts ( CAN_Type *  base,
uint32_t  mask 
)
inlinestatic

This function disables the interrupts of given Message Buffers.

Parameters
baseFlexCAN peripheral base address.
maskThe ORed FlexCAN Message Buffer mask.
void FLEXCAN_EnableRxFifoDMA ( CAN_Type *  base,
bool  bEnable 
)

This function enables or disables the DMA feature of FlexCAN build-in Rx FIFO.

Parameters
baseFlexCAN peripheral base address.
bEnabletrue to enable, false to disable.
static uint32_t FLEXCAN_GetRxFifoHeadAddr ( CAN_Type *  base)
inlinestatic

This function returns the FlexCAN Rx FIFO Head address, which is mainly used for the DMA/eDMA use case.

Parameters
baseFlexCAN peripheral base address.
Returns
FlexCAN Rx FIFO Head address.
static void FLEXCAN_Enable ( CAN_Type *  base,
bool  bEnable 
)
inlinestatic

This function enables or disables the FlexCAN module.

Parameters
baseFlexCAN base pointer.
bEnabletrue to enable, false to disable.
status_t FLEXCAN_WriteTxMb ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
const flexcan_frame_t psTxFrame 
)

This function writes a CAN Message to the specified Transmit Message Buffer and changes the Message Buffer state to start CAN Message transmit. After that the function returns immediately.

Parameters
baseFlexCAN peripheral base address.
u8MsgBufIdxThe FlexCAN Message Buffer index.
psTxFramePointer to CAN message frame to be sent.
Return values
kStatus_Success- Write Tx Message Buffer Successfully.
kStatus_Fail- Tx Message Buffer is currently in use.
status_t FLEXCAN_ReadRxMb ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
flexcan_frame_t psRxFrame 
)

This function reads a CAN message from a specified Receive Message Buffer. The function fills a receive CAN message frame structure with just received data and activates the Message Buffer again. The function returns immediately.

Parameters
baseFlexCAN peripheral base address.
u8MsgBufIdxThe FlexCAN Message Buffer index.
psRxFramePointer to CAN message frame structure for reception.
Return values
kStatus_Success- Rx Message Buffer is full and has been read successfully.
kStatus_FLEXCAN_RxOverflow- Rx Message Buffer is already overflowed and has been read successfully.
kStatus_Fail- Rx Message Buffer is empty.
status_t FLEXCAN_ReadRxFifo ( CAN_Type *  base,
flexcan_frame_t psRxFrame 
)

This function reads a CAN message from the FlexCAN build-in Rx FIFO.

Parameters
baseFlexCAN peripheral base address.
psRxFramePointer to CAN message frame structure for reception.
Return values
kStatus_Success- Read Message from Rx FIFO successfully.
kStatus_Fail- Rx FIFO is not enabled.
status_t FLEXCAN_WriteFDTxMb ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
const flexcan_fd_frame_t psTxFrame 
)

This function writes a CAN FD Message to the specified Transmit Message Buffer and changes the Message Buffer state to start CAN FD Message transmit. After that the function returns immediately.

Parameters
baseFlexCAN peripheral base address.
u8MsgBufIdxThe FlexCAN FD Message Buffer index.
psTxFramePointer to CAN FD message frame to be sent.
Return values
kStatus_Success- Write Tx Message Buffer Successfully.
kStatus_Fail- Tx Message Buffer is currently in use.
status_t FLEXCAN_ReadFDRxMb ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
flexcan_fd_frame_t psRxFrame 
)

This function reads a CAN FD message from a specified Receive Message Buffer. The function fills a receive CAN FD message frame structure with just received data and activates the Message Buffer again. The function returns immediately.

Parameters
baseFlexCAN peripheral base address.
u8MsgBufIdxThe FlexCAN FD Message Buffer index.
psRxFramePointer to CAN FD message frame structure for reception.
Return values
kStatus_Success- Rx Message Buffer is full and has been read successfully.
kStatus_FLEXCAN_RxOverflow- Rx Message Buffer is already overflowed and has been read successfully.
kStatus_Fail- Rx Message Buffer is empty.
status_t FLEXCAN_TransferSendBlocking ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
flexcan_frame_t psTxFrame 
)

Note that a transfer handle does not need to be created before calling this API.

Parameters
baseFlexCAN peripheral base pointer.
u8MsgBufIdxThe FlexCAN Message Buffer index.
psTxFramePointer to CAN message frame to be sent.
Return values
kStatus_Success- Write Tx Message Buffer Successfully.
kStatus_Fail- Tx Message Buffer is currently in use.
status_t FLEXCAN_TransferReceiveBlocking ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
flexcan_frame_t psRxFrame 
)

Note that a transfer handle does not need to be created before calling this API.

Parameters
baseFlexCAN peripheral base pointer.
u8MsgBufIdxThe FlexCAN Message Buffer index.
psRxFramePointer to CAN message frame structure for reception.
Return values
kStatus_Success- Rx Message Buffer is full and has been read successfully.
kStatus_FLEXCAN_RxOverflow- Rx Message Buffer is already overflowed and has been read successfully.
kStatus_Fail- Rx Message Buffer is empty.
status_t FLEXCAN_TransferReceiveFifoBlocking ( CAN_Type *  base,
flexcan_frame_t psRxFrame 
)

Note that a transfer handle does not need to be created before calling this API.

Parameters
baseFlexCAN peripheral base pointer.
psRxFramePointer to CAN message frame structure for reception.
Return values
kStatus_Success- Read Message from Rx FIFO successfully.
kStatus_Fail- Rx FIFO is not enabled.
status_t FLEXCAN_TransferFDSendBlocking ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
flexcan_fd_frame_t psTxFrame 
)

Note that a transfer handle does not need to be created before calling this API.

Parameters
baseFlexCAN peripheral base pointer.
u8MsgBufIdxThe FlexCAN FD Message Buffer index.
psTxFramePointer to CAN FD message frame to be sent.
Return values
kStatus_Success- Write Tx Message Buffer Successfully.
kStatus_Fail- Tx Message Buffer is currently in use.
status_t FLEXCAN_TransferFDReceiveBlocking ( CAN_Type *  base,
uint8_t  u8MsgBufIdx,
flexcan_fd_frame_t psRxFrame 
)

Note that a transfer handle does not need to be created before calling this API.

Parameters
baseFlexCAN peripheral base pointer.
u8MsgBufIdxThe FlexCAN FD Message Buffer index.
psRxFramePointer to CAN FD message frame structure for reception.
Return values
kStatus_Success- Rx Message Buffer is full and has been read successfully.
kStatus_FLEXCAN_RxOverflow- Rx Message Buffer is already overflowed and has been read successfully.
kStatus_Fail- Rx Message Buffer is empty.
void FLEXCAN_TransferCreateHandle ( CAN_Type *  base,
flexcan_handle_t *  psHandle,
flexcan_transfer_callback_t  pfCallback,
void *  pUserData 
)

This function initializes the FlexCAN handle, which can be used for other FlexCAN transactional APIs. Usually, for a specified FlexCAN instance, call this API once to get the initialized handle.

Parameters
baseFlexCAN peripheral base address.
psHandleFlexCAN handle pointer.
pfCallbackThe callback function.
pUserDataThe parameter of the callback function.
status_t FLEXCAN_TransferSendNonBlocking ( flexcan_handle_t *  psHandle,
flexcan_mb_transfer_t psMsgBufXfer 
)

This function sends a message using IRQ. This is a non-blocking function, which returns right away. When messages have been sent out, the send callback function is called.

Parameters
psHandleFlexCAN handle pointer.
psMsgBufXferFlexCAN Message Buffer transfer structure. See the flexcan_mb_transfer_t.
Return values
kStatus_SuccessStart Tx Message Buffer sending process successfully.
kStatus_FailWrite Tx Message Buffer failed.
kStatus_FLEXCAN_TxBusyTx Message Buffer is in use.
status_t FLEXCAN_TransferReceiveNonBlocking ( flexcan_handle_t *  psHandle,
flexcan_mb_transfer_t psMsgBufXfer 
)

This function receives a message using IRQ. This is non-blocking function, which returns right away. When the message has been received, the receive callback function is called.

Parameters
psHandleFlexCAN handle pointer.
psMsgBufXferFlexCAN Message Buffer transfer structure. See the flexcan_mb_transfer_t.
Return values
kStatus_Success- Start Rx Message Buffer receiving process successfully.
kStatus_FLEXCAN_RxBusy- Rx Message Buffer is in use.
status_t FLEXCAN_TransferReceiveFifoNonBlocking ( flexcan_handle_t *  psHandle,
flexcan_fifo_transfer_t psFifoXfer 
)

This function receives a message using IRQ. This is a non-blocking function, which returns right away. When all messages have been received, the receive callback function is called.

Parameters
psHandleFlexCAN handle pointer.
psFifoXferFlexCAN Rx FIFO transfer structure. See the flexcan_fifo_transfer_t.
Return values
kStatus_Success- Start Rx FIFO receiving process successfully.
kStatus_FLEXCAN_RxFifoBusy- Rx FIFO is currently in use.
uint32_t FLEXCAN_GetTimeStamp ( flexcan_handle_t *  psHandle,
uint8_t  u8MsgBufIdx 
)

Then function can only be used when calling non-blocking Data transfer (TX/RX) API, After TX/RX data transfer done (User can get the status by handler's callback function), we can get the detail index of Mailbox's timestamp by handle, Detail non-blocking data transfer API (TX/RX) contain. -FLEXCAN_TransferSendNonBlocking -FLEXCAN_TransferFDSendNonBlocking -FLEXCAN_TransferReceiveNonBlocking -FLEXCAN_TransferFDReceiveNonBlocking -FLEXCAN_TransferReceiveFifoNonBlocking

Parameters
psHandleFlexCAN handle pointer.
u8MsgBufIdxThe FlexCAN FD Message Buffer index.
Return values
theindex of mailbox 's timestamp stored in the handle.
void FLEXCAN_TransferAbortSend ( flexcan_handle_t *  psHandle,
uint8_t  u8MsgBufIdx 
)

This function aborts the interrupt driven message send process.

Parameters
psHandleFlexCAN handle pointer.
u8MsgBufIdxThe FlexCAN Message Buffer index.
void FLEXCAN_TransferAbortReceive ( flexcan_handle_t *  psHandle,
uint8_t  u8MsgBufIdx 
)

This function aborts the interrupt driven message receive process.

Parameters
psHandleFlexCAN handle pointer.
u8MsgBufIdxThe FlexCAN Message Buffer index.
void FLEXCAN_TransferAbortReceiveFifo ( flexcan_handle_t *  psHandle)

This function aborts the interrupt driven message receive from Rx FIFO process.

Parameters
psHandleFlexCAN handle pointer.
void FLEXCAN_TransferHandleIRQ ( flexcan_handle_t *  psHandle)

This function handles the FlexCAN Error, the Message Buffer, and the Rx FIFO IRQ request.

Parameters
psHandleFlexCAN handle pointer.
status_t FLEXCAN_TransferFDSendNonBlocking ( flexcan_handle_t *  psHandle,
flexcan_mb_transfer_t psMsgBufXfer 
)

This function sends a message using IRQ. This is a non-blocking function, which returns right away. When messages have been sent out, the send callback function is called.

Parameters
psHandleFlexCAN handle pointer.
psMsgBufXferFlexCAN FD Message Buffer transfer structure. See the flexcan_mb_transfer_t.
Return values
kStatus_SuccessStart Tx Message Buffer sending process successfully.
kStatus_FailWrite Tx Message Buffer failed.
kStatus_FLEXCAN_TxBusyTx Message Buffer is in use.
status_t FLEXCAN_TransferFDReceiveNonBlocking ( flexcan_handle_t *  psHandle,
flexcan_mb_transfer_t psMsgBufXfer 
)

This function receives a message using IRQ. This is non-blocking function, which returns right away. When the message has been received, the receive callback function is called.

Parameters
psHandleFlexCAN handle pointer.
psMsgBufXferFlexCAN FD Message Buffer transfer structure. See the flexcan_mb_transfer_t.
Return values
kStatus_Success- Start Rx Message Buffer receiving process successfully.
kStatus_FLEXCAN_RxBusy- Rx Message Buffer is in use.
void FLEXCAN_TransferFDAbortSend ( flexcan_handle_t *  psHandle,
uint8_t  u8MsgBufIdx 
)

This function aborts the interrupt driven message send process.

Parameters
psHandleFlexCAN handle pointer.
u8MsgBufIdxThe FlexCAN FD Message Buffer index.
void FLEXCAN_TransferFDAbortReceive ( flexcan_handle_t *  psHandle,
uint8_t  u8MsgBufIdx 
)

This function aborts the interrupt driven message receive process.

Parameters
psHandleFlexCAN handle pointer.
u8MsgBufIdxThe FlexCAN FD Message Buffer index.