CAN masking and filtering

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN masking and filtering

157 Views
AnwarSheik
Contributor I

I am a noobie to NXP. i am using S32k144 in that i am using CAN communication with the can1 module 

i configured it to can 2.0b extendad id and applied the filtering to mailbox 1 and 2 to receive only 1 particular id for mailbox.

no the issue i am facing is. when the receive interrupt is fired how to get to know in what mailbox i have to receive.

mailbox 1 is configured with 0x14CAA500 id

mailbox 2 is configured with 0x14CAA501 id

masking:

flexcan_data_info_t dataInfo = { .data_length = 8U, .msg_id_type =
FLEXCAN_MSG_ID_EXT, .enable_brs = false, .fd_enable = false,
.fd_padding = 0U };
FLEXCAN_DRV_ConfigRxMb(can_communication_instance, 1U, &dataInfo,
0x14CAA501);
FLEXCAN_DRV_ConfigRxMb(can_communication_instance, 2U, &dataInfo,
0x14CAA500 );


FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1, FLEXCAN_RX_MASK_INDIVIDUAL);
FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1, FLEXCAN_MSG_ID_EXT, 1U,
0x1FFFFFFF);
FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1, FLEXCAN_MSG_ID_EXT, 2U,
0x1FFFFFFF);

FLEXCAN_DRV_InstallEventCallback(can_communication_instance,
&slave_can_callback, NULL);
FLEXCAN_DRV_Receive(can_communication_instance, 1U, &slave_can_recvBuff);
FLEXCAN_DRV_Receive(can_communication_instance, 2U, &slave_can_recvBuff);

Interrupt handler:

void slave_can_callback(uint8_t instance, flexcan_event_type_t eventType,
flexcan_state_t *flexcanState) {
(void) flexcanState;
(void) instance;

switch (eventType) {
case FLEXCAN_EVENT_RX_COMPLETE:
FLEXCAN_DRV_Receive(slave_can_instance, 2U, &slave_can_recvBuff);

0 Kudos
0 Replies