Hello,
I am working on an automotive prototype project where CAN messages are read over 16 bit MC9S12XEP100CVL.
The CAN message format is standard 11bit idenfier.
I am interested in receiving CAN messages in the range of 0x300 to 0x600.
Kindly let me know how acceptance filters can be applied to filter the above range.
Hi,
I would like to add....
Having read the question I have found you wanted to filter ID up to 0x600. I suppose it is not 0x600 but 0x5FF. Do not hesitate to response if following is not clear.
If it is 0x5FF then set the filter 3 (CANIDAR67,CANIDMR67) in the same way as any of the previous filters. It means, for example, CANIDAR67 will be set as CANIDAR45 and CANIDMR67 will be set as CANIDMR45.
However, if you want exactly interval from 0x300 to ox600 the filter 0,1,2 are OK but the last filter, filter 3, should be set for exact value 0x600 which means:
A) both data and remote frames and standard identifiers only
// filter3 setup - the exact value 0x600 filter, both data and remote frames are accepted
CANIDAR6 = 0B11000000; // ID10,9,8,7,6,5,4,3
CANIDAR7 = 0B00000000; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match)
CANIDMR6 = 0B00011111; // ID10,9,8,7,6,5,4,3
CANIDMR7 = 0B00010111; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match).... ignore data/remote, match standard only frame
B) The setup accepts ID within range 0x300-0x600 for data frames only and standard identifiers only
// filter3 setup - the exact value 0x600 filter, data frames are only accepted
CANIDAR6 = 0B11000000; // ID10,9,8,7,6,5,4,3
CANIDAR7 = 0B00000000; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match)
CANIDMR6 = 0B00000000; // ID10,9,8,7,6,5,4,3
CANIDMR7 = 0B00000111; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match).... match data only, match standard only frame
Is it clear?
Best regards,
Ladislav
Hello Ladislav,
Thanks for the information.I have successfully applied the above filters to allow messages from 0x300 to 0x600.
Hi,
because of given range you should use 4z16bit filter setup as follows.
I hope I have not made a mistake.
A) The setup accepts ID within range 0x300-0x6FF for both data and remote frames and standard identifiers only
CANIDAC = 0b00010000; // select 4x16bit filters
// filter0 setup - range 0x300-0x3FF, both data and remote frames are accepted
CANIDAR0 = 0B01100000; // ID10,9,8,7,6,5,4,3
CANIDAR1 = 0B00000000; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match)
CANIDMR0 = 0B00011111; // ID10,9,8,7,6,5,4,3
CANIDMR1 = 0B11110111; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match).... ignore data/remote, match standard only frame
// filter1 setup - range 0x400-0x4FF, both data and remote frames are accepted
CANIDAR2 = 0B10000000; // ID10,9,8,7,6,5,4,3
CANIDAR3 = 0B00000000; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match)
CANIDMR2 = 0B00011111; // ID10,9,8,7,6,5,4,3
CANIDMR3 = 0B11110111; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match).... ignore data/remote, match standard only frame
// filter2 setup - range 0x500-0x5FF, both data and remote frames are accepted
CANIDAR4 = 0B10100000; // ID10,9,8,7,6,5,4,3
CANIDAR5 = 0B00000000; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match)
CANIDMR4 = 0B00011111; // ID10,9,8,7,6,5,4,3
CANIDMR5 = 0B11110111; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match).... ignore data/remote, match standard only frame
// filter3 setup - range 0x600-0x6FF, both data and remote frames are accepted
CANIDAR6 = 0B11000000; // ID10,9,8,7,6,5,4,3
CANIDAR7 = 0B00000000; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match)
CANIDMR6 = 0B00011111; // ID10,9,8,7,6,5,4,3
CANIDMR7 = 0B11110111; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match).... ignore data/remote, match standard only frame
B) The setup accepts ID within range 0x300-0x6FF for data frames only and standard identifiers only
CANIDAC = 0b00010000; // select 4x16bit filters
// filter0 setup - range 0x300-0x3FF, data frames are only accepted
CANIDAR0 = 0B01100000; // ID10,9,8,7,6,5,4,3
CANIDAR1 = 0B00000000; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match)
CANIDMR0 = 0B00011111; // ID10,9,8,7,6,5,4,3
CANIDMR1 = 0B11100111; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match).... match data only, match standard only frame
// filter1 setup - range 0x400-0x4FF, data frames are only accepted
CANIDAR2 = 0B10000000; // ID10,9,8,7,6,5,4,3
CANIDAR3 = 0B00000000; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match)
CANIDMR2 = 0B00011111; // ID10,9,8,7,6,5,4,3
CANIDMR3 = 0B11100111; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match).... match data only, match standard only frame
// filter2 setup - range 0x500-0x5FF, data frames are only accepted
CANIDAR4 = 0B10100000; // ID10,9,8,7,6,5,4,3
CANIDAR5 = 0B00000000; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match)
CANIDMR4 = 0B00011111; // ID10,9,8,7,6,5,4,3
CANIDMR5 = 0B11100111; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match).... match data only, match standard only frame
// filter3 setup - range 0x600-0x6FF, data frames are only accepted
CANIDAR6 = 0B11000000; // ID10,9,8,7,6,5,4,3
CANIDAR7 = 0B00000000; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match)
CANIDMR6 = 0B00011111; // ID10,9,8,7,6,5,4,3
CANIDMR7 = 0B11100111; // ID2,1,0,RTR,IDE,x,x,x (1/0=ignore/match).... match data only, match standard only frame
In detail you can see it here,
Best regards,
Ladislav
Hi, Ladislav,
Why the RTR in CANIDAR1, 3, 5 & 7 are different ?
Best Regards,
Aaron