- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Solved! Go to Solution.
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Question: Is it possible to change the identifier of a FULL CAN Mailbox in the program to virtually have more than 8 FULL CAN mailboxes?
Answer: 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 which is used to store the identifier value.
In case of 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 3 bits before writing to the register.
You can write to the above mentioned register using the following functions.
In case of using Standard FULL CAN use
CY_SET_REG32((reg32 *)&CAN_TX[mailbox].txid, (ID << 21u));
In case of 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 8 FULL CAN messages. Attached along with this post is the example project .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Question: Is it possible to change the identifier of a FULL CAN Mailbox in the program to virtually have more than 8 FULL CAN mailboxes?
Answer: 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 which is used to store the identifier value.
In case of 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 3 bits before writing to the register.
You can write to the above mentioned register using the following functions.
In case of using Standard FULL CAN use
CY_SET_REG32((reg32 *)&CAN_TX[mailbox].txid, (ID << 21u));
In case of 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 8 FULL CAN messages. Attached along with this post is the example project .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This doesn't seem to work for CAN FULL RX Mailbox IDs. It doesn't change the ID that activates the interrupt. Anyone know if that is possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SRAM,
The method what you explained to transmitt the CAN message wuth a different ID seems not workign for me. I have PSoC5lp and using creator3.3.
When I try to send the CAN message ID with 0x1 as identifier, I see the 0x40000 message ID, and the IDE bit is set. So, some how it is treated as extended CN message ID. I even tried to reset the IDE bit, it did not work for me.
Any help is appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SRAM,
I am able to transmit the messages now. For both extended and standard message ID, I am shifting by 3 bits and is working fine. I am not sure why the left shift by 21 bits is not working fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SRAM,
I'm having a similar issue where I've been using the functions you said to change the id at runtime. However, even though both the tx id register on the tx side and the rx id register on the rx side are exactly the same when I look at them in the debugger the message being transmitted doesn't get received. I know everything else is configured properly since if I set the same id's in the CAN block at the beginning it works fine. I need to be able to change the ids at runtime though.