完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好伙计们
我正在使用spc560p的flexcan模块,现在我想使用中止机制通过软件而不是硬件自动从busoff状态恢复can总线,因为硬件恢复太快了。 因此,当我捕获ESR寄存器中的总线时,我启用了MCR中的AEN位。我通过将CS CODE设置为09开始中止TX MB,然后通过将CS CODE设置为08来激活TX MB,然后发送消息,但是没有消息已被发送出去了,而且公共汽车仍然是公共汽车,但公共汽车上没有波形 - 我已经看过几次这样的手册了但是我不清楚如何通过软件从公交状态中恢复过来 - 如果你们中有人有答案的话,我会非常感谢 以上来自于谷歌翻译 以下为原文 hello guys: I am using the flexcan module of spc560p, now I want to use the abort mechanism to recover the can bus from busoff state by software instead of by the hardware automaticly,because the hardware recovery is too fast, So I enabled the AEN bit in the MCR,when I captured the busoff in ESR register,I began to abort the TX MB by set the CS CODE to 09, and then activited the TX MB by set the CS CODE to 08,and then send the message,but there was no message had been sent out,and the can bus was still busoff,there was no waveform in the can bus ,I‘ve seen the manual several times, but I am not clear about how to recover from the busoff state by software?If any of you have the answers,I will be very appreciateï¼� |
|
相关推荐
5个回答
|
|
你好王,
我已将您的问题发送给专家。 最好的祝福 二万 以上来自于谷歌翻译 以下为原文 Hello Wang , I have sent your question to an expert. Best regards Erwan |
|
|
|
你好,
我想你将CTRL寄存器中的BOFF_REC位设置为1以避免自动恢复。 无论如何,您可以在执行期间使用此位来捕获总线关闭中断,如下所述。 总线关闭恢复模式 此位定义FlexCAN如何从总线关闭状态恢复。如果该位被否定,则自动 根据CAN规范2.0B,从总线关闭状态恢复。如果是的话 断言,从总线关闭自动恢复被禁用,模块保持在总线关闭状态 直到该位被用户否定。如果否定发生在11个隐性的128个序列之前 在CAN总线上检测到位,然后发生总线关闭恢复,就像BOFF_REC位一样 从未被断言过。如果在发生了11个隐性位的128个序列之后发生否定, 然后,FlexCAN将在加入总线之前等待11个隐性位,从而重新同步到总线。 在否定之后,BOFF_REC位可以在总线关闭期间再次重新置位,但它只会是 下次模块进入总线关闭时生效。如果BOFF_REC在模块时被否定 进入总线关闭状态,在总线关闭期间置位它将对当前的总线关闭恢复无效。 0根据CAN Spec 2.0 B部分,从总线关闭状态启用自动恢复。 1从Bus Off状态自动恢复禁用.Regards, Procolo 以上来自于谷歌翻译 以下为原文 Hello, I suppose you set BOFF_REC bit in CTRL register to 1 in order to avoid automatically recovery. Anyway you can use this bit during execution when catching a bus off interrupt as reported below. Bus Off Recovery Mode This bit defines how FlexCAN recovers from Bus Off state. If this bit is negated, automatic recovering from Bus Off state occurs according to the CAN Specification 2.0B. If the bit is asserted, automatic recovering from Bus Off is disabled and the module remains in Bus Off state until the bit is negated by the user. If the negation occurs before 128 sequences of 11 recessive bits are detected on the CAN bus, then Bus Off recovery happens as if the BOFF_REC bit had never been asserted. If the negation occurs after 128 sequences of 11 recessive bits occurred, then FlexCAN will resynchronize to the bus by waiting for 11 recessive bits before joining the bus. After negation, the BOFF_REC bit can be re-asserted again during Bus Off, but it will only be effective the next time the module enters Bus Off. If BOFF_REC was negated when the module entered Bus Off, asserting it during Bus Off will not be effective for the current Bus Off recovery. 0 Automatic recovering from Bus Off state enabled, according to CAN Spec 2.0 part B. 1 Automatic recovering from Bus Off state disabled.Regards, Procolo |
|
|
|
你好
Procolo: 谢谢你的帮助!我在手册中有说明,但还有另一个问题,我怎么知道 检测到128个11个隐性位的序列,我检查了手册并找到了关于处于总线状态的ECR寄存器的描述,如下所示: 如果FlexCAN处于“关闭”状态,则Tx_Err_Counter与另一个级联 内部计数器计数第11次连续隐性位的第128次出现 总线。因此,Tx_Err_Counter被重置为0并以内部的方式计数 计数器计数11个这样的位,然后在递增时包围 Tx_Err_Counter。当Tx_Err_Counter达到128的值时,FLT_CONF字段 在错误和状态寄存器中更新为“错误激活”和两个错误计数器 重置为零。在小于11的流之后的任何显性位的实例 连续隐性位,内部计数器将自身重置为零而不影响 Tx_Err_Counter值所以我了解到如果我想通过软件从busoff状态恢复,我需要断言 BOFF_REC 首先,当Flexcan进入总线状态时,我需要监视Tx_Err_Counter和Rx_Err_Counter,如果两个错误计数器都复位为0,则可以得出结论,已经检测到第11次连续隐性位的第128次出现,而且所有I要做的就是设置BOFF_REC 比特到0.是吗? 谢谢! 最好的祝福 梦梦 以上来自于谷歌翻译 以下为原文 Hello Procolo: Thanks for your help! I have got the description in the manual, but there is another problem that how can I know that the 128 sequences of 11 recessive bits have been detected, I checked the manual and found the description about the ECR register in busoff state,shown as below: If FlexCAN is in ‘Bus Off’ state, then Tx_Err_Counter is cascaded together with another internal counter to count the 128th occurrences of 11 consecutive recessive bits on the bus. Hence, Tx_Err_Counter is reset to 0 and counts in a manner where the internal counter counts 11 such bits and then wraps around while incrementing the Tx_Err_Counter. When Tx_Err_Counter reaches the value of 128, the FLT_CONF field in the Error and Status Register is updated to be ‘Error Active’ and both error counters are reset to zero. At any instance of dominant bit following a stream of less than 11 consecutive recessive bits, the internal counter resets itself to zero without affecting the Tx_Err_Counter value So I learnt that if I want to recover from the busoff state by software, I need to assert the BOFF_REC first, and when the Flexcan enter the busoff state, I need to monitor the Tx_Err_Counter and Rx_Err_Counter, if both of the err counters reset to 0, It can be concluded that the 128th occurrences of 11 consecutive recessive bits have been detected, and all I have to do is set the BOFF_REC bit to 0. Is that right? Thanks! Best regards mengmeng |
|
|
|
你好蒙蒙,
是的,你是对的,但你也应该检查ESR寄存器中的FLT_CONF,它将被设置为错误激活(00) 当可以在总线关闭时,tx计数器达到128。 问候, Procolo 以上来自于谷歌翻译 以下为原文 Hello Mengmeng, Yes you're right but you should also check FLT_CONF in ESR register which will be set to error active (00) when can is in bus off the tx counter reaches 128. Regards, Procolo |
|
|
|
你好procolo?
实际上,我不太明白你对此有何看法 ? ??但我已经尝试了?是的,FLT_CONF将被设置为00?并且总线仍然处于总线状态?我很困惑,如果它总是发生的话?我怎么能得出总线恢复的结论? 以上来自于谷歌翻译 以下为原文 Hello procolo? Actually, I don't quite understand about what you said about the ? ??but I have tried?and yes the FLT_CONF will be set to 00?and the bus is still in busoff state?I was so confused that if it is always happen?how can I conclude that the bus recovers indeed? |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2642 浏览 1 评论
3208 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1783 浏览 1 评论
3611 浏览 6 评论
5989 浏览 21 评论
940浏览 4评论
1317浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
585浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
1304浏览 3评论
1362浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 10:21 , Processed in 1.170420 second(s), Total 55, Slave 48 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号