2017-04-13 07:41 AM
Hello.
Can anyone help me with CAN filters configuration
I need to implement 3 independent cases of the filters(will be used
independently, so not in same time)
Case 1 (for OBDII 11 bits communication)
I need to receive STD ids 0x7E8..0x7EF and filter others
Case 2 (for OBDII 29 bits communication)
I need to receive EXTID with PDU format 0xDA and 0xDB. So the IDs that passed filter are xxDAxxxx and xxDBxxxx
Case 3 (for J1939 29 bits communication)
I need to receive EXTID with PDU format 0xDA..0xFF. So the IDs that passed filter are xxDAxxxx ... xxFFxxxx
Thanks in advance, Alex
2017-04-13 08:12 AM
Posted on April 13, 2017 at 17:12
I've explained the filtering several times
https://community.st.com/0D70X000006SuuWSAS
For case 1 (0x7E8 .. 0x7EF)
Mask = 0x7F8, Compare = 0x7E8
HCANFilter_Struct.FilterIdHigh = 0x7E8 << 5; //11-bit ID in top bits ;//MSB of 32b config
HCANFilter_Struct.FilterIdLow = 0;//LSB of 32b config
HCANFilter_Struct.FilterMaskIdHigh = 0x7F8 << 5; //MSB
HCANFilter_Struct.FilterMaskIdLow = 0; //LSB
https://community.st.com/0D70X000006SzPuSAK
For the fuller 32-bit case refer to the bit diagram and create a mask so the bits in question can be compared.
2017-04-13 08:14 AM
Cites have other post stuck in moderation
For case 1 (0x7E8 .. 0x7EF)
Mask = 0x7F8, Compare = 0x7E8
HCANFilter_Struct.FilterIdHigh = 0x7E8 << 5; //11-bit ID in top bits ;//MSB of 32b config
HCANFilter_Struct.FilterIdLow = 0;//LSB of 32b configHCANFilter_Struct.FilterMaskIdHigh = 0x7F8 << 5; //MSBHCANFilter_Struct.FilterMaskIdLow = 0; //LSB