CANedge2 Docs, Release FW 01.04.02
Example: Filter configuration which accepts two message IDs:
• 2000
10
= 11111010000
2
• 2001
10
= 11111010001
2
Note that the two binary numbers are identical except for the rightmost bit. To design a filter which
accepts both IDs, we can use the mask field to mask out the rightmost bit - such that it is not considered
when the filter is applied. In (1) the mask is set such that the rightmost bit is not considered (indicated
by red color).
Filter ID
Filter mask
Masked filter
11111010000
2
&11111111110
2
11111010000
2
(1)
Message ID
Filter mask
Masked ID
11111010001
2
&11111111110
2
11111010000
2
(2)
To test if the messages pass the filter, we apply the mask to the message ID 11111010001
2
as given in
(2). The masked filter and the masked ID are equal - the message passes the filter. Note that both
11111010000
2
and 11111010001
2
passes the filter, as the rightmost bit is not considered by the filter (the
rightmost bit is masked out).
Example: J1939 - filter configuration which accepts PGN 61444 (EEC1) messages.
J1939 message frames use 29-bit CAN-IDs. The Parameter Group Number (PGN) is defined by 18 of
the 29 bits. The remaining 11 bits define the priority and source address of the message. It is often
useful to configure a filter to accept a specific PGN regardless of the source address and the priority -
this can be done using the filter mask (to ignore the source and priority).
Below, the left red bits represent the 3-bit priority, the green bits the 18-bit PGN and the right red bits
the 8-bit source address of the 29-bit CAN-ID.
00011111111111111111100000000
2
= 3FFFF00
16
Message ID bits in positions with zero bits in the filter mask are ignored. By using 3FFFF00
16
as filter
mask, the source and priority are ignored.
To specifically accept PGN 61444 F004
16
messages, the message ID is set to F00400
16
- note the the
final 8-bit 00
16
represents the source address which is ignored by the filter mask (these bits can be set
to any value).
Filter mask 3FFFF00
16
can be used for all J1939 PGN messages. To accept specific PGNs, the message
ID is adjusted. To accept one specific PGN (as in the example above), the message ID is set to the
specific PGN with 00
16
appended to represent the ignored source address field.
Filter list examples
Below examples demonstate how filters can be combined into a list of filters.
Example: The filter list is setup to accept standard messages with even IDs in range 500
10
− 1000
10
(500, 502, . . . 998, 1000):
The following two filters are used to construct the wanted filter mechanism:
• Rejection filter which rejects all odd message IDs
• Acceptance filter which accepts all message IDs in range 500
10
− 1000
10
The rejection filter is setup to reject all odd messages by using Mask filtering. The filter is
setup with:
• Filter ID: 1
10
= 00000000001
2
• Filter Mask: 1
10
= 00000000001
2
Above rejection filter rejects all messages with the rightmost bit set (all odd IDs).
The acceptance filter is setup to accept all messages in range 500
10
− 1000
10
by using Range
filtering. The filter is setup with:
28 CONTENTS