0

我用MK24F12。我调整了 Flexcan 模块以使用车队管理系统接口从设备收集消息。我打开了 RxFIFO 并将 ID 接受模式设置为格式 A。然后我用 ID 填充过滤表(它从第 7 个邮箱开始),并根据 RXIMR 寄存器用掩码填充。我用 0x40000000 填充其余过滤器,用 0x5FFFFFFF 填充其余掩码寄存器。当我开始收听设备时,我得到了一些帧,但问题是我没有收到设备发送的所有消息,尽管它们匹配过滤器。我知道,因为如果我将任何掩码寄存器设置为零,我会在总线上收到所有消息。我注意到命中过滤器(RXFIR 寄存器)是(0,1,4,5,...),所以换句话说,我得到的消息与存储在 MailBox 的寄存器 CSn 和 IDn​​ 中的过滤器匹配。

下面是日志,在这里我添加了 7 个过滤器,我只收到了 4 种类型的消息。然后我删除了所有过滤器,如您所见,我跳过了很多应该被捕获的消息。

[1.003] Filter added (Type: Ext, ID: 0x00FEE900, Mask: 0x00FFFF00)
[1.004] Filter added (Type: Ext, ID: 0x00FEFC00, Mask: 0x00FFFF00)
[1.005] Filter added (Type: Ext, ID: 0x00FEEE00, Mask: 0x00FFFF00)
[1.006] Filter added (Type: Ext, ID: 0x00FEC100, Mask: 0x00FFFF00)
[1.007] Filter added (Type: Ext, ID: 0x00F00400, Mask: 0x00FFFF00)
[1.008] Filter added (Type: Ext, ID: 0x00FEE500, Mask: 0x00FFFF00)
[1.008] Filter added (Type: Ext, ID: 0x00FEEA00, Mask: 0x00FFFF00)

[1.935] CAN.Got frame (Type: Ext, ID: 0x18F00420, Data: FF FF FF 80 0C FF FF FF, Filter: 4)
[2.436] CAN.Got frame (Type: Ext, ID: 0x18FEE520, Data: 58 1C 00 00 FF FF FF FF, Filter: 5)
[2.938] CAN.Got frame (Type: Ext, ID: 0x18FEE920, Data: FF FF FF FF 59 1C 00 00, Filter: 0)
[3.439] CAN.Got frame (Type: Ext, ID: 0x18FEFC20, Data: FF 48 FF FF FF FF FF FF, Filter: 1)
[4.944] CAN.Got frame (Type: Ext, ID: 0x18F00420, Data: FF FF FF C0 12 FF FF FF, Filter: 4)
[5.445] CAN.Got frame (Type: Ext, ID: 0x18FEE520, Data: 59 1C 00 00 FF FF FF FF, Filter: 5)
[6.950] CAN.Got frame (Type: Ext, ID: 0x18FEE920, Data: FF FF FF FF 5A 1C 00 00, Filter: 0)
[7.452] CAN.Got frame (Type: Ext, ID: 0x18FEFC20, Data: FF 46 FF FF FF FF FF FF, Filter: 1)
[8.957] CAN.Got frame (Type: Ext, ID: 0x18F00420, Data: FF FF FF 00 19 FF FF FF, Filter: 4)
[9.458] CAN.Got frame (Type: Ext, ID: 0x18FEE520, Data: 5A 1C 00 00 FF FF FF FF, Filter: 5)


at this point i removed all filters

[34.186] CAN.Got frame (Type: Ext, ID: 0x18F00420, Data: FF FF FF 00 4B FF FF FF, Filter: 0)
[34.688] CAN.Got frame (Type: Ext, ID: 0x18FEE520, Data: 62 1C 00 00 FF FF FF FF, Filter: 0)
[35.190] CAN.Got frame (Type: Ext, ID: 0x18FEE920, Data: FF FF FF FF 63 1C 00 00, Filter: 0)
[35.691] CAN.Got frame (Type: Ext, ID: 0x18FEFC20, Data: FF 34 FF FF FF FF FF FF, Filter: 0)
[36.193] CAN.Got frame (Type: Ext, ID: 0x18FEEE20, Data: 56 FF FF FF FF FF FF FF, Filter: 0)
[36.694] CAN.Got frame (Type: Ext, ID: 0x18FEC120, Data: AD 05 00 00 FF FF FF FF, Filter: 0)
[37.196] CAN.Got frame (Type: Ext, ID: 0x18F00420, Data: FF FF FF 40 51 FF FF FF, Filter: 0)
[37.698] CAN.Got frame (Type: Ext, ID: 0x18FEE520, Data: 63 1C 00 00 FF FF FF FF, Filter: 0)
[39.203] CAN.Got frame (Type: Ext, ID: 0x18FEE920, Data: FF FF FF FF 64 1C 00 00, Filter: 0)
[39.704] CAN.Got frame (Type: Ext, ID: 0x18FEFC20, Data: FF 32 FF FF FF FF FF FF, Filter: 0)
[40.206] CAN.Got frame (Type: Ext, ID: 0x18FEEE20, Data: 58 FF FF FF FF FF FF FF, Filter: 0)
[40.707] CAN.Got frame (Type: Ext, ID: 0x18FEC120, Data: AD 05 00 00 FF FF FF FF, Filter: 0)

这是FlexCAN 寄存器值的图片

4

1 回答 1

0

我发现我读取了 MB 的 CS 寄存器的 CODE 位,过滤器 2、3、6、7 的 CODE 位为 1……这意味着 BUSY。但是如果 FIFO 引擎使用 MB,它不包含 CODE 位,我们根本不应该检查 Message Buffer Code。如果不使用一些位,他们可能会保持清晰。

问题已关闭。这是MB和FIFO结构的图片

于 2017-07-25T09:15:52.233 回答