2020-03-03 06:02 PM
Trying to understand how to setup the ID and Mask with Extended ID. I want allow messages with id's 0x1E02xxxx. So 0x1E021234 would be accepted and 0x1E031234 rejected.
2020-03-04 09:54 AM
I think you need to review the data you capture with an open filter, the Ext ID is 29 bits, and arranged thusly
I suspect your High Order bits are in the wrong spot, and need to be leftward some what, you can also mask/check the IDE bit
Guessing 0x1E02 << 3 and 0x1FFF << 3
2020-03-04 02:50 PM
I figured it out:
High filter: contains only bits 28-13 of id, so you need to << id by 3, mask off bits 12-0 and then >> by 16.
Low filter: contains bits 12-0 plus IDE, RTR, O. So again shift ID <<3 and then mask off last three bits (IDE, RTR, 0)
If I have the Extended Id 0x1E02533 and want to only allow this specific address:
uint32_t EXID=0x1E02533;
sFilterConfig.FilterIdHigh = (uint16_t)((EXID << 3 & 0xFFFE0000)>>16);
sFilterConfig.FilterIdLow = ((EXID << 3 & 0x0000FFF8));
sFilterConfig.FilterMaskIdHigh = 0xFFFF;
sFilterConfig.FilterMaskIdLow = 0XFFF8;
Further, if you want to allow a range of Extended Id's that start with 0x1E02xxxx you only need to change your mask bits:
uint32_t EXID=0x1E02533;
sFilterConfig.FilterIdHigh = (uint16_t)((EXID << 3 & 0xFFFE0000)>>16);
sFilterConfig.FilterIdLow = ((EXID << 3 & 0x0000FFF8));
sFilterConfig.FilterMaskIdHigh = 0xFFFE;
sFilterConfig.FilterMaskIdLow = 0X0000;