- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm having a really hard time to set CAN AMR and ACR register to make acceptance filtering work.
Maybe it's the setting of those registers that I don't do corretly, maybe it'S the sending or even de receiving of a CAN message.
So here are the important part for it and how I'm trying to make it work.
This exemple is to accept message from a range of 0x10 to 0x1F
How I set AMR and ACR, this is something I saw somewhere on the internet and it make sense to me:
CAN_RX_CFG CAN_RX_CFG;
uint32 rxAMR = 0x00F << 20;
uint32 rxACR = 0x010 << 20;
uint8 i;
CAN_RX_CFG.rxmailbox = 1;
CAN_RX_CFG.rxamr = 0x01FFFFFF9;
CAN_RX_CFG.rxacr = 0x02000000;
And this is how I send a message
uint8 TX_Msg[DATALENGTH] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
int i;
CAN_TX_MSG CAN_Msg;
CAN_DATA_BYTES_MSG Data;
CAN_Msg.id = 11;
CAN_Msg.rtr = 0;
CAN_Msg.ide = 0;
CAN_Msg.dlc = DATALENGTH;
CAN_Msg.irq = 1;
CAN_Msg.msg = &Data;
for(i=0u; i<DATALENGTH; i++)
{
Data.byte = TX_Msg;
}
CAN_SendMsg(&CAN_Msg_Ptr);
The transmitting and receiving works great. The problem appears when I set the ID to an ID that it shouldn't accepts, like 33, the message is stille received. Is there some code I need to write at the receiving or this is all build-in?
Also, do I need to set the ACR and AMR register for all the mailboxes? All my mailboxes are set to basic.
Thank you in advance for your great advices!
Solved! Go to Solution.
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Setting ACR and AMR is already answered in the forum post link given below. Please check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This part:
uint32 rxAMR = 0x00F << 20;
uint32 rxACR = 0x010 << 20;
uint8 i;
obviously shouldn' t be there, some left over of another try
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Setting ACR and AMR is already answered in the forum post link given below. Please check.