cancel
Showing results for 
Search instead for 
Did you mean: 

About filter behavior in case of ID list and 16bit scale

Ukazu
Associate III

Hi

I would like to know about filter behavior in ID list mode and 16bit scale.

I would like to receive 3 standard IDs.

I know that with the combination of ID list and 16bit scale, I can receive 4 standard IDs.

 

In this case, one will remain when setting in the CAN_FiR1/CAN_FiR2 register. If there is a surplus, the initial value of this CAN_FiR1/CAN_FiR2 register is undefined, so is it better to set it to 0x0000 or to set one of the three IDs that you want to receive?

 

If you set 0x0000, you will be explicitly set to receive ID=0x000, so I am thinking of setting one of the three IDs you want to receive.

For ID List (16bit), Filter Num is 0 to 3. With the following settings, CAN ID 0x001 will be set in two locations( 0 or 3).
CAN ID 0x001 is Filter Num = 0
CAN ID 0x002 is Filter Num = 1
CAN ID 0x003 is Filter Num = 2
CAN ID 0x001 is Filter Num = 4

In this case, is the Filter Num stored in the receiving mailbox always 0? Or does it occur randomly as 0 or 3?

4 REPLIES 4
Ukazu
Associate III

There was a typo. The correct answer is below.

CAN ID 0x001 is Filter Num = 0
CAN ID 0x002 is Filter Num = 1
CAN ID 0x003 is Filter Num = 2
CAN ID 0x001 is Filter Num = 3

Hello @Ukazu ,

Indeed when you want to receive only 3 IDs, you can repeat one of them in the ID list.

I just tested it on an STM32F769 Eval board in loopback mode.

See attached project.

I sent all standard IDs from 0x0 to 0x7FF. FIFO received only the IDs  0x001, 0x002 and 0x003 

My filter config:

    sFilterConfig.FilterMode = CAN_FILTERMODE_IDLIST;
    sFilterConfig.FilterScale = CAN_FILTERSCALE_16BIT;
    sFilterConfig.FilterIdHigh     = 0x001 << 5;   // ID3   (FxFR2[0:15])
    sFilterConfig.FilterIdLow      = 0x002  << 5;  // ID1   (FxFR1[0:15])
    sFilterConfig.FilterMaskIdHigh = 0x003  << 5;  // ID4   (FxFR2[16:31])
    sFilterConfig.FilterMaskIdLow  = 0x001  << 5;  // ID2   (FxFR1[16:31])   // --> repeated ID

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

@SofLit 

I appreciate your testing.

I understand that ID3, ID1, ID4, ID2 in the comments of your sample code are Filter Num.

When CAN ID 0x001 was received, which filter passed through ID3 or ID2 of "Filter Num" to enter the receiving mailbox? I want to know this.

can.PNG

 

Is it possible for you to test it?

Hello,

I have other priorities. Now you have the project and I'm challenging you to test it from your side ;). 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.