CR3132
CANwireless
14
8.3.4 Filter functionality
The filter set in the device consists of two components: the filter (FilterValue) and the mask
(MaskValue). With these two components, the device calculates which CAN IDs are permitted and will
only forward these CAN messages to the radio interface.
You can determine the correct FilterValue by ORing all desired CAN IDs.
You can determine the correct MaskValue by XNORing all desired CAN IDs.
The bigger the MaskValue, the stricter the filter works.
Zeros in the MaskValue have no influence on the result.
Example: MaskValue = 0x0F8 → 0b000.1111.1000 → 0bxxx.1111.1xxx
Only bit 3, bit 4, bit 5, bit 6 and bit 7 have an influence on the filter.
Example 1:
Only messages with CAN IDs 0x123, 0x124 and 0x125 are to be forwarded.
u
Determine the FilterValue:
Description
Hex
Binary
Received CAN message 1
0x123
0b001.0010.0011
Received CAN message 2
0x124
0b001.0010.0100
Received CAN message 3
0x125
0b001.0010.0101
OR
Required value for FilterValue
0x127
0b001.0010.0111
u
Determine the MaskValue:
Description
Hex
Binary
Received CAN message 1
0x123
0b001.0010.0011
Received CAN message 2
0x124
0b001.0010.0100
Received CAN message 3
0x125
0b001.0010.0101
XNOR
Required value for MaskValue
0xFF8
1b111.1111.1000
u
Test with CAN message 3:
Description
Hex
Binary
Received CAN message 3
0x125
0b001.0010.0101
FilterValue
0x127
0b001.0010.0111
XOR
checkedCANid
0x002
0b000.0000.0010
MaskValue
0xFF8
1b111.1111.1000
AND
RESULT
0x000
0b000.0000.0000
→ CAN ID 0x125 is authorised; messages with this ID are forwarded.
Example 2:
Only messages with the CAN ID 0x123 are to be forwarded.
Description
Hex
Binary
Received CAN message
0x123
0b001.0010.0011
FilterValue
0x123
0b001.0010.0011
XOR
checkedCANid
0x000
0b000.0000.0000