Question: Full CAN only receives messages with the identifier specified in the CAN configuration window. Is it possible to receive messages from a group of identifiers in one mailbox? How do you implement this in your program?
Yes, it is possible to receive messages from a group of identifiers in one mailbox.
There are 16 mailboxes. Once a CAN message is received, it is compared with the acceptance filter of the mailboxes and the accepted message is stored in the corresponding mailbox. The acceptance filter is configured by the Acceptance Mask Register (AMR) and the Acceptance Code Register (ACR). AMR defines whether the respective incoming bit is compared to the respective bit in the ACR. If a bit in the AMR is “0”, then the corresponding bit in the ACR is compared to the corresponding bit that is received. If the bit in AMR is “1”, then the corresponding bit in ACR is not compared to the bit that is received.
A mailbox can be configured to receive messages from a group of identifiers by writing to the registers corresponding to the AMR and ACR filter of that mailbox. In PSoC® 3 implementation the AMR and ACR are 32-bit registers. In case of a standard CAN, the most significant 11 bits of the AMR and ACR register store the filter values. In case of an extended CAN, the most significant 29 bits store the filter values.
For example, if you want to receive messages with an identifier from 100h to 1FFh in mailbox 0, then AMR and ACR should be set as shown in Figure 1. The following code has to be added in the program:
/* Sets the AMR value for RX buffer 0 */
/* Sets the ACR value for RX buffer 0 */