Datasheet

2003-2019 Microchip Technology Inc. DS20001801J-page 33
MCP2515
4.5 Message Acceptance Filters and
Masks
The message acceptance filters and masks are used to
determine if a message in the Message Assembly Buffer
should be loaded into either of the receive buffers (see
Figure 4-5). Once a valid message has been received
into the MAB, the identifier fields of the message are com-
pared to the filter values. If there is a match, that message
will be loaded into the appropriate receive buffer.
4.5.1 DATA BYTE FILTERING
When receiving standard data frames (11-bit identifier),
the MCP2515 automatically applies 16 bits of masks
and filters, normally associated with Extended
Identifiers, to the first 16 bits of the data field (Data
Bytes 0 and 1). Figure 4-4 illustrates how masks and
filters apply to extended and standard data frames.
Data byte filtering reduces the load on the MCU when
implementing Higher Layer Protocols (HLPs) that filter
on the first data byte (e.g., DeviceNet™).
4.5.2 FILTER MATCHING
The filter masks (see Register 4-14 through
Register 4-17) are used to determine which bits in the
identifier are examined with the filters. A truth table is
shown in Table 4-2 that indicates how each bit in the
identifier is compared to the masks and filters to deter-
mine if the message should be loaded into a receive
buffer. The mask essentially determines which bits to
apply the acceptance filters to. If any mask bit is set to
a zero, that bit will automatically be accepted,
regardless of the filter bit.
TABLE 4-2: FILTER/MASK TRUTH TABLE
As shown in the Receive Buffer Block Diagram
(Figure 4-2), acceptance filters, RXF0 and RXF1 (and
filter mask, RXM0), are associated with RXB0. The
filters, RXF2, RXF3, RXF4, RXF5 and mask RXM1, are
associated with RXB1.
FIGURE 4-4: MASKS AND FILTERS APPLY TO CAN FRAMES
Mask Bit n Filter Bit n
Message
Identifier
Bit
Accept or
Reject Bit n
0xxAccept
100Accept
101Reject
110Reject
111Accept
Note: x = don’t care
Extended Frame
Standard Data Frame
ID10 ID0 EID17 EID0
Masks and Filters Apply to the Entire 29-Bit ID Field
ID10 ID0 Data Byte 0 Data Byte 1
11-Bit ID Standard Frame
*
16-Bit Data Filtering*
*The two MSbs’ (EID17 and EID16) mask and filter bits are not used.