Hi,
Because, you present ID corresponding to extended ID I will use answer I have already provided to another guy.
„We are using Extended identifier. And we want to be able to receive two CAN IDs, 0x41 and 0xff.
According to the data sheet, it is set using a combination of CANIDMR & CANIDAR.
But I did not understand the explanation in the datasheet. and my customer too.
Please provide register value and explanation about the setting value.“
The explanation is for two IDs. However, if you want to filter the only one ID then both filters should be set in the same way.
Answer was:
Because you use extended identifier I suggest to use 2x32bit filter. In this case we do not have to think about unused filers because all IDAR and IDMR registers are covered by this size of filter. Moreover, it enables using only two filters which is enough for you now - you need only two exact numbers. The issue would be if you need more than two exact filters. In this case either filter logic including IDAR logic should be implemented and specific IDs must be selected or 4x16b filters should be used which, however, will accept all IDs with correct lower 16bits and any value in higher 16bit of ID - so additiona SW filter should be added.
I suppose you want to receive data frames only so I will set RTR to 0. (remote frames are filtered out)
CANIDAC=0x00; // select 2x32bit filters// exact filter ID= 0x41, Data frames only are accepted (no remote frame)
CANIDAR0 = 0x00;
CANIDMR0 = 0x00;
CANIDAR1 = 0x18; // SRR=IDE=1CANIDMR1 = 0x00;
CANIDAR2 = 0x00;
CANIDMR2 = 0x00;
CANIDAR3 = 0x82;
CANIDMR3 = 0x00;
// exact filter ID= 0xFF, Data frames only are accepted (no remote frame)
CANIDAR4 = 0x00;
CANIDMR4 = 0x00;
CANIDAR5 = 0x18; // SRR=IDE=1
CANIDMR5 = 0x00;
CANIDAR6 = 0x01;
CANIDMR6 = 0x00;
CANIDAR7 = 0xFE;
CANIDMR7 = 0x00;
Better explanation for your exact case you can find in the attached excell workbook, sheet EXTENDED ID, lines 51-56
I hope I have not made a mistake.
I have also attached an example I found in my PC.
To update this case, please reply to this email.
Some more examples I put a few days ago at: https://community.nxp.com/docs/DOC-329209
Best regards,
Ladislav