FLEXCAN INDIVIDUAL MASK Occasionally NOT Receiving Messages

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FLEXCAN INDIVIDUAL MASK Occasionally NOT Receiving Messages

495 Views
lleviton
Contributor III

I am using S32DS 2.2 with S32K116. Occasionally FLEXCAN does not receive messages but transmitting works fine. This occurs when there is a lot of bus traffic (10% to 50%) during initialization. Initializing twice does not fix the problem. But de-initializing FLEXCAN and then re-initializing fixes the problem. I have traced the problem to the order in which mailbox mask and id are set.

The following causes the problem:

/* Initialize CAN driver as configured by processor expert */
FLEXCAN_DRV_Init(INST_CANCOM1, &canCom1_State, &canCom1_InitConfig0);


/*enabling individual mask types sets all mailboxes to accept all CAN IDs */
FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1, FLEXCAN_RX_MASK_INDIVIDUAL);

 

FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1, MAILBOX_0, &dataInfo, DM13_RX_ID);

 

FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1, FLEXCAN_MSG_ID_EXT, MAILBOX_0, ACCEPT_ANY_PRIORITY);

The following fixes the problem:

/* Initialize CAN driver as configured by processor expert */
FLEXCAN_DRV_Init(INST_CANCOM1, &canCom1_State, &canCom1_InitConfig0);


/*enabling individual mask types sets all mailboxes to accept all CAN IDs */
FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1, FLEXCAN_RX_MASK_INDIVIDUAL);

 

 /*must set mask first. Otherwise, an unexpected Rx message will kill initialization. */
FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1, FLEXCAN_MSG_ID_EXT, MAILBOX_0, ACCEPT_ANY_PRIORITY);

 

FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1, MAILBOX_0, &dataInfo, DM13_RX_ID);

 

Is this the correct solution? What is causing the problem? Why does CAN activity cause a problem when FLEXCAN_DRV_Receive hasn't been invoked yet?

 

 

0 Kudos
Reply
1 Reply

477 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

after FLEXCAN_DRV_Init and FLEXCAN_DRV_ConfigRxMb the MB is ready to accept a message if selected as matched one during matching process. FLEXCAN_DRV_Receive just updates internal status variable and enable MB interrupt. So 2nd outlined init order makes more sense, however it should not bring much problem. 
I can recommend to check driver status variable for given MB, values returned by used function and content of MB area and mask register after an issue appears, to be sure it is expected one. Also be sure latest SDK is used.

BR, Petr

0 Kudos
Reply