cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 CAN filter range of ID's

Smdeint
Associate III

Hello, I have a set of extended CAN ID's I need to pas the bxCAN filter. I looked at some examples where one ID is passed the filter, but could not figure out how to allow a set of ID's. If my understanding is correct the mask is used to determine which bits of the ID are important. How can I configure the filter so that I can pass a set of different ID's?

These are the ID's:

// 0x0CF00400
// 0x0CFD9200
// 0x18FEE500
// 0x18FEEE00
// 0x18FEEF00
// 0x18FEF200
// 0x18FEF700
// 0x18FEFC00

 

This is what my filter config looks like:

	can_fil.FilterBank = 0;
	can_fil.FilterMode = CAN_FILTERMODE_IDLIST;
	can_fil.FilterFIFOAssignment = CAN_RX_FIFO0;
	can_fil.FilterIdHigh = 0;
	can_fil.FilterIdLow = 0;
	can_fil.FilterMaskIdHigh = 0;
	can_fil.FilterMaskIdLow = 0;
	can_fil.FilterScale = CAN_FILTERSCALE_32BIT;
	can_fil.FilterActivation = ENABLE;
	can_fil.SlaveStartFilterBank = 13;

 

10 REPLIES 10

I don't know how did you set the filter bank. For that please read the attached file in my last comment in this thread. You need also to read the reference manual on how to use the CAN filters and how the registers are organized.

In your case each filter can set two Extended ID filters. See the example I've already provided to you.

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.