AnsweredAssumed Answered

How to config CAN RXFIFO on MPC5748G

Question asked by Yukun Wu on Sep 18, 2018

Hi, All,

 

       I'm using MPC5748G devkit to implement CAN Receice an CAN Send. 

       I saw there is an example code in "S32_SDK_MPC574xx_EAR_0.8.1" about FLEXCAN but it is only show how to receive an static CAN ID's message by using API[ FLEXCAN_DRV_Receive(uint8_t instance,uint8_t mb_idx,flexcan_msgbuff_t *data)]. I want to receive many CANID's message and then to sort and handle them, but i don't know how to config. 

       Could you please provide an example for me? Thanks~

 

uint32_t fifo_filter[5] = {0x111,0x222,0x333,0x444,0x555};
flexcan_id_table_t config_fifo = {
.isRemoteFrame = false,
.isExtendedFrame = false,
.idFilter = fifo_filter,
};

FLEXCAN_DRV_Init(INST_CANCOM1, &canCom1_State, &canCom1_InitConfig0);

FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1, FLEXCAN_RX_MASK_GLOBAL);

FLEXCAN_DRV_SetRxFifoGlobalMask(INST_CANCOM1, FLEXCAN_MSG_ID_STD, 0x1FFFFFFF);

FLEXCAN_DRV_ConfigRxFifo(INST_CANCOM1, FLEXCAN_RX_FIFO_ID_FORMAT_A, &config_fifo);


flexcan_msgbuff_t recbuff;
for (;;) {
FLEXCAN_DRV_RxFifo(INST_CANCOM1, &recbuff);
}

Outcomes