Modifying the Full CAN Mailbox’s Identifier in the Program - KBA86567 | Cypress Semiconductor
Support & Community
Modifying the Full CAN Mailbox’s Identifier in the Program - KBA86567
Is it possible to change the identifier of a Full CAN mailbox in the program to virtually have more than eight Full CAN mailboxes?
Yes, it is possible to change the identifier of the Full CAN mailbox dynamically in the program. The identifier can be changed by writing to the CAN Tx Msg Identifier register. This is a 32-bit register that is used to store the identifier value.
When using a standard CAN, the most significant 11 bits of the CAN Tx Msg register will contain the Identifier value. So before writing to the CAN Tx Msg Register you have to shift it by 21 bits for the standard CAN. Similarly if you are using the Extended CAN, the MSB 29 bits contain the identifier value. In this case you have to shift by three bits before writing to the register.
You can write to the aforementioned register using the following functions.
When using standard Full CAN use:
CY_SET_REG32((reg32 *)&CAN_TX[mailbox].txid, (ID << 21u));
When using Extended Full CAN use
CY_SET_REG32((reg32 *)&CAN_TX[mailbox].txid, (IDE << 3u));
Where ID – standard 11 bit Identifier; IDE – Extended 29 bit Identifier
Thus using the above function will allow you to have more than eight Full CAN mailboxes.