Hello,
I am trying to receive Multiple CAN messages using single MailBox, But I am not able to receive it, Can anyone please help me to understand about Mailbox, Masking and filters and solve this issue?
Regards
Akhil
Hi,
you can refer to https://community.nxp.com/t5/S32K-Knowledge-Base/S32K1xx-FlexCAN-Mask-Setting-Demo/ta-p/1519753
It is for S32K1 using SDK, but principle is same.
You have ID defined in the MB ID word, which is going to be matched with the ID to be received. Then you have corresponding mask acceptance register which defines which bit of the ID is compared or not, there is bit to bit correspondence between MB ID mask and received ID. .
BR, Petr
Hi @PetrS ,
I am not able to understand about the MailBox, How to configure multiple messages to one mailbox?
FlexCAN_Ip_SetRxMaskType(INST_FLEXCAN_0,FLEXCAN_RX_MASK_INDIVIDUAL);
FlexCAN_Ip_SetRxIndividualMask_Privileged(INST_FLEXCAN_0,RX_MB_IDX_0,0xFFFFFFFF); //Mask
rx_info.is_polling = FALSE;
rx_info.msg_id_type = FLEXCAN_MSG_ID_STD;
FlexCAN_Ip_ConfigRxMb(INST_FLEXCAN_0, RX_MB_IDX_0, &rx_info, 0x122); //0x122 is Message ID
FlexCAN_Ip_ConfigRxMb(INST_FLEXCAN_0, RX_MB_IDX_0, &rx_info, 0x124);
FlexCAN_Ip_ConfigRxMb(INST_FLEXCAN_0, RX_MB_IDX_0, &rx_info, 0x126);
Here, how can I add the SetRxIndividualMask_Privileged Mask value?
How can I configure FlexCAN_Ip_ConfigRxMb message ID?
can you please help me?
Regards
Akhil
Hi,
MB ID is set using FlexCAN_Ip_ConfigRxMb function. In your example using std. ID and individual masking scheme set std.ID=0x126 using
FlexCAN_Ip_ConfigRxMb(INST_FLEXCAN_0, RX_MB_IDX_0, &rx_info, 0x126); // set MB std ID = 0x126
If all mask bits are set a message with exact matched ID is received, so only std.ID 0x126 FlexCAN_Ip_SetRxIndividualMask_Privileged(INST_FLEXCAN_0,RX_MB_IDX_0,0x7FF<<18); // Mask = 0x7FF
If all mask bits are cleared all std.ID messages will be received into RX_MB_IDX_0 FlexCAN_Ip_SetRxIndividualMask_Privileged(INST_FLEXCAN_0,RX_MB_IDX_0,0x0<<18); // Mask = 0x0
You can also create ID range to be received
FlexCAN_Ip_SetRxIndividualMask_Privileged(INST_FLEXCAN_0,RX_MB_IDX_0,0x7FC<<18); // Mask = 0x7FC
Here messages with ID range 0x124-0x127 are received, lower 2 bits are don't care.
BR, Petr