Skip to main content
JSzuc
Associate II
April 11, 2019
Question

How I need to set the CAN FilterIDHig/Low and MASKIDHigh/Low, the FilterScale 16 or 32 bit, and what they mean? I would like to use the IDLIST configuration, but I cant find any useful documentation.

  • April 11, 2019
  • 5 replies
  • 1372 views

..

This topic has been closed for replies.

5 replies

Tesla DeLorean
Guru
April 11, 2019

The Reference Manuals used to have a diagram showing the relationship with the filter registers and the bits on the wire.

I've predominantly used the mask/comparator methods.

If you know the message IDs from traffic on the bus, it shouldn't take more than a couple of educated guesses about the bit position of the 16-bit ID field to confirm the mechanics.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
JSzuc
JSzucAuthor
Associate II
April 11, 2019

Yes, that is a very nice diagram.

But my question was, what the relationship betveen the message ID (in the message) and the data field content in the CAN_FilterTypeDef structure? The HAL user manual (UM1725) is not saying any concrete information about that. "Filter scale - Specifies the filter scale". What a suprise! Ok.

JSzuc
JSzucAuthor
Associate II
April 11, 2019

Anyway this wors:

.FilterMode = CAN_FILTERMODE_IDLIST;

.FilterScale = CAN_FILTERSCALE_16BIT;

.FilterIdHigh = 0x321 << 5;

.FilterIdLow = 0x0000;

.FilterMaskIdHigh = 0x0000;

.FilterMaskIdLow = 0x0000;

but it dont care the FilterScale! It is working with the

.FilterScale = CAN_FILTERSCALE_32BIT; too.

Why I need this: "<<5"? And where it is in the manuals?

The HAL user manual is saying: "FilterIdHigh - Specifies the filter identification number (MSBs for a 32-bit configuration, first

one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF"

So this was my question. And maybe I understand why saying that some peoples, the HAL Drivers is a junk.

Ben K
Senior III
April 11, 2019

The reference manual is the only place that has an explanation, look for the diagram outlining the position of ID, RTR and IDE bits in the filter banks.

You can also check this function, which translates actual ID configuration to filter bank settings (spoiler: it's not nice, I also have no idea why they had to design it this complicated).

JSzuc
JSzucAuthor
Associate II
April 12, 2019

Thank You Ben! I will read that.

Sorry, I was wrong. My question would have been right : "How I need to set the CAN FilterIDHig/Low and MASKIDHigh/Low, the FilterScale 16 or 32 bit, and what they mean in the HAL Driver? I would like to use the IDLIST configuration."