完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好。我有一个应用程序,其中一个MCP2515连接到一个嵌入式Linux模块的SPI总线。我有一个小麻烦,使CAN数据包的正确顺序。我有过滤器设置,以便任何有效的CAN消息将被接收。我有BUKT设置,如果RXB0是满的,它可以滚动。对于RXB1,问题是我可以每10毫秒左右查询一次设备。有时在两个缓冲区都有消息。我怎么知道先收到哪个消息?我能检查一些标志的组合吗?这可能是显而易见的——RXB0中的第一个出现,其次是RXB1上的一个,对吗?但是有一个条件(我想)可能是不正确的:-假设我对芯片进行投票,只有RXB0IF被设置,这意味着当我正在读取缓冲区时,在RXB0中有一条消息,第二条消息到达程序集缓冲区。它会滚入RXB1。在我再次轮询之前,我等待10毫秒,在此期间,第三条消息到达并放入RXB0。下次轮询时,RXB0IF和RCB1IF都被设置,但我如何知道哪一条消息先到达?
以上来自于百度翻译 以下为原文 Hi everyone. I have an application where an MCP2515 is connected to the SPI bus of an embedded linux module. I'm having a little trouble getting CAN packets in the correct order. I have the filters set so that any valid can message will be received. I have BUKT set so that if RXB0 is full it can roll-over to RXB1 The issue is that I can poll the device every 10ms or so. Sometimes there are messages in both buffers. How can I tell which message was received first? Is there some combination of flags I can check? It might seem obvious - the one in RXB0 came first, followed by the one on RXB1 right? But there is a condition (I think) where this might not be true:- Say I poll the chip and only RXB0IF is set, meaning there is a message in RXB0 While I'm reading the buffer a 2nd message is arriving in the assembly-buffer. It gets rolled into RXB1. I wait 10 ms before I poll again, during which time a 3rd message arrived and got put into RXB0. The next time I poll, both RXB0IF and RCB1IF are set, but how can I tell which message arrived first? |
|
相关推荐
2个回答
|
|
嗨,也许,在完成了RXB0和RXB0的处理之后,您应该检查RXB1IF是否再次,RX状态指令,以防在处理RXB0时发生翻滚,然后离开新的10毫秒轮询间隔。问候,Mysil
以上来自于百度翻译 以下为原文 Hi, Maybe, after completed processing of RXB0, and RXB0 have been released, you should check RXB1IF again, RX STATUS Instruction, in case a rollover have occurred while processing RXB0, before leaving for a new 10 ms poll interval? Regards, Mysil |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5178 浏览 9 评论
2003 浏览 8 评论
1931 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3177 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2228 浏览 5 评论
737浏览 1评论
622浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
509浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
636浏览 0评论
533浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-26 20:55 , Processed in 1.168277 second(s), Total 51, Slave 44 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号