ST意法半导体
直播中

杨帆

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

SPC56EL60 FlexCAN RX邮箱丢失消息

你好,


我有一个带有SPC56EL60的系统,CAN通信速率为500kBaud / s。发送20条消息,周期时间为200ms。我正在使用SPC5 Studio和集成的CAN驱动程序,并将其配置为具有16个RX和16个TX邮箱。
在过去,这个设置工作正常,但由于我将所有消息的周期时间从200ms更改为20ms,似乎我通过CAN总线“丢失”消息。
使用调试器调查SFR向我展示了两件事:
1)如果我使用FLEXCAN的SFR实时访问,则更少的消息丢失,通信工作更好(可能是因为当调试器读取SFR时邮箱被解锁?)
2)只有第一个消息缓冲区用于RX,所有其他消息缓冲区都被正确初始化但从不由微控制器写入

我认为因为只使用了第一个邮箱,所以传入的邮件会存储在那里,但会被其他传入的邮件覆盖。
如何配置驱动程序以使用多个邮箱接收邮件,如何轻松检查微控制器使用的所有邮箱?
在我的情况下,使用FlexCAN的FIFO功能会更好吗?是否有可用的示例项目显示使用FlexCAN FIFO?

谢谢和最好的问候,
帕特里克

以上来自于谷歌翻译


以下为原文




Hello,


I have a system with an SPC56EL60 with CAN communication at 500kBaud/s. 20 messages are send with cycle time of 200ms. I am using SPC5 Studio and the integrated CAN drivers and configured it to have 16 RX and 16 TX mailboxes.
In the past, this setting works fine but since I changed the cycle time for all messages from 200ms to 20ms it seems that I am ''loosing'' messages over the CAN bus.
Investigation of the SFRs with the debugger shows me two things:
1) If I use Real Time Access to SFRs of FLEXCAN fewer messages get lost and the communication works better (maybe because the mailboxes are unlocked when the debugger reads SFRs?)
2) Only the first message buffer is used for RX, all other message buffers are correctly initialized but never written by the microcontroller

I think because only the first mailbox is used incoming messages are stored there but where overwritten by other incoming messages.  
How do I have to configure the driver to use more than one mailbox for receiving messages and how can I easily check if all mailboxes where used by the microcontroller?
Would it be better in my case to use FIFO functionality of FlexCAN? Is there any sample project avaliable which shows using of FlexCAN FIFO?

Thanks and best regards,
Patrik

回帖(1)

刘鑫

2019-3-25 10:22:53
你好Patrik,
 
 
您是否尝试通过编译器选项优化代码?
你使用HAL或RLA驱动程序?
我们只有一些简单的CAN应用程序。 (RLA& HAL)
无论如何,我正在与CAN专家核实
 
 最好的祝福
 
 二万

以上来自于谷歌翻译


以下为原文





Hello Patrik ,


did you try to optimize your code by the compiler option  ?
do you use HAL or RLA drivers  ?
we have just some simple CAN Applications. (RLA & HAL)
Anyway, i am checking with CAN Experts

  Best Regards

               Erwan
举报

更多回帖

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