CANwireless
CR3132
13
8.3.3 Filtering CAN messages
You can configure in the device which CAN messages are forwarded from the CAN interface to the
radio interface. The bus load of the CAN and radio interfaces is reduced if no more data than
necessary is allowed.
A filter and a mask for the CAN ID decide whether a message is forwarded to the radio interface. Up
to eight filters can be configured. If there are less than eight messages, a separate filter can be used
for each message. Use mask 0x7FF for an 11-bit CAN ID and mask 0x1FFFFFFF for a 29-bit CAN ID.
The device uses the following variables to calculate whether to allow or block a CAN message:
Variable name
Description
RxCANid
CAN ID of the received CAN message
FilterValue
Filter with which a CAN ID is identified as authorised
MaskValue
Mask with which a CAN ID is identified as authorised
The verification mechanism works as follows:
RxCANid XOR FilterValue = checkedCANid
checkedCANid AND MaskValue = RESULT
If RESULT = 0, the message is authorised.
Example 1:
RxCANid: 0x123
FilterValue: 0x421
MaskValue: 0xF8
Description
Hex
Binary
Received CAN message
0x123
0b001.0010.0011
FilterValue
0x421
0b100.0010.0001
XOR
checkedCANid
0x502
0b101.0000.0010
MaskValue
0x0F8
0b000.1111.1000
AND
RESULT
0x000
0b000.0000.0000
→ With these settings, the CAN ID 0x123 is authorised; messages with this ID are forwarded.
Example 2:
RxCANid: 0x123
FilterValue: 0x431
MaskValue: 0xF8
Description
Hex
Binary
Received CAN message
0x123
0b001.0010.0011
FilterValue
0x431
0b100.0011.0001
XOR
checkedCANid
0x512
0b101.0001.0010
MaskValue
0x0F8
0b000.1111.1000
AND
RESULT
0x010
0b000.0001.0000
→ With these settings, the CAN ID 0x123 is rejected; messages with this ID will not be forwarded.