Skip to main content
Ukazu
Associate III
November 28, 2023
Solved

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

  • November 28, 2023
  • 4 replies
  • 1520 views

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?

This topic has been closed for replies.
Best answer by mƎALLEm

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

 

4 replies

Ukazu
UkazuAuthor
Associate III
November 28, 2023

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

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
November 29, 2023

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 "Best answer" on the reply which solved your issue or answered your question.
Ukazu
UkazuAuthor
Associate III
November 30, 2023

@mƎALLEm 

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?