NetBurner 3.5.6
PDF Version
FlexCAN SOMRT1061

Classes

struct  _flexcan_frame
 FlexCAN 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 FLEXCAN_ID_STD(id)    (((uint32_t)(((uint32_t)(id)) << CAN_ID_STD_SHIFT)) & CAN_ID_STD_MASK)
 FlexCAN frame length helper macro.
 
#define FLEXCAN_ID_EXT(id)
 
#define FLEXCAN_RX_MB_STD_MASK(id, rtr, ide)
 FlexCAN Rx Message Buffer Mask helper macro.
 
#define FLEXCAN_RX_MB_EXT_MASK(id, rtr, ide)
 
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(id, rtr, ide)
 FlexCAN Legacy Rx FIFO Mask helper macro.
 
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH(id, rtr, ide)
 
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW(id, rtr, ide)
 
#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)
 
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH(id, rtr, ide)
 
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW(id, rtr, ide)
 
#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)
 
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW(id)
 
#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)
 FlexCAN Rx FIFO Filter helper macro.
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_HIGH(id, rtr, ide)
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_LOW(id, rtr, ide)
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_HIGH(id)
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_HIGH(id)
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_LOW(id)
 
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_LOW(id)
 
#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)
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_LOW(id, rtr, ide)
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_HIGH(id)
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_HIGH(id)
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_LOW(id)
 
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_LOW(id)    FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW(id)
 
#define FLEXCAN_ERROR_AND_STATUS_INIT_FLAG
 FlexCAN interrupt/status flag helper macro.
 
#define FLEXCAN_MEMORY_ENHANCED_RX_FIFO_INIT_FLAG   (0U)
 FlexCAN Enhanced Rx FIFO base address helper macro.
 
#define FLEXCAN_CALLBACK(x)    void(x)(CAN_Type * base, flexcan_handle_t * handle, status_t status, uint32_t result, void *userData)
 FlexCAN transfer callback function.
 

Typedefs

typedef enum _flexcan_frame_format flexcan_frame_format_t
 FlexCAN frame format.
 
typedef enum _flexcan_frame_type flexcan_frame_type_t
 FlexCAN frame type.
 
typedef enum _flexcan_clock_source flexcan_clock_source_t
 FlexCAN clock source.
 
typedef enum _flexcan_wake_up_source flexcan_wake_up_source_t
 FlexCAN wake up source.
 
typedef enum _flexcan_rx_fifo_filter_type flexcan_rx_fifo_filter_type_t
 FlexCAN Rx Fifo Filter type.
 
typedef enum _flexcan_rx_fifo_priority flexcan_rx_fifo_priority_t
 FlexCAN Enhanced/Legacy Rx FIFO priority.
 
typedef struct _flexcan_frame flexcan_frame_t
 FlexCAN message frame structure.
 
typedef struct _flexcan_timing_config flexcan_timing_config_t
 FlexCAN protocol timing characteristic configuration structure.
 
typedef struct _flexcan_config flexcan_config_t
 FlexCAN module configuration structure.
 
typedef struct _flexcan_rx_mb_config flexcan_rx_mb_config_t
 FlexCAN Receive Message Buffer configuration structure.
 
typedef struct _flexcan_rx_fifo_config flexcan_rx_fifo_config_t
 FlexCAN Legacy Rx FIFO configuration structure.
 
typedef struct _flexcan_mb_transfer flexcan_mb_transfer_t
 FlexCAN Message Buffer transfer.
 
typedef struct _flexcan_fifo_transfer flexcan_fifo_transfer_t
 FlexCAN Rx FIFO transfer.
 
typedef struct _flexcan_handle flexcan_handle_t
 FlexCAN handle structure definition.
 

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_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
}
 FlexCAN interrupt enable enumerations. More...
 
enum  _flexcan_flags {
  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_ErrorFlag
}
 FlexCAN status flags. More...
 
enum  _flexcan_error_flags {
  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...
 

Initialization and deinitialization

void FLEXCAN_EnterFreezeMode (CAN_Type *base)
 Enter FlexCAN Freeze Mode.
 
void FLEXCAN_ExitFreezeMode (CAN_Type *base)
 Exit FlexCAN Freeze Mode.
 
uint32_t FLEXCAN_GetInstance (CAN_Type *base)
 Get the FlexCAN instance from peripheral base address.
 
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.
 
void FLEXCAN_Init (CAN_Type *base, const flexcan_config_t *pConfig, uint32_t sourceClock_Hz)
 Initializes a FlexCAN instance.
 
void FLEXCAN_Deinit (CAN_Type *base)
 De-initializes a FlexCAN instance.
 
void FLEXCAN_GetDefaultConfig (flexcan_config_t *pConfig)
 Gets the default configuration structure.
 

Configuration.

void FLEXCAN_SetTimingConfig (CAN_Type *base, const flexcan_timing_config_t *pConfig)
 Sets the FlexCAN classical CAN protocol timing characteristic.
 
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.
 
void FLEXCAN_SetRxMbGlobalMask (CAN_Type *base, uint32_t mask)
 Sets the FlexCAN receive message buffer global mask.
 
void FLEXCAN_SetRxFifoGlobalMask (CAN_Type *base, uint32_t mask)
 Sets the FlexCAN receive FIFO global mask.
 
void FLEXCAN_SetRxIndividualMask (CAN_Type *base, uint8_t maskIdx, uint32_t mask)
 Sets the FlexCAN receive individual mask.
 
void FLEXCAN_SetTxMbConfig (CAN_Type *base, uint8_t mbIdx, bool enable)
 Configures a FlexCAN transmit message buffer.
 
void FLEXCAN_SetRxMbConfig (CAN_Type *base, uint8_t mbIdx, const flexcan_rx_mb_config_t *pRxMbConfig, bool enable)
 Configures a FlexCAN Receive Message Buffer.
 
void FLEXCAN_SetRxFifoConfig (CAN_Type *base, const flexcan_rx_fifo_config_t *pRxFifoConfig, bool enable)
 Configures the FlexCAN Legacy Rx FIFO.
 

Bus Operations

status_t FLEXCAN_WriteTxMb (CAN_Type *base, uint8_t mbIdx, const flexcan_frame_t *pTxFrame)
 Writes a FlexCAN Message to the Transmit Message Buffer.
 
status_t FLEXCAN_ReadRxMb (CAN_Type *base, uint8_t mbIdx, flexcan_frame_t *pRxFrame)
 Reads a FlexCAN Message from Receive Message Buffer.
 
status_t FLEXCAN_ReadRxFifo (CAN_Type *base, flexcan_frame_t *pRxFrame)
 Reads a FlexCAN Message from Legacy Rx FIFO.
 

Transactional

status_t FLEXCAN_TransferSendBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_frame_t *pTxFrame)
 Performs a polling send transaction on the CAN bus.
 
status_t FLEXCAN_TransferReceiveBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_frame_t *pRxFrame)
 Performs a polling receive transaction on the CAN bus.
 
status_t FLEXCAN_TransferReceiveFifoBlocking (CAN_Type *base, flexcan_frame_t *pRxFrame)
 Performs a polling receive transaction from Legacy Rx FIFO on the CAN bus.
 
void FLEXCAN_TransferCreateHandle (CAN_Type *base, flexcan_handle_t *handle, flexcan_transfer_callback_t callback, void *userData)
 Initializes the FlexCAN handle.
 
status_t FLEXCAN_TransferSendNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer)
 Sends a message using IRQ.
 
status_t FLEXCAN_TransferReceiveNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer)
 Receives a message using IRQ.
 
status_t FLEXCAN_TransferReceiveFifoNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_fifo_transfer_t *pFifoXfer)
 Receives a message from Rx FIFO using IRQ.
 
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.
 
uint32_t FLEXCAN_GetTimeStamp (flexcan_handle_t *handle, uint8_t mbIdx)
 Gets the detail index of Mailbox's Timestamp by handle.
 
void FLEXCAN_TransferAbortSend (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx)
 Aborts the interrupt driven message send process.
 
void FLEXCAN_TransferAbortReceive (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx)
 Aborts the interrupt driven message receive process.
 
void FLEXCAN_TransferAbortReceiveFifo (CAN_Type *base, flexcan_handle_t *handle)
 Aborts the interrupt driven message receive from Rx FIFO process.
 
void FLEXCAN_TransferHandleIRQ (CAN_Type *base, flexcan_handle_t *handle)
 FlexCAN IRQ handle function.
 

Driver version

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

Detailed Description

Macro Definition Documentation

◆ FLEXCAN_CALLBACK

#define FLEXCAN_CALLBACK ( x)     void(x)(CAN_Type * base, flexcan_handle_t * handle, status_t status, uint32_t result, void *userData)

#include <fsl_flexcan.h>

FlexCAN transfer callback function.

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.

◆ FLEXCAN_ID_EXT

#define FLEXCAN_ID_EXT ( id)

#include <fsl_flexcan.h>

Value:
(((uint32_t)(((uint32_t)(id)) << CAN_ID_EXT_SHIFT)) & \
(CAN_ID_EXT_MASK | CAN_ID_STD_MASK))

Extend Frame ID helper macro.

◆ FLEXCAN_ID_STD

#define FLEXCAN_ID_STD ( id)     (((uint32_t)(((uint32_t)(id)) << CAN_ID_STD_SHIFT)) & CAN_ID_STD_MASK)

#include <fsl_flexcan.h>

FlexCAN frame length helper macro.

FlexCAN Frame ID helper macro. Standard Frame ID helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_A

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_A ( id,
rtr,
ide )    FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A(id, rtr, ide)

#include <fsl_flexcan.h>

Extend Rx FIFO Filter helper macro Type A helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_HIGH

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_HIGH ( id,
rtr,
ide )

#include <fsl_flexcan.h>

Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH(id, rtr, ide)
Definition FlexcanLoopback/src/fsl_flexcan.h:76

Extend Rx FIFO Filter helper macro Type B upper part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_LOW

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_LOW ( id,
rtr,
ide )

#include <fsl_flexcan.h>

Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW(id, rtr, ide)
Definition FlexcanLoopback/src/fsl_flexcan.h:81

Extend Rx FIFO Filter helper macro Type B lower part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_HIGH

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_HIGH ( id)

#include <fsl_flexcan.h>

Value:
id)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_HIGH(id)
Definition FlexcanLoopback/src/fsl_flexcan.h:85

Extend Rx FIFO Filter helper macro Type C upper part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_LOW

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_LOW ( id)     FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW(id)

#include <fsl_flexcan.h>

Extend Rx FIFO Filter helper macro Type C lower part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_HIGH

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_HIGH ( id)

#include <fsl_flexcan.h>

Value:
id)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_HIGH(id)
Definition FlexcanLoopback/src/fsl_flexcan.h:87

Extend Rx FIFO Filter helper macro Type C mid-upper part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_LOW

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_LOW ( id)

#include <fsl_flexcan.h>

Value:
id)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW(id)
Definition FlexcanLoopback/src/fsl_flexcan.h:90

Extend Rx FIFO Filter helper macro Type C mid-lower part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A ( id,
rtr,
ide )

#include <fsl_flexcan.h>

Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
(FLEXCAN_ID_EXT(id) << 1))
#define FLEXCAN_ID_EXT(id)
Definition FlexcanLoopback/src/fsl_flexcan.h:43

Extend Rx FIFO Mask helper macro Type A helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH ( id,
rtr,
ide )

#include <fsl_flexcan.h>

Value:
( \
((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
((FLEXCAN_ID_EXT(id) & 0x1FFF8000) \
<< 1))

Extend Rx FIFO Mask helper macro Type B upper part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW ( id,
rtr,
ide )

#include <fsl_flexcan.h>

Value:
(((uint32_t)((uint32_t)(rtr) << 15) | (uint32_t)((uint32_t)(ide) << 14)) | \
((FLEXCAN_ID_EXT(id) & 0x1FFF8000) >> \
15))

Extend Rx FIFO Mask helper macro Type B lower part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_HIGH

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_HIGH ( id)     ((FLEXCAN_ID_EXT(id) & 0x1FE00000) << 3)

#include <fsl_flexcan.h>

Extend Rx FIFO Mask helper macro Type C upper part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW ( id)     ((FLEXCAN_ID_EXT(id) & 0x1FE00000) >> 21)

#include <fsl_flexcan.h>

Extend Rx FIFO Mask helper macro Type C lower part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_HIGH

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_HIGH ( id)

#include <fsl_flexcan.h>

Value:
((FLEXCAN_ID_EXT(id) & 0x1FE00000) >> \
5)

Extend Rx FIFO Mask helper macro Type C mid-upper part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW ( id)

#include <fsl_flexcan.h>

Value:
((FLEXCAN_ID_EXT(id) & 0x1FE00000) >> \
13)

Extend Rx FIFO Mask helper macro Type C mid-lower part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_A

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_A ( id,
rtr,
ide )    FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(id, rtr, ide)

#include <fsl_flexcan.h>

FlexCAN Rx FIFO Filter helper macro.

Standard Rx FIFO Filter helper macro Type A helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_HIGH

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_HIGH ( id,
rtr,
ide )

#include <fsl_flexcan.h>

Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH(id, rtr, ide)
Definition FlexcanLoopback/src/fsl_flexcan.h:59

Standard Rx FIFO Filter helper macro Type B upper part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_LOW

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_LOW ( id,
rtr,
ide )

#include <fsl_flexcan.h>

Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW(id, rtr, ide)
Definition FlexcanLoopback/src/fsl_flexcan.h:62

Standard Rx FIFO Filter helper macro Type B lower part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_HIGH

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_HIGH ( id)

#include <fsl_flexcan.h>

Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_HIGH(id)
Definition FlexcanLoopback/src/fsl_flexcan.h:65

Standard Rx FIFO Filter helper macro Type C upper part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_LOW

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_LOW ( id)

#include <fsl_flexcan.h>

Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_LOW(id)
Definition FlexcanLoopback/src/fsl_flexcan.h:71

Standard Rx FIFO Filter helper macro Type C lower part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_HIGH

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_HIGH ( id)

#include <fsl_flexcan.h>

Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_HIGH(id)
Definition FlexcanLoopback/src/fsl_flexcan.h:67

Standard Rx FIFO Filter helper macro Type C mid-upper part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_LOW

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_LOW ( id)

#include <fsl_flexcan.h>

Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_LOW(id)
Definition FlexcanLoopback/src/fsl_flexcan.h:69

Standard Rx FIFO Filter helper macro Type C mid-lower part helper macro.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_A

#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_A ( id,
rtr,
ide )

#include <fsl_flexcan.h>

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 length helper macro.
Definition FlexcanLoopback/src/fsl_flexcan.h:41

FlexCAN Legacy Rx FIFO Mask helper macro.

Standard Rx FIFO Mask helper macro Type A helper macro.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH

#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH ( id,
rtr,
ide )

#include <fsl_flexcan.h>

Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
(((uint32_t)(id)&0x7FF) << 19))

Standard Rx FIFO Mask helper macro Type B upper part helper macro.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW

#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW ( id,
rtr,
ide )

#include <fsl_flexcan.h>

Value:
(((uint32_t)((uint32_t)(rtr) << 15) | (uint32_t)((uint32_t)(ide) << 14)) | \
(((uint32_t)(id)&0x7FF) << 3))

Standard Rx FIFO Mask helper macro Type B lower part helper macro.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_HIGH

#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_HIGH ( id)     (((uint32_t)(id)&0x7F8) << 21)

#include <fsl_flexcan.h>

Standard Rx FIFO Mask helper macro Type C upper part helper macro.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_LOW

#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_LOW ( id)     (((uint32_t)(id)&0x7F8) >> 3)

#include <fsl_flexcan.h>

Standard Rx FIFO Mask helper macro Type C lower part helper macro.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_HIGH

#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_HIGH ( id)     (((uint32_t)(id)&0x7F8) << 13)

#include <fsl_flexcan.h>

Standard Rx FIFO Mask helper macro Type C mid-upper part helper macro.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_LOW

#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_LOW ( id)     (((uint32_t)(id)&0x7F8) << 5)

#include <fsl_flexcan.h>

Standard Rx FIFO Mask helper macro Type C mid-lower part helper macro.

◆ FLEXCAN_RX_MB_EXT_MASK

#define FLEXCAN_RX_MB_EXT_MASK ( id,
rtr,
ide )

#include <fsl_flexcan.h>

Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \

Extend Rx Message Buffer Mask helper macro.

◆ FLEXCAN_RX_MB_STD_MASK

#define FLEXCAN_RX_MB_STD_MASK ( id,
rtr,
ide )

#include <fsl_flexcan.h>

Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \

FlexCAN Rx Message Buffer Mask helper macro.

Standard Rx Message Buffer Mask helper macro.

Typedef Documentation

◆ flexcan_clock_source_t

#include <fsl_flexcan.h>

FlexCAN clock source.

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

◆ flexcan_config_t

#include <fsl_flexcan.h>

FlexCAN module configuration structure.

Deprecated

Do not use the baudRate. It has been superceded bitRate

Do not use the baudRateFD. It has been superceded bitRateFD

◆ flexcan_rx_fifo_priority_t

#include <fsl_flexcan.h>

FlexCAN Enhanced/Legacy Rx FIFO priority.

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.

◆ flexcan_rx_mb_config_t

#include <fsl_flexcan.h>

FlexCAN Receive Message Buffer configuration structure.

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

anonymous enum

#include <fsl_flexcan.h>

FlexCAN transfer status.

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.

◆ anonymous enum

anonymous enum

#include <fsl_flexcan.h>

FlexCAN Legacy Rx FIFO status flags.

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.

◆ _flexcan_clock_source

#include <fsl_flexcan.h>

FlexCAN clock source.

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.

◆ _flexcan_error_flags

#include <fsl_flexcan.h>

FlexCAN error status 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_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.

◆ _flexcan_flags

#include <fsl_flexcan.h>

FlexCAN status flags.

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_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.

◆ _flexcan_frame_format

#include <fsl_flexcan.h>

FlexCAN frame format.

Enumerator
kFLEXCAN_FrameFormatStandard 

Standard frame format attribute.

kFLEXCAN_FrameFormatExtend 

Extend frame format attribute.

◆ _flexcan_frame_type

#include <fsl_flexcan.h>

FlexCAN frame type.

Enumerator
kFLEXCAN_FrameTypeData 

Data frame type attribute.

kFLEXCAN_FrameTypeRemote 

Remote frame type attribute.

◆ _flexcan_interrupt_enable

#include <fsl_flexcan.h>

FlexCAN interrupt enable enumerations.

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.

◆ _flexcan_rx_fifo_filter_type

#include <fsl_flexcan.h>

FlexCAN Rx Fifo Filter type.

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.

◆ _flexcan_rx_fifo_priority

#include <fsl_flexcan.h>

FlexCAN Enhanced/Legacy Rx FIFO priority.

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.

◆ _flexcan_wake_up_source

#include <fsl_flexcan.h>

FlexCAN wake up source.

Enumerator
kFLEXCAN_WakeupSrcUnfiltered 

FlexCAN uses unfiltered Rx input to detect edge.

kFLEXCAN_WakeupSrcFiltered 

FlexCAN uses filtered Rx input to detect edge.

Function Documentation

◆ FLEXCAN_CalculateImprovedTimingValues()

bool FLEXCAN_CalculateImprovedTimingValues ( CAN_Type * base,
uint32_t bitRate,
uint32_t sourceClock_Hz,
flexcan_timing_config_t * pTimingConfig )

#include <fsl_flexcan.h>

Calculates the improved timing values by specific bit Rates for classical CAN.

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.

◆ FLEXCAN_Deinit()

void FLEXCAN_Deinit ( CAN_Type * base)

#include <fsl_flexcan.h>

De-initializes a FlexCAN instance.

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

Parameters
baseFlexCAN peripheral base address.

◆ FLEXCAN_EnterFreezeMode()

void FLEXCAN_EnterFreezeMode ( CAN_Type * base)

#include <fsl_flexcan.h>

Enter FlexCAN Freeze Mode.

This function makes the FlexCAN work under Freeze Mode.

Parameters
baseFlexCAN peripheral base address.

◆ FLEXCAN_ExitFreezeMode()

void FLEXCAN_ExitFreezeMode ( CAN_Type * base)

#include <fsl_flexcan.h>

Exit FlexCAN Freeze Mode.

This function makes the FlexCAN leave Freeze Mode.

Parameters
baseFlexCAN peripheral base address.

◆ FLEXCAN_GetDefaultConfig()

void FLEXCAN_GetDefaultConfig ( flexcan_config_t * pConfig)

#include <fsl_flexcan.h>

Gets the default configuration structure.

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.

◆ FLEXCAN_GetInstance()

uint32_t FLEXCAN_GetInstance ( CAN_Type * base)

#include <fsl_flexcan.h>

Get the FlexCAN instance from peripheral base address.

Parameters
baseFlexCAN peripheral base address.
Returns
FlexCAN instance.

◆ FLEXCAN_GetTimeStamp()

uint32_t FLEXCAN_GetTimeStamp ( flexcan_handle_t * handle,
uint8_t mbIdx )

#include <fsl_flexcan.h>

Gets the detail index of Mailbox's Timestamp by handle.

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.

◆ FLEXCAN_Init()

void FLEXCAN_Init ( CAN_Type * base,
const flexcan_config_t * pConfig,
uint32_t sourceClock_Hz )

#include <fsl_flexcan.h>

Initializes a FlexCAN instance.

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);
void FLEXCAN_Init(CAN_Type *base, const flexcan_config_t *pConfig, uint32_t sourceClock_Hz)
Initializes a FlexCAN instance.
@ kFLEXCAN_ClkSrc0
Definition FlexcanLoopback/src/fsl_flexcan.h:288
FlexCAN module configuration structure.
Definition FlexcanLoopback/src/fsl_flexcan.h:731
uint8_t maxMbNum
Definition FlexcanLoopback/src/fsl_flexcan.h:751
uint32_t bitRate
Definition FlexcanLoopback/src/fsl_flexcan.h:743
bool enableListenOnlyMode
Definition FlexcanLoopback/src/fsl_flexcan.h:757
bool enableSelfWakeup
Definition FlexcanLoopback/src/fsl_flexcan.h:754
bool disableSelfReception
Definition FlexcanLoopback/src/fsl_flexcan.h:756
flexcan_clock_source_t clkSrc
Definition FlexcanLoopback/src/fsl_flexcan.h:749
bool enableLoopBack
Definition FlexcanLoopback/src/fsl_flexcan.h:752
bool enableIndividMask
Definition FlexcanLoopback/src/fsl_flexcan.h:755
Parameters
baseFlexCAN peripheral base address.
pConfigPointer to the user-defined configuration structure.
sourceClock_HzFlexCAN Protocol Engine clock source frequency in Hz.

◆ FLEXCAN_ReadRxFifo()

status_t FLEXCAN_ReadRxFifo ( CAN_Type * base,
flexcan_frame_t * pRxFrame )

#include <fsl_flexcan.h>

Reads a FlexCAN Message from Legacy Rx FIFO.

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.

◆ FLEXCAN_ReadRxMb()

status_t FLEXCAN_ReadRxMb ( CAN_Type * base,
uint8_t mbIdx,
flexcan_frame_t * pRxFrame )

#include <fsl_flexcan.h>

Reads a FlexCAN Message from Receive Message Buffer.

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.

◆ FLEXCAN_SetBitRate()

status_t FLEXCAN_SetBitRate ( CAN_Type * base,
uint32_t sourceClock_Hz,
uint32_t bitRate_Bps )

#include <fsl_flexcan.h>

Set bit rate of FlexCAN classical CAN frame or CAN FD frame nominal phase.

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.

◆ FLEXCAN_SetRxFifoConfig()

void FLEXCAN_SetRxFifoConfig ( CAN_Type * base,
const flexcan_rx_fifo_config_t * pRxFifoConfig,
bool enable )

#include <fsl_flexcan.h>

Configures the FlexCAN Legacy Rx FIFO.

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.

◆ FLEXCAN_SetRxFifoGlobalMask()

void FLEXCAN_SetRxFifoGlobalMask ( CAN_Type * base,
uint32_t mask )

#include <fsl_flexcan.h>

Sets the FlexCAN receive FIFO global mask.

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

Parameters
baseFlexCAN peripheral base address.
maskRx Fifo Global Mask value.

◆ FLEXCAN_SetRxIndividualMask()

void FLEXCAN_SetRxIndividualMask ( CAN_Type * base,
uint8_t maskIdx,
uint32_t mask )

#include <fsl_flexcan.h>

Sets the FlexCAN receive individual 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.

◆ FLEXCAN_SetRxMbConfig()

void FLEXCAN_SetRxMbConfig ( CAN_Type * base,
uint8_t mbIdx,
const flexcan_rx_mb_config_t * pRxMbConfig,
bool enable )

#include <fsl_flexcan.h>

Configures a FlexCAN Receive Message Buffer.

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.

◆ FLEXCAN_SetRxMbGlobalMask()

void FLEXCAN_SetRxMbGlobalMask ( CAN_Type * base,
uint32_t mask )

#include <fsl_flexcan.h>

Sets the FlexCAN receive message buffer global 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.

◆ FLEXCAN_SetTimingConfig()

void FLEXCAN_SetTimingConfig ( CAN_Type * base,
const flexcan_timing_config_t * pConfig )

#include <fsl_flexcan.h>

Sets the FlexCAN classical CAN protocol timing characteristic.

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.

◆ FLEXCAN_SetTxMbConfig()

void FLEXCAN_SetTxMbConfig ( CAN_Type * base,
uint8_t mbIdx,
bool enable )

#include <fsl_flexcan.h>

Configures a FlexCAN transmit message buffer.

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.

◆ FLEXCAN_TransferAbortReceive()

void FLEXCAN_TransferAbortReceive ( CAN_Type * base,
flexcan_handle_t * handle,
uint8_t mbIdx )

#include <fsl_flexcan.h>

Aborts the interrupt driven message receive process.

This function aborts the interrupt driven message receive process.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
mbIdxThe FlexCAN Message Buffer index.

◆ FLEXCAN_TransferAbortReceiveFifo()

void FLEXCAN_TransferAbortReceiveFifo ( CAN_Type * base,
flexcan_handle_t * handle )

#include <fsl_flexcan.h>

Aborts the interrupt driven message receive from Rx FIFO process.

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

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.

◆ FLEXCAN_TransferAbortSend()

void FLEXCAN_TransferAbortSend ( CAN_Type * base,
flexcan_handle_t * handle,
uint8_t mbIdx )

#include <fsl_flexcan.h>

Aborts the interrupt driven message send process.

This function aborts the interrupt driven message send process.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
mbIdxThe FlexCAN Message Buffer index.

◆ FLEXCAN_TransferCreateHandle()

void FLEXCAN_TransferCreateHandle ( CAN_Type * base,
flexcan_handle_t * handle,
flexcan_transfer_callback_t callback,
void * userData )

#include <fsl_flexcan.h>

Initializes the FlexCAN handle.

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.

◆ FLEXCAN_TransferGetReceiveFifoCount()

status_t FLEXCAN_TransferGetReceiveFifoCount ( CAN_Type * base,
flexcan_handle_t * handle,
size_t * count )

#include <fsl_flexcan.h>

Gets the Legacy Rx Fifo transfer status during a interrupt non-blocking receive.

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.

◆ FLEXCAN_TransferHandleIRQ()

void FLEXCAN_TransferHandleIRQ ( CAN_Type * base,
flexcan_handle_t * handle )

#include <fsl_flexcan.h>

FlexCAN IRQ handle function.

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

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.

◆ FLEXCAN_TransferReceiveBlocking()

status_t FLEXCAN_TransferReceiveBlocking ( CAN_Type * base,
uint8_t mbIdx,
flexcan_frame_t * pRxFrame )

#include <fsl_flexcan.h>

Performs a polling receive transaction on the CAN bus.

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.

◆ FLEXCAN_TransferReceiveFifoBlocking()

status_t FLEXCAN_TransferReceiveFifoBlocking ( CAN_Type * base,
flexcan_frame_t * pRxFrame )

#include <fsl_flexcan.h>

Performs a polling receive transaction from Legacy Rx FIFO on the CAN bus.

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.

◆ FLEXCAN_TransferReceiveFifoNonBlocking()

status_t FLEXCAN_TransferReceiveFifoNonBlocking ( CAN_Type * base,
flexcan_handle_t * handle,
flexcan_fifo_transfer_t * pFifoXfer )

#include <fsl_flexcan.h>

Receives a message from Rx FIFO using IRQ.

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.

◆ FLEXCAN_TransferReceiveNonBlocking()

status_t FLEXCAN_TransferReceiveNonBlocking ( CAN_Type * base,
flexcan_handle_t * handle,
flexcan_mb_transfer_t * pMbXfer )

#include <fsl_flexcan.h>

Receives a message using IRQ.

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.

◆ FLEXCAN_TransferSendBlocking()

status_t FLEXCAN_TransferSendBlocking ( CAN_Type * base,
uint8_t mbIdx,
flexcan_frame_t * pTxFrame )

#include <fsl_flexcan.h>

Performs a polling send transaction on the CAN bus.

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.

◆ FLEXCAN_TransferSendNonBlocking()

status_t FLEXCAN_TransferSendNonBlocking ( CAN_Type * base,
flexcan_handle_t * handle,
flexcan_mb_transfer_t * pMbXfer )

#include <fsl_flexcan.h>

Sends a message using IRQ.

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.

◆ FLEXCAN_WriteTxMb()

status_t FLEXCAN_WriteTxMb ( CAN_Type * base,
uint8_t mbIdx,
const flexcan_frame_t * pTxFrame )

#include <fsl_flexcan.h>

Writes a FlexCAN Message to the Transmit Message Buffer.

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.