MCUXpresso SDK API Reference Manual  Rev 2.16.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

This section describes the programming interface of the FlexCAN driver. The FlexCAN driver configures FlexCAN module and provides functional and transactional interfaces to build the FlexCAN application.

Typical use case

Message Buffer Send Operation

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/flexcan

Message Buffer Receive Operation

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/flexcan

Receive FIFO Operation

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/flexcan

Data Structures

struct  _flexcan_memory_error_report_status
 FlexCAN memory error register status structure. More...
 
struct  _flexcan_frame
 FlexCAN message frame structure. More...
 
struct  _flexcan_fd_frame
 CAN FD message frame structure. More...
 
struct  _flexcan_timing_config
 FlexCAN protocol timing characteristic configuration structure. More...
 
struct  _flexcan_config
 FlexCAN module configuration structure. More...
 
struct  _flexcan_rx_mb_config
 FlexCAN Receive Message Buffer configuration structure. More...
 
struct  _flexcan_rx_fifo_config
 FlexCAN Legacy Rx FIFO configuration structure. More...
 
struct  _flexcan_mb_transfer
 FlexCAN Message Buffer transfer. More...
 
struct  _flexcan_fifo_transfer
 FlexCAN Rx FIFO transfer. More...
 
struct  _flexcan_handle
 FlexCAN handle structure. More...
 

Macros

#define DLC_LENGTH_DECODE(dlc)   (((dlc) <= 8U) ? (dlc) : (((dlc) <= 12U) ? (((dlc)-6U) * 4U) : (((dlc)-11U) * 16U)))
 FlexCAN frame length helper macro. More...
 
#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 Legacy 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...
 
#define FLEXCAN_MECR_INT_MASK(x)   (((uint64_t)(((uint64_t)(x)) << 16)) & 0xD00000000U)
 FlexCAN interrupt/status flag helper macro. More...
 
#define FLEXCAN_MEMORY_ENHANCED_RX_FIFO_INIT_FLAG   (0U)
 FlexCAN Enhanced Rx FIFO base address helper macro. More...
 
#define FLEXCAN_CALLBACK(x)   void(x)(CAN_Type * base, flexcan_handle_t * handle, status_t status, uint64_t result, void *userData)
 FlexCAN transfer callback function. More...
 

Typedefs

typedef enum _flexcan_frame_format flexcan_frame_format_t
 FlexCAN frame format. More...
 
typedef enum _flexcan_frame_type flexcan_frame_type_t
 FlexCAN frame type. More...
 
typedef enum _flexcan_clock_source flexcan_clock_source_t
 FlexCAN clock source. More...
 
typedef enum
_flexcan_wake_up_source 
flexcan_wake_up_source_t
 FlexCAN wake up source. More...
 
typedef enum
_flexcan_rx_fifo_filter_type 
flexcan_rx_fifo_filter_type_t
 FlexCAN Rx Fifo Filter type. More...
 
typedef enum _flexcan_mb_size flexcan_mb_size_t
 FlexCAN Message Buffer Payload size.
 
typedef enum
_flexcan_rx_fifo_priority 
flexcan_rx_fifo_priority_t
 FlexCAN Enhanced/Legacy Rx FIFO priority. More...
 
typedef enum
_flexcan_memory_error_type 
flexcan_memory_error_type_t
 FlexCAN Memory Error Type.
 
typedef enum
_flexcan_memory_access_type 
flexcan_memory_access_type_t
 FlexCAN Memory Access Type.
 
typedef enum
_flexcan_byte_error_syndrome 
flexcan_byte_error_syndrome_t
 FlexCAN Memory Error Byte Syndrome.
 
typedef struct
_flexcan_memory_error_report_status 
flexcan_memory_error_report_status_t
 FlexCAN memory error register status structure. More...
 
typedef struct _flexcan_frame flexcan_frame_t
 FlexCAN message frame structure. More...
 
typedef struct _flexcan_fd_frame flexcan_fd_frame_t
 CAN FD message frame structure. More...
 
typedef struct
_flexcan_timing_config 
flexcan_timing_config_t
 FlexCAN protocol timing characteristic configuration structure. More...
 
typedef struct _flexcan_config flexcan_config_t
 FlexCAN module configuration structure. More...
 
typedef struct
_flexcan_rx_mb_config 
flexcan_rx_mb_config_t
 FlexCAN Receive Message Buffer configuration structure. More...
 
typedef struct
_flexcan_rx_fifo_config 
flexcan_rx_fifo_config_t
 FlexCAN Legacy Rx FIFO configuration structure. More...
 
typedef struct _flexcan_mb_transfer flexcan_mb_transfer_t
 FlexCAN Message Buffer transfer. More...
 
typedef struct
_flexcan_fifo_transfer 
flexcan_fifo_transfer_t
 FlexCAN Rx FIFO transfer. More...
 
typedef struct _flexcan_handle flexcan_handle_t
 FlexCAN handle structure definition. More...
 

Enumerations

enum  {
  kStatus_FLEXCAN_TxBusy = MAKE_STATUS(kStatusGroup_FLEXCAN, 0),
  kStatus_FLEXCAN_TxIdle = MAKE_STATUS(kStatusGroup_FLEXCAN, 1),
  kStatus_FLEXCAN_TxSwitchToRx,
  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_RxFifoDisabled,
  kStatus_FLEXCAN_ErrorStatus = MAKE_STATUS(kStatusGroup_FLEXCAN, 11),
  kStatus_FLEXCAN_WakeUp = MAKE_STATUS(kStatusGroup_FLEXCAN, 12),
  kStatus_FLEXCAN_UnHandled = MAKE_STATUS(kStatusGroup_FLEXCAN, 13),
  kStatus_FLEXCAN_RxRemote = MAKE_STATUS(kStatusGroup_FLEXCAN, 14)
}
 FlexCAN transfer status. More...
 
enum  _flexcan_frame_format {
  kFLEXCAN_FrameFormatStandard = 0x0U,
  kFLEXCAN_FrameFormatExtend = 0x1U
}
 FlexCAN frame format. More...
 
enum  _flexcan_frame_type {
  kFLEXCAN_FrameTypeData = 0x0U,
  kFLEXCAN_FrameTypeRemote = 0x1U
}
 FlexCAN frame type. More...
 
enum  _flexcan_clock_source {
  kFLEXCAN_ClkSrcOsc = 0x0U,
  kFLEXCAN_ClkSrcPeri = 0x1U,
  kFLEXCAN_ClkSrc0 = 0x0U,
  kFLEXCAN_ClkSrc1 = 0x1U
}
 FlexCAN clock source. More...
 
enum  _flexcan_wake_up_source {
  kFLEXCAN_WakeupSrcUnfiltered = 0x0U,
  kFLEXCAN_WakeupSrcFiltered = 0x1U
}
 FlexCAN wake up source. More...
 
enum  _flexcan_rx_fifo_filter_type {
  kFLEXCAN_RxFifoFilterTypeA = 0x0U,
  kFLEXCAN_RxFifoFilterTypeB,
  kFLEXCAN_RxFifoFilterTypeC,
  kFLEXCAN_RxFifoFilterTypeD = 0x3U
}
 FlexCAN Rx Fifo Filter type. More...
 
enum  _flexcan_mb_size {
  kFLEXCAN_8BperMB = 0x0U,
  kFLEXCAN_16BperMB = 0x1U,
  kFLEXCAN_32BperMB = 0x2U,
  kFLEXCAN_64BperMB = 0x3U
}
 FlexCAN Message Buffer Payload size. More...
 
enum  _flexcan_fd_frame_length {
  kFLEXCAN_0BperFrame = 0x0U,
  kFLEXCAN_1BperFrame,
  kFLEXCAN_2BperFrame,
  kFLEXCAN_3BperFrame,
  kFLEXCAN_4BperFrame,
  kFLEXCAN_5BperFrame,
  kFLEXCAN_6BperFrame,
  kFLEXCAN_7BperFrame,
  kFLEXCAN_8BperFrame,
  kFLEXCAN_12BperFrame,
  kFLEXCAN_16BperFrame,
  kFLEXCAN_20BperFrame,
  kFLEXCAN_24BperFrame,
  kFLEXCAN_32BperFrame,
  kFLEXCAN_48BperFrame,
  kFLEXCAN_64BperFrame
}
 FlexCAN CAN FD frame supporting data length (available DLC values). More...
 
enum  _flexcan_rx_fifo_priority {
  kFLEXCAN_RxFifoPrioLow = 0x0U,
  kFLEXCAN_RxFifoPrioHigh = 0x1U
}
 FlexCAN Enhanced/Legacy Rx FIFO priority. More...
 
enum  _flexcan_interrupt_enable {
  kFLEXCAN_BusOffInterruptEnable = CAN_CTRL1_BOFFMSK_MASK,
  kFLEXCAN_ErrorInterruptEnable = CAN_CTRL1_ERRMSK_MASK,
  kFLEXCAN_TxWarningInterruptEnable = CAN_CTRL1_TWRNMSK_MASK,
  kFLEXCAN_RxWarningInterruptEnable = CAN_CTRL1_RWRNMSK_MASK,
  kFLEXCAN_WakeUpInterruptEnable = CAN_MCR_WAKMSK_MASK,
  kFLEXCAN_FDErrorInterruptEnable = CAN_CTRL2_ERRMSK_FAST_MASK,
  kFLEXCAN_HostAccessNCErrorInterruptEnable = FLEXCAN_MECR_INT_MASK(CAN_MECR_HANCEI_MSK_MASK),
  kFLEXCAN_FlexCanAccessNCErrorInterruptEnable = FLEXCAN_MECR_INT_MASK(CAN_MECR_FANCEI_MSK_MASK),
  kFLEXCAN_HostOrFlexCanCErrorInterruptEnable = FLEXCAN_MECR_INT_MASK(CAN_MECR_CEI_MSK_MASK)
}
 FlexCAN interrupt enable enumerations. More...
 
enum  _flexcan_flags {
  kFLEXCAN_ErrorOverrunFlag = CAN_ESR1_ERROVR_MASK,
  kFLEXCAN_FDErrorIntFlag = CAN_ESR1_ERRINT_FAST_MASK,
  kFLEXCAN_BusoffDoneIntFlag = CAN_ESR1_BOFFDONEINT_MASK,
  kFLEXCAN_SynchFlag = CAN_ESR1_SYNCH_MASK,
  kFLEXCAN_TxWarningIntFlag = CAN_ESR1_TWRNINT_MASK,
  kFLEXCAN_RxWarningIntFlag = CAN_ESR1_RWRNINT_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_BusOffIntFlag = CAN_ESR1_BOFFINT_MASK,
  kFLEXCAN_ErrorIntFlag = CAN_ESR1_ERRINT_MASK,
  kFLEXCAN_WakeUpIntFlag = CAN_ESR1_WAKINT_MASK ,
  kFLEXCAN_HostAccessNonCorrectableErrorIntFlag = FLEXCAN_MECR_INT_MASK(CAN_ERRSR_HANCEIF_MASK),
  kFLEXCAN_FlexCanAccessNonCorrectableErrorIntFlag = FLEXCAN_MECR_INT_MASK(CAN_ERRSR_FANCEIF_MASK),
  kFLEXCAN_CorrectableErrorIntFlag = FLEXCAN_MECR_INT_MASK(CAN_ERRSR_CEIF_MASK),
  kFLEXCAN_HostAccessNonCorrectableErrorOverrunFlag = FLEXCAN_MECR_INT_MASK(CAN_ERRSR_HANCEIOF_MASK),
  kFLEXCAN_FlexCanAccessNonCorrectableErrorOverrunFlag = FLEXCAN_MECR_INT_MASK(CAN_ERRSR_FANCEIOF_MASK),
  kFLEXCAN_CorrectableErrorOverrunFlag = FLEXCAN_MECR_INT_MASK(CAN_ERRSR_CEIOF_MASK),
  kFLEXCAN_AllMemoryErrorFlag
}
 FlexCAN status flags. More...
 
enum  _flexcan_error_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_TxErrorWarningFlag = CAN_ESR1_TXWRN_MASK,
  kFLEXCAN_RxErrorWarningFlag = CAN_ESR1_RXWRN_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
}
 FlexCAN error status flags. More...
 
enum  {
  kFLEXCAN_RxFifoOverflowFlag = CAN_IFLAG1_BUF7I_MASK,
  kFLEXCAN_RxFifoWarningFlag = CAN_IFLAG1_BUF6I_MASK,
  kFLEXCAN_RxFifoFrameAvlFlag = CAN_IFLAG1_BUF5I_MASK
}
 FlexCAN Legacy Rx FIFO status flags. More...
 
enum  _flexcan_memory_error_type {
  kFLEXCAN_CorrectableError = 0U,
  kFLEXCAN_NonCorrectableError
}
 FlexCAN Memory Error Type. More...
 
enum  _flexcan_memory_access_type {
  kFLEXCAN_MoveOutFlexCanAccess = 0U,
  kFLEXCAN_MoveInAccess,
  kFLEXCAN_TxArbitrationAccess,
  kFLEXCAN_RxMatchingAccess,
  kFLEXCAN_MoveOutHostAccess
}
 FlexCAN Memory Access Type. More...
 
enum  _flexcan_byte_error_syndrome {
  kFLEXCAN_NoError = 0U,
  kFLEXCAN_ParityBits0Error = 1U,
  kFLEXCAN_ParityBits1Error = 2U,
  kFLEXCAN_ParityBits2Error = 4U,
  kFLEXCAN_ParityBits3Error = 8U,
  kFLEXCAN_ParityBits4Error = 16U,
  kFLEXCAN_DataBits0Error = 28U,
  kFLEXCAN_DataBits1Error = 22U,
  kFLEXCAN_DataBits2Error = 19U,
  kFLEXCAN_DataBits3Error = 25U,
  kFLEXCAN_DataBits4Error = 26U,
  kFLEXCAN_DataBits5Error = 7U,
  kFLEXCAN_DataBits6Error = 21U,
  kFLEXCAN_DataBits7Error = 14U,
  kFLEXCAN_AllZeroError = 6U,
  kFLEXCAN_AllOneError = 31U,
  kFLEXCAN_NonCorrectableErrors
}
 FlexCAN Memory Error Byte Syndrome. More...
 

Driver version

#define FSL_FLEXCAN_DRIVER_VERSION   (MAKE_VERSION(2, 11, 6))
 FlexCAN driver version. More...
 

Initialization and deinitialization

bool FLEXCAN_IsInstanceHasFDMode (CAN_Type *base)
 Determine whether the FlexCAN instance support CAN FD mode at run time. More...
 
void FLEXCAN_EnterFreezeMode (CAN_Type *base)
 Enter FlexCAN Freeze Mode. More...
 
void FLEXCAN_ExitFreezeMode (CAN_Type *base)
 Exit FlexCAN Freeze Mode. More...
 
uint32_t FLEXCAN_GetInstance (CAN_Type *base)
 Get the FlexCAN instance from peripheral base address. More...
 
bool FLEXCAN_CalculateImprovedTimingValues (CAN_Type *base, uint32_t bitRate, uint32_t sourceClock_Hz, flexcan_timing_config_t *pTimingConfig)
 Calculates the improved timing values by specific bit Rates for classical CAN. More...
 
void FLEXCAN_Init (CAN_Type *base, const flexcan_config_t *pConfig, uint32_t sourceClock_Hz)
 Initializes a FlexCAN instance. More...
 
bool FLEXCAN_FDCalculateImprovedTimingValues (CAN_Type *base, uint32_t bitRate, uint32_t bitRateFD, uint32_t sourceClock_Hz, flexcan_timing_config_t *pTimingConfig)
 Calculates the improved timing values by specific bit rates for CANFD. More...
 
void FLEXCAN_FDInit (CAN_Type *base, const flexcan_config_t *pConfig, uint32_t sourceClock_Hz, flexcan_mb_size_t dataSize, bool brs)
 Initializes a FlexCAN instance. More...
 
void FLEXCAN_Deinit (CAN_Type *base)
 De-initializes a FlexCAN instance. More...
 
void FLEXCAN_GetDefaultConfig (flexcan_config_t *pConfig)
 Gets the default configuration structure. More...
 

Configuration.

void FLEXCAN_SetTimingConfig (CAN_Type *base, const flexcan_timing_config_t *pConfig)
 Sets the FlexCAN classical CAN protocol timing characteristic. More...
 
status_t FLEXCAN_SetBitRate (CAN_Type *base, uint32_t sourceClock_Hz, uint32_t bitRate_Bps)
 Set bit rate of FlexCAN classical CAN frame or CAN FD frame nominal phase. More...
 
void FLEXCAN_SetFDTimingConfig (CAN_Type *base, const flexcan_timing_config_t *pConfig)
 Sets the FlexCAN CANFD data phase timing characteristic. More...
 
status_t FLEXCAN_SetFDBitRate (CAN_Type *base, uint32_t sourceClock_Hz, uint32_t bitRateN_Bps, uint32_t bitRateD_Bps)
 Set bit rate of FlexCAN FD frame. More...
 
void FLEXCAN_SetRxMbGlobalMask (CAN_Type *base, uint32_t mask)
 Sets the FlexCAN receive message buffer global mask. More...
 
void FLEXCAN_SetRxFifoGlobalMask (CAN_Type *base, uint32_t mask)
 Sets the FlexCAN receive FIFO global mask. More...
 
void FLEXCAN_SetRxIndividualMask (CAN_Type *base, uint8_t maskIdx, uint32_t mask)
 Sets the FlexCAN receive individual mask. More...
 
void FLEXCAN_SetTxMbConfig (CAN_Type *base, uint8_t mbIdx, bool enable)
 Configures a FlexCAN transmit message buffer. More...
 
void FLEXCAN_SetFDTxMbConfig (CAN_Type *base, uint8_t mbIdx, bool enable)
 Configures a FlexCAN transmit message buffer. More...
 
void FLEXCAN_SetRxMbConfig (CAN_Type *base, uint8_t mbIdx, const flexcan_rx_mb_config_t *pRxMbConfig, bool enable)
 Configures a FlexCAN Receive Message Buffer. More...
 
void FLEXCAN_SetFDRxMbConfig (CAN_Type *base, uint8_t mbIdx, const flexcan_rx_mb_config_t *pRxMbConfig, bool enable)
 Configures a FlexCAN Receive Message Buffer. More...
 
void FLEXCAN_SetRxFifoConfig (CAN_Type *base, const flexcan_rx_fifo_config_t *pRxFifoConfig, bool enable)
 Configures the FlexCAN Legacy Rx FIFO. More...
 

Status

static uint64_t FLEXCAN_GetStatusFlags (CAN_Type *base)
 Gets the FlexCAN module interrupt flags. More...
 
static void FLEXCAN_ClearStatusFlags (CAN_Type *base, uint64_t mask)
 Clears status flags with the provided mask. More...
 
static void FLEXCAN_GetBusErrCount (CAN_Type *base, uint8_t *txErrBuf, uint8_t *rxErrBuf)
 Gets the FlexCAN Bus Error Counter value. More...
 
static uint64_t FLEXCAN_GetMbStatusFlags (CAN_Type *base, uint64_t mask)
 Gets the FlexCAN Message Buffer interrupt flags. More...
 
static void FLEXCAN_ClearMbStatusFlags (CAN_Type *base, uint64_t mask)
 Clears the FlexCAN Message Buffer interrupt flags. More...
 
void FLEXCAN_GetMemoryErrorReportStatus (CAN_Type *base, flexcan_memory_error_report_status_t *errorStatus)
 Gets the FlexCAN Memory Error Report registers status. More...
 

Interrupts

static void FLEXCAN_EnableInterrupts (CAN_Type *base, uint64_t mask)
 Enables FlexCAN interrupts according to the provided mask. More...
 
static void FLEXCAN_DisableInterrupts (CAN_Type *base, uint64_t mask)
 Disables FlexCAN interrupts according to the provided mask. More...
 
static void FLEXCAN_EnableMbInterrupts (CAN_Type *base, uint64_t mask)
 Enables FlexCAN Message Buffer interrupts. More...
 
static void FLEXCAN_DisableMbInterrupts (CAN_Type *base, uint64_t mask)
 Disables FlexCAN Message Buffer interrupts. More...
 

DMA Control

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

Bus Operations

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

Transactional

status_t FLEXCAN_TransferFDSendBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_fd_frame_t *pTxFrame)
 Performs a polling send transaction on the CAN bus. More...
 
status_t FLEXCAN_TransferFDReceiveBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_fd_frame_t *pRxFrame)
 Performs a polling receive transaction on the CAN bus. More...
 
status_t FLEXCAN_TransferFDSendNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer)
 Sends a message using IRQ. More...
 
status_t FLEXCAN_TransferFDReceiveNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer)
 Receives a message using IRQ. More...
 
void FLEXCAN_TransferFDAbortSend (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx)
 Aborts the interrupt driven message send process. More...
 
void FLEXCAN_TransferFDAbortReceive (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx)
 Aborts the interrupt driven message receive process. More...
 
status_t FLEXCAN_TransferSendBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_frame_t *pTxFrame)
 Performs a polling send transaction on the CAN bus. More...
 
status_t FLEXCAN_TransferReceiveBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_frame_t *pRxFrame)
 Performs a polling receive transaction on the CAN bus. More...
 
status_t FLEXCAN_TransferReceiveFifoBlocking (CAN_Type *base, flexcan_frame_t *pRxFrame)
 Performs a polling receive transaction from Legacy Rx FIFO on the CAN bus. More...
 
void FLEXCAN_TransferCreateHandle (CAN_Type *base, flexcan_handle_t *handle, flexcan_transfer_callback_t callback, void *userData)
 Initializes the FlexCAN handle. More...
 
status_t FLEXCAN_TransferSendNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer)
 Sends a message using IRQ. More...
 
status_t FLEXCAN_TransferReceiveNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer)
 Receives a message using IRQ. More...
 
status_t FLEXCAN_TransferReceiveFifoNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_fifo_transfer_t *pFifoXfer)
 Receives a message from Rx FIFO using IRQ. More...
 
status_t FLEXCAN_TransferGetReceiveFifoCount (CAN_Type *base, flexcan_handle_t *handle, size_t *count)
 Gets the Legacy Rx Fifo transfer status during a interrupt non-blocking receive. More...
 
uint32_t FLEXCAN_GetTimeStamp (flexcan_handle_t *handle, uint8_t mbIdx)
 Gets the detail index of Mailbox's Timestamp by handle. More...
 
void FLEXCAN_TransferAbortSend (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx)
 Aborts the interrupt driven message send process. More...
 
void FLEXCAN_TransferAbortReceive (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx)
 Aborts the interrupt driven message receive process. More...
 
void FLEXCAN_TransferAbortReceiveFifo (CAN_Type *base, flexcan_handle_t *handle)
 Aborts the interrupt driven message receive from Rx FIFO process. More...
 
void FLEXCAN_TransferHandleIRQ (CAN_Type *base, flexcan_handle_t *handle)
 FlexCAN IRQ handle function. More...
 

Data Structure Documentation

struct _flexcan_memory_error_report_status

This structure contains the memory access properties that caused a memory error access. It is used as the parameter of FLEXCAN_GetMemoryErrorReportStatus() function. And user can use FLEXCAN_GetMemoryErrorReportStatus to get the status of the last memory error access.

Data Fields

flexcan_memory_error_type_t errorType
 The type of memory error that giving rise to the report. More...
 
flexcan_memory_access_type_t accessType
 The type of memory access that giving rise to the memory error. More...
 
uint16_t accessAddress
 The address where memory error detected. More...
 
uint32_t errorData
 The raw data word read from memory with error. More...
 
bool byteIsRead
 The byte n (0~3) was read or not. More...
 

Field Documentation

flexcan_memory_error_type_t _flexcan_memory_error_report_status::errorType
flexcan_memory_access_type_t _flexcan_memory_error_report_status::accessType
uint16_t _flexcan_memory_error_report_status::accessAddress
uint32_t _flexcan_memory_error_report_status::errorData
bool _flexcan_memory_error_report_status::byteIsRead

The type of error and which bit in byte (n) is affected by the error.

struct _flexcan_frame

Field Documentation

uint32_t _flexcan_frame::timestamp
uint32_t _flexcan_frame::length
uint32_t _flexcan_frame::type
uint32_t _flexcan_frame::format
uint32_t _flexcan_frame::__pad0__
uint32_t _flexcan_frame::idhit
uint32_t _flexcan_frame::id
uint32_t _flexcan_frame::dataWord0
uint32_t _flexcan_frame::dataWord1
uint8_t _flexcan_frame::dataByte3
uint8_t _flexcan_frame::dataByte2
uint8_t _flexcan_frame::dataByte1
uint8_t _flexcan_frame::dataByte0
uint8_t _flexcan_frame::dataByte7
uint8_t _flexcan_frame::dataByte6
uint8_t _flexcan_frame::dataByte5
uint8_t _flexcan_frame::dataByte4
struct _flexcan_fd_frame

The CAN FD message supporting up to sixty four bytes can be used for a data frame, depending on the length selected for the message buffers. The length should be a enumeration member, see _flexcan_fd_frame_length.

Field Documentation

uint32_t _flexcan_fd_frame::timestamp
uint32_t _flexcan_fd_frame::length

user can use DLC_LENGTH_DECODE(length) macro to get the number of valid data bytes.

uint32_t _flexcan_fd_frame::type
uint32_t _flexcan_fd_frame::format
uint32_t _flexcan_fd_frame::srr
uint32_t _flexcan_fd_frame::__pad0__
uint32_t _flexcan_fd_frame::esi
uint32_t _flexcan_fd_frame::brs
uint32_t _flexcan_fd_frame::edl
uint32_t _flexcan_fd_frame::id
uint32_t _flexcan_fd_frame::dataWord[16]
uint8_t _flexcan_fd_frame::dataByte3
uint8_t _flexcan_fd_frame::dataByte2
uint8_t _flexcan_fd_frame::dataByte1
uint8_t _flexcan_fd_frame::dataByte0
uint8_t _flexcan_fd_frame::dataByte7
uint8_t _flexcan_fd_frame::dataByte6
uint8_t _flexcan_fd_frame::dataByte5
uint8_t _flexcan_fd_frame::dataByte4
struct _flexcan_timing_config

Data Fields

uint16_t preDivider
 Classic CAN or CAN FD nominal phase bit rate prescaler. More...
 
uint8_t rJumpwidth
 Classic CAN or CAN FD nominal phase Re-sync Jump Width. More...
 
uint8_t phaseSeg1
 Classic CAN or CAN FD nominal phase Segment 1. More...
 
uint8_t phaseSeg2
 Classic CAN or CAN FD nominal phase Segment 2. More...
 
uint8_t propSeg
 Classic CAN or CAN FD nominal phase Propagation Segment. More...
 
uint16_t fpreDivider
 CAN FD data phase bit rate prescaler. More...
 
uint8_t frJumpwidth
 CAN FD data phase Re-sync Jump Width. More...
 
uint8_t fphaseSeg1
 CAN FD data phase Phase Segment 1. More...
 
uint8_t fphaseSeg2
 CAN FD data phase Phase Segment 2. More...
 
uint8_t fpropSeg
 CAN FD data phase Propagation Segment. More...
 

Field Documentation

uint16_t _flexcan_timing_config::preDivider
uint8_t _flexcan_timing_config::rJumpwidth
uint8_t _flexcan_timing_config::phaseSeg1
uint8_t _flexcan_timing_config::phaseSeg2
uint8_t _flexcan_timing_config::propSeg
uint16_t _flexcan_timing_config::fpreDivider
uint8_t _flexcan_timing_config::frJumpwidth
uint8_t _flexcan_timing_config::fphaseSeg1
uint8_t _flexcan_timing_config::fphaseSeg2
uint8_t _flexcan_timing_config::fpropSeg
struct _flexcan_config
Deprecated:

Do not use the baudRate. It has been superceded bitRate

Do not use the baudRateFD. It has been superceded bitRateFD

Data Fields

flexcan_clock_source_t clkSrc
 Clock source for FlexCAN Protocol Engine. More...
 
flexcan_wake_up_source_t wakeupSrc
 Wake up source selection. More...
 
uint8_t maxMbNum
 The maximum number of Message Buffers used by user. More...
 
bool enableLoopBack
 Enable or Disable Loop Back Self Test Mode. More...
 
bool enableTimerSync
 Enable or Disable Timer Synchronization. More...
 
bool enableSelfWakeup
 Enable or Disable Self Wakeup Mode. More...
 
bool enableIndividMask
 Enable or Disable Rx Individual Mask and Queue feature. More...
 
bool disableSelfReception
 Enable or Disable Self Reflection. More...
 
bool enableListenOnlyMode
 Enable or Disable Listen Only Mode. More...
 
bool enableSupervisorMode
 Enable or Disable Supervisor Mode, enable this mode will make registers allow only Supervisor access. More...
 
bool enableDoze
 Enable or Disable Doze Mode. More...
 
bool enableMemoryErrorControl
 Enable or Disable the memory errors detection and correction mechanism. More...
 
bool enableNonCorrectableErrorEnterFreeze
 Enable or Disable Non-Correctable Errors In FlexCAN Access Put Device In Freeze Mode. More...
 
uint32_t baudRate
 FlexCAN bit rate in bps, for classical CAN or CANFD nominal phase. More...
 
uint32_t baudRateFD
 FlexCAN FD bit rate in bps, for CANFD data phase. More...
 
uint32_t bitRate
 FlexCAN bit rate in bps, for classical CAN or CANFD nominal phase. More...
 
uint32_t bitRateFD
 FlexCAN FD bit rate in bps, for CANFD data phase. More...
 

Field Documentation

uint32_t _flexcan_config::baudRate
uint32_t _flexcan_config::baudRateFD
uint32_t _flexcan_config::bitRate
uint32_t _flexcan_config::bitRateFD
flexcan_clock_source_t _flexcan_config::clkSrc
flexcan_wake_up_source_t _flexcan_config::wakeupSrc
uint8_t _flexcan_config::maxMbNum
bool _flexcan_config::enableLoopBack
bool _flexcan_config::enableTimerSync
bool _flexcan_config::enableSelfWakeup
bool _flexcan_config::enableIndividMask
bool _flexcan_config::disableSelfReception
bool _flexcan_config::enableListenOnlyMode
bool _flexcan_config::enableSupervisorMode
bool _flexcan_config::enableDoze
bool _flexcan_config::enableMemoryErrorControl
bool _flexcan_config::enableNonCorrectableErrorEnterFreeze
struct _flexcan_rx_mb_config

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 id
 CAN Message Buffer Frame Identifier, should be set using FLEXCAN_ID_EXT() or FLEXCAN_ID_STD() macro. More...
 
flexcan_frame_format_t format
 CAN Frame Identifier format(Standard of Extend). More...
 
flexcan_frame_type_t type
 CAN Frame Type(Data or Remote). More...
 

Field Documentation

uint32_t _flexcan_rx_mb_config::id
flexcan_frame_format_t _flexcan_rx_mb_config::format
flexcan_frame_type_t _flexcan_rx_mb_config::type
struct _flexcan_rx_fifo_config

Data Fields

uint32_t * idFilterTable
 Pointer to the FlexCAN Legacy Rx FIFO identifier filter table. More...
 
uint8_t idFilterNum
 The FlexCAN Legacy Rx FIFO Filter elements quantity. More...
 
flexcan_rx_fifo_filter_type_t idFilterType
 The FlexCAN Legacy Rx FIFO Filter type. More...
 
flexcan_rx_fifo_priority_t priority
 The FlexCAN Legacy Rx FIFO receive priority. More...
 

Field Documentation

uint32_t* _flexcan_rx_fifo_config::idFilterTable
uint8_t _flexcan_rx_fifo_config::idFilterNum
flexcan_rx_fifo_filter_type_t _flexcan_rx_fifo_config::idFilterType
flexcan_rx_fifo_priority_t _flexcan_rx_fifo_config::priority
struct _flexcan_mb_transfer

Data Fields

flexcan_frame_tframe
 The buffer of CAN Message to be transfer. More...
 
uint8_t mbIdx
 The index of Message buffer used to transfer Message. More...
 

Field Documentation

flexcan_frame_t* _flexcan_mb_transfer::frame
uint8_t _flexcan_mb_transfer::mbIdx
struct _flexcan_fifo_transfer

Data Fields

flexcan_frame_tframe
 The buffer of CAN Message to be received from Legacy Rx FIFO. More...
 
size_t frameNum
 Number of CAN Message need to be received from Legacy or Ehanced Rx FIFO. More...
 

Field Documentation

flexcan_frame_t* _flexcan_fifo_transfer::frame
size_t _flexcan_fifo_transfer::frameNum
struct _flexcan_handle

Data Fields

flexcan_transfer_callback_t callback
 Callback function. More...
 
void * userData
 FlexCAN callback function parameter. More...
 
flexcan_frame_t *volatile mbFrameBuf [CAN_WORD1_COUNT]
 The buffer for received CAN data from Message Buffers. More...
 
flexcan_fd_frame_t *volatile mbFDFrameBuf [CAN_WORD1_COUNT]
 The buffer for received CAN FD data from Message Buffers. More...
 
flexcan_frame_t *volatile rxFifoFrameBuf
 The buffer for received CAN data from Legacy Rx FIFO. More...
 
size_t rxFifoFrameNum
 The number of CAN messages remaining to be received from Legacy or Ehanced Rx FIFO. More...
 
size_t rxFifoTransferTotalNum
 Total CAN Message number need to be received from Legacy or Ehanced Rx FIFO. More...
 
volatile uint8_t mbState [CAN_WORD1_COUNT]
 Message Buffer transfer state. More...
 
volatile uint8_t rxFifoState
 Rx FIFO transfer state. More...
 
volatile uint32_t timestamp [CAN_WORD1_COUNT]
 Mailbox transfer timestamp. More...
 

Field Documentation

flexcan_transfer_callback_t _flexcan_handle::callback
void* _flexcan_handle::userData
flexcan_frame_t* volatile _flexcan_handle::mbFrameBuf[CAN_WORD1_COUNT]
flexcan_fd_frame_t* volatile _flexcan_handle::mbFDFrameBuf[CAN_WORD1_COUNT]
flexcan_frame_t* volatile _flexcan_handle::rxFifoFrameBuf
size_t _flexcan_handle::rxFifoFrameNum
size_t _flexcan_handle::rxFifoTransferTotalNum
volatile uint8_t _flexcan_handle::mbState[CAN_WORD1_COUNT]
volatile uint8_t _flexcan_handle::rxFifoState
volatile uint32_t _flexcan_handle::timestamp[CAN_WORD1_COUNT]

Macro Definition Documentation

#define FSL_FLEXCAN_DRIVER_VERSION   (MAKE_VERSION(2, 11, 6))
#define DLC_LENGTH_DECODE (   dlc)    (((dlc) <= 8U) ? (dlc) : (((dlc) <= 12U) ? (((dlc)-6U) * 4U) : (((dlc)-11U) * 16U)))
#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:39

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:42
#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:39

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:42
#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:42
#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:42
#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:42
#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:42
#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:66
#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:71
#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:76
#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:79
#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:82
#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:85
#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:93
#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:102
#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:109
#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:112
#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:117
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_LOW (   id)    FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW(id)
#define FLEXCAN_MECR_INT_MASK (   x)    (((uint64_t)(((uint64_t)(x)) << 16)) & 0xD00000000U)
#define FLEXCAN_MEMORY_ENHANCED_RX_FIFO_INIT_FLAG   (0U)
#define FLEXCAN_CALLBACK (   x)    void(x)(CAN_Type * base, flexcan_handle_t * handle, status_t status, uint64_t result, void *userData)

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.

Typedef Documentation

Deprecated:

Do not use the kFLEXCAN_ClkSrcOs. It has been superceded kFLEXCAN_ClkSrc0

Do not use the kFLEXCAN_ClkSrcPeri. It has been superceded kFLEXCAN_ClkSrc1

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

This structure contains the memory access properties that caused a memory error access. It is used as the parameter of FLEXCAN_GetMemoryErrorReportStatus() function. And user can use FLEXCAN_GetMemoryErrorReportStatus to get the status of the last memory error access.

The CAN FD message supporting up to sixty four bytes can be used for a data frame, depending on the length selected for the message buffers. The length should be a enumeration member, see _flexcan_fd_frame_length.

Deprecated:

Do not use the baudRate. It has been superceded bitRate

Do not use the baudRateFD. It has been superceded bitRateFD

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.

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_RxFifoDisabled 

Rx Message FIFO is disabled during reading.

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.

Deprecated:

Do not use the kFLEXCAN_ClkSrcOs. It has been superceded kFLEXCAN_ClkSrc0

Do not use the kFLEXCAN_ClkSrcPeri. It has been superceded kFLEXCAN_ClkSrc1

Enumerator
kFLEXCAN_ClkSrcOsc 

FlexCAN Protocol Engine clock from Oscillator.

kFLEXCAN_ClkSrcPeri 

FlexCAN Protocol Engine clock from Peripheral Clock.

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.

For Tx, when the Data size corresponding to DLC value stored in the MB selected for transmission is larger than the MB Payload size, FlexCAN adds the necessary number of bytes with constant 0xCC pattern to complete the expected DLC. For Rx, when the Data size corresponding to DLC value received from the CAN bus is larger than the MB Payload size, the high order bytes that do not fit the Payload size will lose.

Enumerator
kFLEXCAN_0BperFrame 

Frame contains 0 valid data bytes.

kFLEXCAN_1BperFrame 

Frame contains 1 valid data bytes.

kFLEXCAN_2BperFrame 

Frame contains 2 valid data bytes.

kFLEXCAN_3BperFrame 

Frame contains 3 valid data bytes.

kFLEXCAN_4BperFrame 

Frame contains 4 valid data bytes.

kFLEXCAN_5BperFrame 

Frame contains 5 valid data bytes.

kFLEXCAN_6BperFrame 

Frame contains 6 valid data bytes.

kFLEXCAN_7BperFrame 

Frame contains 7 valid data bytes.

kFLEXCAN_8BperFrame 

Frame contains 8 valid data bytes.

kFLEXCAN_12BperFrame 

Frame contains 12 valid data bytes.

kFLEXCAN_16BperFrame 

Frame contains 16 valid data bytes.

kFLEXCAN_20BperFrame 

Frame contains 20 valid data bytes.

kFLEXCAN_24BperFrame 

Frame contains 24 valid data bytes.

kFLEXCAN_32BperFrame 

Frame contains 32 valid data bytes.

kFLEXCAN_48BperFrame 

Frame contains 48 valid data bytes.

kFLEXCAN_64BperFrame 

Frame contains 64 valid data bytes.

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

Enumerator
kFLEXCAN_RxFifoPrioLow 

Matching process start from Rx Message Buffer first.

kFLEXCAN_RxFifoPrioHigh 

Matching process start from Enhanced/Legacy Rx FIFO first.

This provides constants for the FlexCAN interrupt enable enumerations for use in the FlexCAN functions.

Note
FlexCAN Message Buffers and Legacy Rx FIFO interrupts not included in.
Enumerator
kFLEXCAN_BusOffInterruptEnable 

Bus Off interrupt, use bit 15.

kFLEXCAN_ErrorInterruptEnable 

CAN Error interrupt, use bit 14.

kFLEXCAN_TxWarningInterruptEnable 

Tx Warning interrupt, use bit 11.

kFLEXCAN_RxWarningInterruptEnable 

Rx Warning interrupt, use bit 10.

kFLEXCAN_WakeUpInterruptEnable 

Self Wake Up interrupt, use bit 26.

kFLEXCAN_FDErrorInterruptEnable 

CAN FD Error interrupt, use bit 31.

kFLEXCAN_HostAccessNCErrorInterruptEnable 

Host Access With Non-Correctable Errors interrupt, use high word bit 0.

kFLEXCAN_FlexCanAccessNCErrorInterruptEnable 

FlexCAN Access With Non-Correctable Errors interrupt, use high word bit 2.

kFLEXCAN_HostOrFlexCanCErrorInterruptEnable 

Host or FlexCAN Access With Correctable Errors interrupt, use high word bit 3.

This provides constants for the FlexCAN status flags for use in the FlexCAN functions.

Note
The CPU read action clears the bits corresponding to the FlEXCAN_ErrorFlag macro, therefore user need to read status flags and distinguish which error is occur using _flexcan_error_flags enumerations.
Enumerator
kFLEXCAN_ErrorOverrunFlag 

Error Overrun Status.

kFLEXCAN_FDErrorIntFlag 

CAN FD Error Interrupt Flag.

kFLEXCAN_BusoffDoneIntFlag 

Bus Off process completed Interrupt Flag.

kFLEXCAN_SynchFlag 

CAN Synchronization Status.

kFLEXCAN_TxWarningIntFlag 

Tx Warning Interrupt Flag.

kFLEXCAN_RxWarningIntFlag 

Rx Warning Interrupt Flag.

kFLEXCAN_IdleFlag 

FlexCAN In IDLE Status.

kFLEXCAN_FaultConfinementFlag 

FlexCAN Fault Confinement State.

kFLEXCAN_TransmittingFlag 

FlexCAN In Transmission Status.

kFLEXCAN_ReceivingFlag 

FlexCAN In Reception Status.

kFLEXCAN_BusOffIntFlag 

Bus Off Interrupt Flag.

kFLEXCAN_ErrorIntFlag 

CAN Error Interrupt Flag.

kFLEXCAN_WakeUpIntFlag 

Self Wake-Up Interrupt Flag.

kFLEXCAN_HostAccessNonCorrectableErrorIntFlag 

Host Access With Non-Correctable Error Interrupt Flag.

kFLEXCAN_FlexCanAccessNonCorrectableErrorIntFlag 

FlexCAN Access With Non-Correctable Error Interrupt Flag.

kFLEXCAN_CorrectableErrorIntFlag 

Correctable Error Interrupt Flag.

kFLEXCAN_HostAccessNonCorrectableErrorOverrunFlag 

Host Access With Non-Correctable Error Interrupt Overrun Flag.

kFLEXCAN_FlexCanAccessNonCorrectableErrorOverrunFlag 

FlexCAN Access With Non-Correctable Error Interrupt Overrun Flag.

kFLEXCAN_CorrectableErrorOverrunFlag 

Correctable Error Interrupt Overrun Flag.

kFLEXCAN_AllMemoryErrorFlag 

All Memory Error Flags.

The FlexCAN Error Status enumerations is used to report current error of the FlexCAN bus. This enumerations should be used with KFLEXCAN_ErrorFlag in _flexcan_flags enumerations to ditermine which error is generated.

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_TxErrorWarningFlag 

Tx Error Warning Status.

kFLEXCAN_RxErrorWarningFlag 

Rx Error Warning Status.

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.

anonymous enum

The FlexCAN Legacy 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.

Enumerator
kFLEXCAN_CorrectableError 

The memory error is correctable which means on bit error.

kFLEXCAN_NonCorrectableError 

The memory error is non-correctable which means two bit errors.

Enumerator
kFLEXCAN_MoveOutFlexCanAccess 

The memory error was detected during move-out FlexCAN access.

kFLEXCAN_MoveInAccess 

The memory error was detected during move-in FlexCAN access.

kFLEXCAN_TxArbitrationAccess 

The memory error was detected during Tx Arbitration FlexCAN access.

kFLEXCAN_RxMatchingAccess 

The memory error was detected during Rx Matching FlexCAN access.

kFLEXCAN_MoveOutHostAccess 

The memory error was detected during Rx Matching Host (CPU) access.

Enumerator
kFLEXCAN_NoError 

No bit error in this byte.

kFLEXCAN_ParityBits0Error 

Parity bit 0 error in this byte.

kFLEXCAN_ParityBits1Error 

Parity bit 1 error in this byte.

kFLEXCAN_ParityBits2Error 

Parity bit 2 error in this byte.

kFLEXCAN_ParityBits3Error 

Parity bit 3 error in this byte.

kFLEXCAN_ParityBits4Error 

Parity bit 4 error in this byte.

kFLEXCAN_DataBits0Error 

Data bit 0 error in this byte.

kFLEXCAN_DataBits1Error 

Data bit 1 error in this byte.

kFLEXCAN_DataBits2Error 

Data bit 2 error in this byte.

kFLEXCAN_DataBits3Error 

Data bit 3 error in this byte.

kFLEXCAN_DataBits4Error 

Data bit 4 error in this byte.

kFLEXCAN_DataBits5Error 

Data bit 5 error in this byte.

kFLEXCAN_DataBits6Error 

Data bit 6 error in this byte.

kFLEXCAN_DataBits7Error 

Data bit 7 error in this byte.

kFLEXCAN_AllZeroError 

All-zeros non-correctable error in this byte.

kFLEXCAN_AllOneError 

All-ones non-correctable error in this byte.

kFLEXCAN_NonCorrectableErrors 

Non-correctable error in this byte.

Function Documentation

bool FLEXCAN_IsInstanceHasFDMode ( CAN_Type *  base)
Note
Use this API only if different soc parts share the SOC part name macro define. Otherwise, a different SOC part name can be used to determine at compile time whether the FlexCAN instance supports CAN FD mode or not. If need use this API to determine if CAN FD mode is supported, the FLEXCAN_Init function needs to be executed first, and then call this API and use the return to value determines whether to supports CAN FD mode, if return true, continue calling FLEXCAN_FDInit to enable CAN FD mode.
Parameters
baseFlexCAN peripheral base address.
Returns
return TRUE if instance support CAN FD mode, FALSE if instance only support classic CAN (2.0) mode.
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.
uint32_t FLEXCAN_GetInstance ( CAN_Type *  base)
Parameters
baseFlexCAN peripheral base address.
Returns
FlexCAN instance.
bool FLEXCAN_CalculateImprovedTimingValues ( CAN_Type *  base,
uint32_t  bitRate,
uint32_t  sourceClock_Hz,
flexcan_timing_config_t pTimingConfig 
)

This function use to calculates the Classical CAN timing values according to the given bit rate. The Calculated timing values will be set in CTRL1/CBT/ENCBT register. The calculation is based on the recommendation of the CiA 301 v4.2.0 and previous version document.

Parameters
baseFlexCAN peripheral base address.
bitRateThe classical CAN speed in bps defined by user, should be less than or equal to 1Mbps.
sourceClock_HzThe Source clock frequency in Hz.
pTimingConfigPointer to the FlexCAN timing configuration structure.
Returns
TRUE if timing configuration found, FALSE if failed to find configuration.
void FLEXCAN_Init ( CAN_Type *  base,
const flexcan_config_t pConfig,
uint32_t  sourceClock_Hz 
)

This function initializes the FlexCAN module with user-defined settings. This example shows how to set up the flexcan_config_t parameters and how to call the FLEXCAN_Init function by passing in these parameters.

* flexcan_config_t flexcanConfig;
* flexcanConfig.clkSrc = kFLEXCAN_ClkSrc0;
* flexcanConfig.bitRate = 1000000U;
* flexcanConfig.maxMbNum = 16;
* flexcanConfig.enableLoopBack = false;
* flexcanConfig.enableSelfWakeup = false;
* flexcanConfig.enableIndividMask = false;
* flexcanConfig.enableDoze = false;
* flexcanConfig.disableSelfReception = false;
* flexcanConfig.enableListenOnlyMode = false;
* flexcanConfig.timingConfig = timingConfig;
* FLEXCAN_Init(CAN0, &flexcanConfig, 40000000UL);
*
Parameters
baseFlexCAN peripheral base address.
pConfigPointer to the user-defined configuration structure.
sourceClock_HzFlexCAN Protocol Engine clock source frequency in Hz.
bool FLEXCAN_FDCalculateImprovedTimingValues ( CAN_Type *  base,
uint32_t  bitRate,
uint32_t  bitRateFD,
uint32_t  sourceClock_Hz,
flexcan_timing_config_t pTimingConfig 
)

This function use to calculates the CANFD timing values according to the given nominal phase bit rate and data phase bit rate. The Calculated timing values will be set in CBT/ENCBT and FDCBT/EDCBT registers. The calculation is based on the recommendation of the CiA 1301 v1.0.0 document.

Parameters
baseFlexCAN peripheral base address.
bitRateThe CANFD bus control speed in bps defined by user.
bitRateFDThe CAN FD data phase speed in bps defined by user. Equal to bitRate means disable bit rate switching.
sourceClock_HzThe Source clock frequency in Hz.
pTimingConfigPointer to the FlexCAN timing configuration structure.
Returns
TRUE if timing configuration found, FALSE if failed to find configuration
void FLEXCAN_FDInit ( CAN_Type *  base,
const flexcan_config_t pConfig,
uint32_t  sourceClock_Hz,
flexcan_mb_size_t  dataSize,
bool  brs 
)

This function initializes the FlexCAN module with user-defined settings. This example shows how to set up the flexcan_config_t parameters and how to call the FLEXCAN_FDInit function by passing in these parameters.

* flexcan_config_t flexcanConfig;
* flexcanConfig.clkSrc = kFLEXCAN_ClkSrc0;
* flexcanConfig.bitRate = 1000000U;
* flexcanConfig.bitRateFD = 2000000U;
* flexcanConfig.maxMbNum = 16;
* flexcanConfig.enableLoopBack = false;
* flexcanConfig.enableSelfWakeup = false;
* flexcanConfig.enableIndividMask = false;
* flexcanConfig.disableSelfReception = false;
* flexcanConfig.enableListenOnlyMode = false;
* flexcanConfig.enableDoze = false;
* flexcanConfig.timingConfig = timingConfig;
* FLEXCAN_FDInit(CAN0, &flexcanConfig, 80000000UL, kFLEXCAN_16BperMB, true);
*
Parameters
baseFlexCAN peripheral base address.
pConfigPointer to the user-defined configuration structure.
sourceClock_HzFlexCAN Protocol Engine clock source frequency in Hz.
dataSizeFlexCAN Message Buffer payload size. The actual transmitted or received CAN FD frame data size needs to be less than or equal to this value.
brsTrue if bit rate switch is enabled in FD mode.
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 pConfig)

This function initializes the FlexCAN configuration structure to default values. The default values are as follows. flexcanConfig->clkSrc = kFLEXCAN_ClkSrc0; flexcanConfig->bitRate = 1000000U; flexcanConfig->bitRateFD = 2000000U; flexcanConfig->maxMbNum = 16; flexcanConfig->enableLoopBack = false; flexcanConfig->enableSelfWakeup = false; flexcanConfig->enableIndividMask = false; flexcanConfig->disableSelfReception = false; flexcanConfig->enableListenOnlyMode = false; flexcanConfig->enableDoze = false; flexcanConfig->enableMemoryErrorControl = true; flexcanConfig->enableNonCorrectableErrorEnterFreeze = true; flexcanConfig.timingConfig = timingConfig;

Parameters
pConfigPointer to the FlexCAN configuration structure.
void FLEXCAN_SetTimingConfig ( CAN_Type *  base,
const flexcan_timing_config_t pConfig 
)

This function gives user settings to classical CAN or CAN FD nominal phase timing characteristic. The function is for an experienced user. For less experienced users, call the FLEXCAN_SetBitRate() instead.

Note
Calling FLEXCAN_SetTimingConfig() overrides the bit rate set in FLEXCAN_Init() or FLEXCAN_SetBitRate().
Parameters
baseFlexCAN peripheral base address.
pConfigPointer to the timing configuration structure.
status_t FLEXCAN_SetBitRate ( CAN_Type *  base,
uint32_t  sourceClock_Hz,
uint32_t  bitRate_Bps 
)

This function set the bit rate of classical CAN frame or CAN FD frame nominal phase base on FLEXCAN_CalculateImprovedTimingValues() API calculated timing values.

Note
Calling FLEXCAN_SetBitRate() overrides the bit rate set in FLEXCAN_Init().
Parameters
baseFlexCAN peripheral base address.
sourceClock_HzSource Clock in Hz.
bitRate_BpsBit rate in Bps.
Returns
kStatus_Success - Set CAN baud rate (only Nominal phase) successfully.
void FLEXCAN_SetFDTimingConfig ( CAN_Type *  base,
const flexcan_timing_config_t pConfig 
)

This function gives user settings to CANFD data phase timing characteristic. The function is for an experienced user. For less experienced users, call the FLEXCAN_SetFDBitRate() to set both Nominal/Data bit Rate instead.

Note
Calling FLEXCAN_SetFDTimingConfig() overrides the data phase bit rate set in FLEXCAN_FDInit()/FLEXCAN_SetFDBitRate().
Parameters
baseFlexCAN peripheral base address.
pConfigPointer to the timing configuration structure.
status_t FLEXCAN_SetFDBitRate ( CAN_Type *  base,
uint32_t  sourceClock_Hz,
uint32_t  bitRateN_Bps,
uint32_t  bitRateD_Bps 
)

This function set the baud rate of FLEXCAN FD base on FLEXCAN_FDCalculateImprovedTimingValues() API calculated timing values.

Parameters
baseFlexCAN peripheral base address.
sourceClock_HzSource Clock in Hz.
bitRateN_BpsNominal bit Rate in Bps.
bitRateD_BpsData bit Rate in Bps.
Returns
kStatus_Success - Set CAN FD bit rate (include Nominal and Data phase) successfully.
void FLEXCAN_SetRxMbGlobalMask ( CAN_Type *  base,
uint32_t  mask 
)

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.
maskRx Message Buffer Global Mask value.
void FLEXCAN_SetRxFifoGlobalMask ( CAN_Type *  base,
uint32_t  mask 
)

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

Parameters
baseFlexCAN peripheral base address.
maskRx Fifo Global Mask value.
void FLEXCAN_SetRxIndividualMask ( CAN_Type *  base,
uint8_t  maskIdx,
uint32_t  mask 
)

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.
maskIdxThe Index of individual Mask.
maskRx Individual Mask value.
void FLEXCAN_SetTxMbConfig ( CAN_Type *  base,
uint8_t  mbIdx,
bool  enable 
)

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

Parameters
baseFlexCAN peripheral base address.
mbIdxThe Message Buffer index.
enableEnable/disable Tx Message Buffer.
  • true: Enable Tx Message Buffer.
  • false: Disable Tx Message Buffer.
void FLEXCAN_SetFDTxMbConfig ( CAN_Type *  base,
uint8_t  mbIdx,
bool  enable 
)

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

Parameters
baseFlexCAN peripheral base address.
mbIdxThe Message Buffer index.
enableEnable/disable Tx Message Buffer.
  • true: Enable Tx Message Buffer.
  • false: Disable Tx Message Buffer.
void FLEXCAN_SetRxMbConfig ( CAN_Type *  base,
uint8_t  mbIdx,
const flexcan_rx_mb_config_t pRxMbConfig,
bool  enable 
)

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

Parameters
baseFlexCAN peripheral base address.
mbIdxThe Message Buffer index.
pRxMbConfigPointer to the FlexCAN Message Buffer configuration structure.
enableEnable/disable Rx Message Buffer.
  • true: Enable Rx Message Buffer.
  • false: Disable Rx Message Buffer.
void FLEXCAN_SetFDRxMbConfig ( CAN_Type *  base,
uint8_t  mbIdx,
const flexcan_rx_mb_config_t pRxMbConfig,
bool  enable 
)

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

Parameters
baseFlexCAN peripheral base address.
mbIdxThe Message Buffer index.
pRxMbConfigPointer to the FlexCAN Message Buffer configuration structure.
enableEnable/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 pRxFifoConfig,
bool  enable 
)

This function configures the FlexCAN Rx FIFO with given configuration.

Note
Legacy Rx FIFO only can receive classic CAN message.
Parameters
baseFlexCAN peripheral base address.
pRxFifoConfigPointer to the FlexCAN Legacy Rx FIFO configuration structure. Can be NULL when enable parameter is false.
enableEnable/disable Legacy Rx FIFO.
  • true: Enable Legacy Rx FIFO.
  • false: Disable Legacy Rx FIFO.
static uint64_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_flags. To check the specific status, compare the return value with enumerators in _flexcan_flags.

Parameters
baseFlexCAN peripheral base address.
Returns
FlexCAN status flags which are ORed by the enumerators in the _flexcan_flags.
static void FLEXCAN_ClearStatusFlags ( CAN_Type *  base,
uint64_t  mask 
)
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.
maskThe status flags to be cleared, it is logical OR value of _flexcan_flags.
static void FLEXCAN_GetBusErrCount ( CAN_Type *  base,
uint8_t *  txErrBuf,
uint8_t *  rxErrBuf 
)
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.
txErrBufBuffer to store Tx Error Counter value.
rxErrBufBuffer to store Rx Error Counter value.
static uint64_t FLEXCAN_GetMbStatusFlags ( CAN_Type *  base,
uint64_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,
uint64_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.
void FLEXCAN_GetMemoryErrorReportStatus ( CAN_Type *  base,
flexcan_memory_error_report_status_t errorStatus 
)

This function gets the FlexCAN Memory Error Report registers status.

Parameters
baseFlexCAN peripheral base address.
errorStatusPointer to FlexCAN Memory Error Report registers status structure.
static void FLEXCAN_EnableInterrupts ( CAN_Type *  base,
uint64_t  mask 
)
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.
maskThe interrupts to enable. Logical OR of _flexcan_interrupt_enable.
static void FLEXCAN_DisableInterrupts ( CAN_Type *  base,
uint64_t  mask 
)
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.
maskThe interrupts to disable. Logical OR of _flexcan_interrupt_enable.
static void FLEXCAN_EnableMbInterrupts ( CAN_Type *  base,
uint64_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,
uint64_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  enable 
)

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

Parameters
baseFlexCAN peripheral base address.
enabletrue to enable, false to disable.
static uintptr_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  enable 
)
inlinestatic

This function enables or disables the FlexCAN module.

Parameters
baseFlexCAN base pointer.
enabletrue to enable, false to disable.
status_t FLEXCAN_WriteTxMb ( CAN_Type *  base,
uint8_t  mbIdx,
const flexcan_frame_t pTxFrame 
)

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.
mbIdxThe FlexCAN Message Buffer index.
pTxFramePointer 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  mbIdx,
flexcan_frame_t pRxFrame 
)

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.
mbIdxThe FlexCAN Message Buffer index.
pRxFramePointer 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_WriteFDTxMb ( CAN_Type *  base,
uint8_t  mbIdx,
const flexcan_fd_frame_t pTxFrame 
)

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.
mbIdxThe FlexCAN FD Message Buffer index.
pTxFramePointer 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  mbIdx,
flexcan_fd_frame_t pRxFrame 
)

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.
mbIdxThe FlexCAN FD Message Buffer index.
pRxFramePointer 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_ReadRxFifo ( CAN_Type *  base,
flexcan_frame_t pRxFrame 
)

This function reads a CAN message from the FlexCAN Legacy Rx FIFO.

Parameters
baseFlexCAN peripheral base address.
pRxFramePointer 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  mbIdx,
flexcan_fd_frame_t pTxFrame 
)
Note
A transfer handle does not need to be created before calling this API.
Parameters
baseFlexCAN peripheral base pointer.
mbIdxThe FlexCAN FD Message Buffer index.
pTxFramePointer 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  mbIdx,
flexcan_fd_frame_t pRxFrame 
)
Note
A transfer handle does not need to be created before calling this API.
Parameters
baseFlexCAN peripheral base pointer.
mbIdxThe FlexCAN FD Message Buffer index.
pRxFramePointer 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_TransferFDSendNonBlocking ( CAN_Type *  base,
flexcan_handle_t handle,
flexcan_mb_transfer_t pMbXfer 
)

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
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
pMbXferFlexCAN 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 ( CAN_Type *  base,
flexcan_handle_t handle,
flexcan_mb_transfer_t pMbXfer 
)

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
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
pMbXferFlexCAN 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 ( CAN_Type *  base,
flexcan_handle_t handle,
uint8_t  mbIdx 
)

This function aborts the interrupt driven message send process.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
mbIdxThe FlexCAN FD Message Buffer index.
void FLEXCAN_TransferFDAbortReceive ( CAN_Type *  base,
flexcan_handle_t handle,
uint8_t  mbIdx 
)

This function aborts the interrupt driven message receive process.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
mbIdxThe FlexCAN FD Message Buffer index.
status_t FLEXCAN_TransferSendBlocking ( CAN_Type *  base,
uint8_t  mbIdx,
flexcan_frame_t pTxFrame 
)
Note
A transfer handle does not need to be created before calling this API.
Parameters
baseFlexCAN peripheral base pointer.
mbIdxThe FlexCAN Message Buffer index.
pTxFramePointer 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  mbIdx,
flexcan_frame_t pRxFrame 
)
Note
A transfer handle does not need to be created before calling this API.
Parameters
baseFlexCAN peripheral base pointer.
mbIdxThe FlexCAN Message Buffer index.
pRxFramePointer 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 pRxFrame 
)
Note
A transfer handle does not need to be created before calling this API.
Parameters
baseFlexCAN peripheral base pointer.
pRxFramePointer to CAN message frame structure for reception.
Return values
kStatus_Success- Read Message from Rx FIFO successfully.
kStatus_Fail- Rx FIFO is not enabled.
void FLEXCAN_TransferCreateHandle ( CAN_Type *  base,
flexcan_handle_t handle,
flexcan_transfer_callback_t  callback,
void *  userData 
)

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.
handleFlexCAN handle pointer.
callbackThe callback function.
userDataThe parameter of the callback function.
status_t FLEXCAN_TransferSendNonBlocking ( CAN_Type *  base,
flexcan_handle_t handle,
flexcan_mb_transfer_t pMbXfer 
)

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
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
pMbXferFlexCAN 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 ( CAN_Type *  base,
flexcan_handle_t handle,
flexcan_mb_transfer_t pMbXfer 
)

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
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
pMbXferFlexCAN 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 ( CAN_Type *  base,
flexcan_handle_t handle,
flexcan_fifo_transfer_t pFifoXfer 
)

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
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
pFifoXferFlexCAN 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.
status_t FLEXCAN_TransferGetReceiveFifoCount ( CAN_Type *  base,
flexcan_handle_t handle,
size_t *  count 
)
Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
countNumber of CAN messages receive so far by the non-blocking transaction.
Return values
kStatus_InvalidArgumentcount is Invalid.
kStatus_SuccessSuccessfully return the count.
uint32_t FLEXCAN_GetTimeStamp ( flexcan_handle_t handle,
uint8_t  mbIdx 
)

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
handleFlexCAN handle pointer.
mbIdxThe FlexCAN Message Buffer index.
Return values
theindex of mailbox 's timestamp stored in the handle.
void FLEXCAN_TransferAbortSend ( CAN_Type *  base,
flexcan_handle_t handle,
uint8_t  mbIdx 
)

This function aborts the interrupt driven message send process.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
mbIdxThe FlexCAN Message Buffer index.
void FLEXCAN_TransferAbortReceive ( CAN_Type *  base,
flexcan_handle_t handle,
uint8_t  mbIdx 
)

This function aborts the interrupt driven message receive process.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
mbIdxThe FlexCAN Message Buffer index.
void FLEXCAN_TransferAbortReceiveFifo ( CAN_Type *  base,
flexcan_handle_t handle 
)

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

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
void FLEXCAN_TransferHandleIRQ ( CAN_Type *  base,
flexcan_handle_t handle 
)

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

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.