赛灵思
直播中

马龙

7年用户 255经验值
私信 关注
[问答]

Logicore IP CAN过滤问题

好奇,如果有人尝试(并成功)配置和测试Xilinx CAN中的“验收滤波器”?
我发现当为具有MASK的单个CAN通道设置单个过滤器时,该MASK应该仅允许具有确切值的CAN消息作为我配置的接受ID,而是接受不应该通过的其他CAN消息。
我已多次阅读LogiCORE IP CAN v5.0产品指南,并检查了AFR,AFMR和AFID寄存器的设置。我正在使用CAN B(扩展ID) -  J1939 CAN消息,我无法理解
我看到的行为。
社区中是否有人试图使用验收过滤器并经过充分测试,说它确实按设计工作?
谢谢!

以上来自于谷歌翻译


以下为原文

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?
Thanks!

回帖(3)

刘来有

2019-4-2 10:48:07
在Linux上可以吗?
移动应用程序托管

以上来自于谷歌翻译


以下为原文

CAN on linux ?
Mobile Application Hosting
举报

王利

2019-4-2 11:06:00
嗨 - 谢谢你的兴趣,但不,不是Linux(虽然我觉得不重要)。
我们有一个定制的硬件,我们称之为CAN模块,有8个CAN通道。
该模块运行一个为CAN通道提供服务的裸机应用程序。
模块外部我使用商用现成应用程序“X-Analyzer”发送CAN消息,该应用程序通过Softing公司的CANpro USB设备发送CAN消息。
发送和接收消息正常。
我们还使用了Simma软件的软件堆栈,它为我们提供了处理J1939 CAN消息的能力。当我尝试配置接收过滤器和所有内容时,我检查了软件堆栈以确保正在配置正确的寄存器/内存(来自
我所知道的看起来是正确的。
这就是为什么我正在寻找有人说“是”我们已成功实施CAN功能并使用接收过滤器而没有问题的原因。
(这会让我得到一些保证,我的代码中存在一个错误而不是我正在追逐Xilinx错误。)Thansks。

以上来自于谷歌翻译


以下为原文

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.
举报

王利

2019-4-2 11:22:39
好的 - 现在有一些细节 - 可能有人可以指出发生了什么。
我有一个设置,我有8个CAN通道都循环。
总线正确终止,因为我可以在所有8个通道上发送和接收CAN消息而不会出现问题。
我想测试验收滤波,所以我已阅读Xilinx Logicore IP CAN文档并遵循它。
以下是这种情况:我只想接收与CAN ID匹配的通道2上的CAN消息:0x00F1BF00。
我将使用的掩码是0x00FFFF00。
因此,当我填写AFMR1寄存器用于通道2(第一个接收过滤器掩码)时,根据文档,第1位指定远程传输请求,然后位1-18指示扩展消息ID,然后位19指示是否仅通过
标准或扩展帧,然后是位20,表示替代远程传输请求掩码,后跟位21-31,它是标准消息ID掩码。
我强制为0,19和20位零,所以我执行指定位移后的最终AFMR1掩码为:0x07E7FE00。
然后AFIR1(通道2的第一个接收滤波器IDRegister)设置相同,位0,19和20也被强制为零,因此执行指定位移后的最终AFIR1值为:0x07837E00。
此时,我通过将AFR(验收滤波器寄存器)的位0设置为通道2的1来启用通道2的滤波器。现在我通过发送具有不同CAN ID的CAN消息来测试滤波器 - 这是我正在目击的

发送CAN ID为0x00FEBF00的CAN消息会导致通道2无法接收消息(这是正确的)。
发送CAN ID为0x00F1BF00的CAN消息会导致通道2接收消息(这是正确的)。
发送CAN ID为0x00F2BF00的CAN消息会导致通道2收到消息(这是不正确的)
发送CAN ID为0x00F3BF00的CAN消息会导致通道2收到消息(这是不正确的)
发送CAN ID为0x00F4BF00的CAN消息会导致通道2未收到消息(这是正确的)。
我还测试了F5BF,F6BF,F7BF,F8BF,F9BF,FABF,所有这些都导致通道2没有收到消息(这一切都是正确的)。
那么......当发送CAN ID 0x00F2BF00和CAN ID 0x00F3BF00时,通道2如何接收CAN消息?
显然(在这些情况下),如果我对接受过滤器ID应用MASK并对传入的CAN ID应用Mask并将结果相互比较,则它们不匹配...所以为什么通道2在接收消息时
使用这些ID?
有人可以帮我理解吗?
我们正在尝试运送一个生产质量的CAN模块,我被这种过滤异常所困扰。
提前感谢您提供的任何见解。

以上来自于谷歌翻译


以下为原文

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.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分