07-13-2015 12:17 PM
Curious if anyone has attempted (and succeeded) in configuring and testing the "acceptance filters" in Xilinx CAN? I am finding that when setting a single filter for a single CAN channel with a MASK that should only allow CAN messages of the exact value as my configured acceptance ID, that other CAN messages that should not pass are being accepted. I have read the LogiCORE IP CAN v5.0 product guide many times and have tripple checked the setting of the AFR, AFMR and AFID registers. I am working with CAN B (extended ID) - J1939 CAN messages and I can't understand the behavior I am seeing. Has anyone in the community attempted to use the acceptance filters and have tested with confidence to say it really does work as designed?
07-14-2015 03:57 AM
Hi - Thanks for your interest but no, not Linux (although I don't think it matters). We have a custom piece of hardware we call a CAN module that has 8 CAN channels. The module runs a Bare Metal Application that services the CAN channels. External to the module I send CAN messages using Commercial Off-The-Shelf application "X-Analyser" which sends CAN messages via a CANpro USB device from the company Softing. Sending and receiving messages works fine. We are also using a software stack from Simma Software that provides us with the ability to handle J1939 CAN messages.I have checked the software stack to make sure the proper registers/memory is being configured when I attempt to configure acceptance filters and everything (from what I can tell) looks correct. This is why I am looking for someone to say "Yes" we have successfully implemented CAN capabilities and have used the acceptance filters without issue. (This would provide me with some reassurance that there is a bug in my code somewhere and not that I am chasing a Xilinx bug.) Thansks.
07-14-2015 10:41 AM
OK - Now for some nitty gritty details - perhaps someone can point out what is going on. I have a setup where I have 8 CAN channels that are all looped. The bus is properly terminated as I am able to send and receive CAN messages across all 8 channels without issue. I wanted to test the Acceptance filtering so I have read the Xilinx Logicore IP CAN documentation and followed it. Here is the situation: I want to only accept CAN messages on channel 2 that match the CAN ID: 0x00F1BF00. The mask I will be using is 0x00FFFF00. So when I fill in the AFMR1 register for channel 2 (1st acceptance filter mask), according to the documentation, the 1st bit specifies Remote Transmission Request, then Bits 1 - 18 indicate the extended message ID then bit 19 indicates whether to filter by just by Standard or Extended Frames, then bit 20 that indicates the Substitute Remote Transmission Request Mask followed by bits 21 - 31which is the Standard Message ID Mask. I forced zeros for Bits 0, 19 and 20 so my final AFMR1 mask after performing specified bit shifting is: 0x07E7FE00. Then the AFIR1 (1st acceptance Filter ID Register for channel 2) is setup the same with Bits 0, 19, and 20 also being forced to zero and so the final AFIR1 value after performing specified bit shifting is: 0x07837E00. At this point, I enable the filter for channel 2 by setting bit 0 of the AFR (Acceptance Filter Register) to 1 for channel 2. Now I test the filter by sending a CAN messages with varying CAN IDs - here is what I am witnessing:
Sending a CAN message with CAN ID of 0x00FEBF00 results in Channel 2 not receiving the message (which is correct).
Sending a CAN message with CAN ID of 0x00F1BF00 results in Channel 2 receiving the message (which is correct).
Sending a CAN message with CAN ID of 0x00F2BF00 results in Channel 2 receiving the message (THIS IS NOT CORRECT)
Sending a CAN message with CAN ID of 0x00F3BF00 results in Channel 2 receiving the message (THIS IS NOT CORRECT)
Sending a CAN message with CAN ID of 0x00F4BF00 results in Channel 2 not receiving the message (which is correct).
I also tested F5BF, F6BF, F7BF, F8BF, F9BF, FABF and all result in Channel 2 not receiving the message (whic is all correct).
So ... how does channel 2 receive the CAN messages when CAN ID 0x00F2BF00 and CAN ID 0x00F3BF00 are sent? Clearly (in both of these cases) if I apply the MASK against the Acceptance Filter ID and apply the Mask against the incoming CAN ID and compare the results against one another, they do NOT match...so why does channel 2 receive the message when these IDs are used?
Can someone please help me understand? We are trying to ship a production quality CAN module and I am being held up by this filtering anomaly.
Thank you in advance for any insight you can provide.