f

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

f

1,298 Views
hagguisouhail
Contributor III

Hello,

I am working with the flexcan driver and I would like to define a mask filter for individual MB. I foloww the next steps : Get thje default config and that enable the individual mask for MB. Afterthat I initialise the CAN driver and enable it. Until now I suppose that the flexcan is configured to work with individual maks. After that I configure the filter id to be 0x120 (mbConfig.id = FLEXCAN_ID_STD(0x120)), I ran theFLEXCAN_SetRxMbConfig(EXAMPLE_CAN, 9, &mbConfig, true)  function and in order to accept only MBs with IDs(0x120->0123) I set the mask to be 0x7FD with the following function FLEXCAN_SetRxIndividualMask(EXAMPLE_CAN, 9, FLEXCAN_ID_STD(0x7FD)). However when I test this on my eval board, it reveals that the mask is not working properly ! since it accepts only 0x120 and 0x122. Can you please help me with this issue. Attached is the program to receive from can. Thank you.

Labels (1)
Tags (1)
2 Replies

1,031 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Haggui,

The FLEXCAN_SetRxIndividualMask function is used to masked the ID set in the rxframe, so if you want to set a range between 0x120 - 0x123 you should ignore the last two bits.

You're mask should be 0x7FC.

Best Regards,

Alexis Andalon

1,031 Views
jquesenberry
Contributor I

Can someone explain how the mask is calculated? I don't understand how 0x7FC would make it so only IDs 0x120 - 0x123 are accepted.

0 Kudos
Reply