Greetings,
I am using NXP arm design studio for s32k144 chip set,
For receiving a specific extended CAN message from a external device I have configured the CAN filter mask, after the filter mask configuration is made I'm receiving configured messages as well as non-configured messages also.
Here i am attaching my configuration, kindly help me to over come this issue.
/*! @brief PAL instance information */
const can_instance_t canPal1_instance = {CAN_INST_TYPE_FLEXCAN, 1U};
/*! @brief User configuration structure */
const can_user_config_t canPal1_Config0 = {
.maxBuffNum = 16UL,
.mode = CAN_NORMAL_MODE,
.peClksrc=CAN_CLK_SOURCE_PERIPH,
.enableFD = false,
.payloadSize = CAN_PAYLOAD_SIZE_8,
.nominalBitrate = {
.propSeg = 7,
.phaseSeg1 = 4,
.phaseSeg2 = 1,
.preDivider = 2,
.rJumpwidth = 1
},
.dataBitrate = {
.propSeg = 7,
.phaseSeg1 = 4,
.phaseSeg2 = 1,
.preDivider = 2,
.rJumpwidth = 1
},
.extension = NULL,
};
//Initialisation
unsigned char Can_Init(void)
{
unsigned char ret_val_u8 = 0;
/*#1 Initialize CAN engine - baudrate, DMA or IT, filter buffer init with table */
ret_val_u8 = CAN_Init(&canPal1_instance, &canPal1_Config0);
/*#2 Configure the Tx buffer using MailBox 0 & 1*/
can_buff_tx_config_e.enableFD = FALSE;
can_buff_tx_config_e.enableBRS = FALSE;
can_buff_tx_config_e.idType = CAN_MSG_ID_EXT;
can_buff_tx_config_e.isRemote = FALSE;
can_buff_tx_config_e.fdPadding = 0;
ret_val_u8 += CAN_ConfigTxBuff(&canPal1_instance, TX_MAILBOX0, &can_buff_tx_config_e);
ret_val_u8 += CAN_ConfigTxBuff(&canPal1_instance, TX_MAILBOX1, &can_buff_tx_config_e);
/*#3 Configure the Rx buffer using MailBox 2 */
can_buff_rx_config_e.enableFD = FALSE;
can_buff_rx_config_e.enableBRS = FALSE;
can_buff_rx_config_e.idType = CAN_MSG_ID_EXT;
can_buff_rx_config_e.isRemote = FALSE;
can_buff_rx_config_e.fdPadding = 0;
/*#4 Start reception of Rx Buffer (initially with a fixed acceptance address (NULL)) */
/* NULL is assigned in order to avoid any incoming messages before application starts */
ret_val_u8 += CAN_ConfigRxBuff(&canPal1_instance, RX_MAILBOX0, &can_buff_rx_config_e, MIN_U32);
/*#5 Change the mask mode to "Individual Mask" (so other Masks will be zero) with complete masking */
ret_val_u8 += CAN_SetRxFilter(&canPal1_instance, CAN_MSG_ID_EXT, RX_MAILBOX0, 0);
/*#6 Inclusion of callback function of the IT and DMA events */
/* FlexCAN driver includes few additional functionality than CAN-PAL drivers
* NOTE: Don't use RxFIFO feature in Can_Init if we use this callback */
FLEXCAN_DRV_InstallEventCallback(canPal1_instance.instIdx, Can_Callback_Event, NULL);
return(ret_val_u8);
}
/* #1 Configure the Rx Mailbox with required address */
ret_val_u8 = CAN_ConfigRxBuff(&canPal1_instance, FILTER_BANK_0,&can_buff_rx_config_e, 0x01023345);
/* #2 Configure the Mask of the Rx Mailbox */
ret_val_u8 += CAN_SetRxFilter(&canPal1_instance, CAN_MSG_ID_EXT, FILTER_BANK_0,0x1FFFFFFF);
Thanks,