cancel
Showing results for 
Search instead for 
Did you mean: 

Help with FD-CAN filter

prigo87
Associate II

Hello,

I work with STM32G484, with FDCAN. I want to create filter so only messages with my own CAN_ID will reach HAL_FDCAN_RxFifo0Callback.

I started by define the filter:

filter.IdType = FDCAN_STANDARD_ID;
filter.FilterIndex = 0;
filter.FilterType = FDCAN_FILTER_MASK;
filter.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;
filter.FilterID1 = CAN_ID;
filter.FilterID2 = 0x1FFFFFFF;
 
HAL_FDCAN_ConfigFilter(&hfdcan1, &filter);
 
At this point the filter not realy doing anything, and I still getting other nodes ID in the callback.
 
I tried to add a global filter with:
HAL_FDCAN_ConfigGlobalFilter(&hfdcan1, FDCAN_REJECT, FDCAN_REJECT, FDCAN_REJECT_REMOTE, FDCAN_REJECT_REMOTE);

but now i reject also my own ID.
 
What I miss here? what is the correct way to define the filter?
 
Thanks in advance,
Amit Prigozin
5 REPLIES 5
Tinnagit
Senior II

I'm unsure but I have HAL_FDCAN_Start and HAL_FDCAN_ActivateNotification with FDCAN_IT_RX_FIFO0_NEW_MESSAGE for active interrupt on every new message in HAL_FDCAN_RxFifo0Callback

and you also need to have HAL_FDCAN_ActivateNotification in FDCAN RX callback too.

I did all of this of course.
The problem is with the filter setting

Thank you

I had read your can config and your CAN id that I think that it's not oversize of Standard ID. I think it's an extended id.
so you should try to change IdType to extended one.

prigo87
Associate II

i work with CAN-ID of 10 to 200. So its not a problem of ID length. Any way I changed the ID type to extend and it still not working - passing all with regular filter only, and block all with the global filter

Hi prigo87!

Did you solve the issue? Mine is related:

H723 FDCAN1 and FDCAN2 - Page 2 - STMicroelectronics Community

 

Cheers!