Specifications

5 CAN I/O Support for FIFO
5-38
Acceptance Filters
As mentioned earlier, the CAN controller’s acceptance filters can be used to
ensure that certain received messages referenced by their identifiers get
written into the receive FIFO. Therefore, fewer read attempts are necessary to
get at the messages which are of importance for the target application.
The behavior of the acceptance filter is described for standard and extended
identifier ranges individually (one for standard identifiers and one for
extended identifiers). Each acceptance filter is defined by a mask parameter
and a code parameter.
The mask parameter defines for each bit of the identifier, if the filtering process
cares about this bit or not. A 0 means “don’t care” and a 1 means “do care”.
The code parameter then defines for each bit of the identifier the filtering
process cares about (defined by the mask parameter), what the bit value has to
be (‘0’ or ‘1’).
For standard identifiers the mask parameter and code parameter have to be
both in the range 0 to 2047. For extended identifiers the mask parameter and
code parameter have to be both in the range 0 to 2
29
-1.
The filtering process evaluates the following binary expression
and( xor( mask, identifier ), code )
If all bits of the resulting value are 0, the message with this identifier will be
accepted, if one single bit is 1 the message will be voided.
According to this description, acceptance filters work using binary evaluation
while most applications use the mental model of differentiating messages
(identifiers) in a decimal or hexadecimal manner. As a consequence, it is
possible to filter messages, which identifiers are above a certain decimal
number, while the opposite (identifiers below a certain decimal number) can
not be achieved in a general way.
Examples
The default values in the FIFO setup driver block are both 0 for the mask
parameter and the code parameter. These parameter values assure (the above
expression always evaluates to 0) that all incoming messages will reach the
receive FIFO (no filtering takes place). All parameter values have to be defined