Question : PSoC3/5 CAN controller has 16 receive mailbox . Is it possible to group a set of similar Identifiers to one Mailbox and receive it? If yes , how do I do it ?
Answer : Yes, you can group a set of similar identifiers and receive it in one mailbox.
Example Scenario: You want to receive messages whose identifier ends with 100h to 1FFh in Mailbox 0. This can be done by configuring the Acceptance filter of the CAN receive Mailbox.
The Acceptance filter configuration is the same for both the FULL and Basic CAN . There are 16 mailboxes. Once 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 message from a group of identifier by writing to the registers corresponding to the AMR and ACR filter of that mailbox. In PSoC3 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 Extended CAN, the Most Significant 29 bits stores the filter values
For example you want to receive messages with identifier from 100h to 1FFh in mailbox 0 , then AMR and ACR should be set as shown in the below picture . 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 */
Attached is an example project implementing the same .
Basic_CAN.zip 2.0 MB