S32K314 BUSOFF

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K314 BUSOFF

Jump to solution
2,684 Views
rujunzhou
Contributor III

你好:

     我们在测试S32K314 BUSOFF的功能时,遇到一个问题。我们代码默认busoff 自恢复功能。然后为了实现手动快慢恢复效果,设置了一个函数,作为busoff 恢复调用。函数先设置模式 CAN_CS_Started。然后初始化邮箱内的数据内容为inactive,数据设置为0x08080000.这样的话,如果需要100ms busoff 恢复,那么在100ms任务中调用此函数,此函数会判断是否进入busoff,如果进入busoff状态,就会调用刚才的函数。

    但是在测试过程中发现,当调用busoff的周期,较小于一定的CAN报文发送周期,会出现CAN报文直接停发。查看CAN_State_Error_Count,处于TX_passive 状态,不会再进入busoff。请问为什么CAN报文会停发?

0 Kudos
Reply
1 Solution
2,611 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@rujunzhou

没有示例代码,关闭或者使能Bus-Off Auto Recovery就只和这以为寄存器有关,你直接写寄存器即可。

Senlent_0-1761787766511.png

 

View solution in original post

5 Replies
2,645 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@rujunzhou

1.我无法通过你的描述来定位问题的原因,你至少要提供基本的测试例程我们才能帮你分析原因。

2.快慢回复我不建议你这样去做,你应该关闭自动恢复,检查到bus-off event的时候,再开启自动回复,在t1时间内如果没有bus-off event事件产生则恢复成功,如若没有,再关闭自动恢复,等待若干时间再尝试打开自动恢复。

2,538 Views
rujunzhou
Contributor III
现在对第一个问题再描述一下,CAN在什么情况下,会停发报文,需要重新上下电才会恢复。目前已知CAN没处于busoff状态。出现这种情况是概率性的,我是用CANH对地短路出现的。此时收发器的输入即MCU的tx引脚一直处于高电平。
0 Kudos
Reply
2,627 Views
rujunzhou
Contributor III

Hi,

    请问你那有s32k3 busoff 恢复的相关代码供参考吗?

0 Kudos
Reply
2,612 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@rujunzhou

没有示例代码,关闭或者使能Bus-Off Auto Recovery就只和这以为寄存器有关,你直接写寄存器即可。

Senlent_0-1761787766511.png

 

2,605 Views
rujunzhou
Contributor III
好的,感谢
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2194281%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3ES32K314%20BUSOFF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2194281%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%3A%3C%2FP%3E%3CP%3E%20%20%20%20%20We%20encountered%20a%20problem%20when%20testing%20the%20functionality%20of%20the%20S32K314%20BUSOFF.%20Our%20code%20defaults%20to%20the%20busoff%20self-recovery%20function.%20Then%20in%20order%20to%20realize%20the%20manual%20fast%20and%20slow%20recovery%20effect%2C%20a%20function%20is%20set%20up%20as%20a%20busoff%20recovery%20call.%20The%20function%20first%20sets%20the%20mode%20CAN_CS_Started%2C%20then%20initializes%20the%20data%20content%20in%20the%20mailbox%20to%20inactive%2C%20and%20the%20data%20is%20set%20to%200x08080000.%20In%20this%20case%2C%20if%20you%20need%20100ms%20busoff%20recovery%2C%20then%20call%20this%20function%20in%20the%20100ms%20task%2C%20and%20this%20function%20will%20judge%20whether%20to%20enter%20busoff%2C%20and%20if%20it%20enters%20the%20busoff%20state%2C%20it%20will%20call%20the%20function%20just%20now.%20If%20it%20enters%20the%20busoff%20state%2C%20it%20will%20call%20the%20function%20just%20now.%3C%2FP%3E%3CP%3E%20%20%20%20However%2C%20during%20the%20test%2C%20I%20found%20that%20when%20the%20period%20of%20calling%20busoff%20is%20less%20than%20a%20certain%20period%20of%20CAN%20message%20sending%2C%20the%20CAN%20message%20will%20be%20stopped%20directly.%20When%20I%20check%20CAN_State_Error_Count%2C%20it%20is%20in%20TX_passive%20state%2C%20and%20it%20will%20not%20enter%20busoff%20again%2C%20may%20I%20ask%20why%20the%20CAN%20message%20will%20be%20stopped%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2196498%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K314%20BUSOFF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2196498%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3ENow%20to%20describe%20the%20first%20question%20a%20little%20more%2C%20under%20what%20conditions%20does%20the%20CAN%20stop%20sending%20messages%20and%20need%20to%20be%20re-powered%20before%20it%20resumes.%20At%20the%20moment%20it%20is%20known%20that%20CAN%20is%20not%20in%20a%20busoff%20state.%20The%20occurrence%20of%20this%20is%20probabilistic%2C%20I%20have%20had%20it%20occur%20with%20CANH%20shorted%20to%20ground.%20At%20this%20point%20the%20transceiver%20input%2C%20i.e.%20the%20tx%20pin%20of%20the%20MCU%2C%20is%20always%20high.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2195360%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K314%20BUSOFF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2195360%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3EOkay%2C%20thanks.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2195352%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K314%20BUSOFF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2195352%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CA%20href%3D%22mailto%3AHi%40rujunzhou%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EHi%40rujunzhou%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThere%20is%20no%20sample%20code%2C%20disabling%20or%20enabling%20Bus-Off%20Auto%20Recovery%20is%20only%20related%20to%20this%20register%2C%20you%20can%20just%20write%20the%20register%20directly.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Senlent_0-1761787766511.png%22%20style%3D%22width%3A%20521px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Senlent_0-1761787766511.png%22%20style%3D%22width%3A%20521px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363142iB31F9007FBA384DD%2Fimage-dimensions%2F521x246%3Fv%3Dv2%22%20width%3D%22521%22%20height%3D%22246%22%20role%3D%22button%22%20title%3D%22Senlent_0-1761787766511.png%22%20alt%3D%22Senlent_0-1761787766511.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2195209%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K314%20BUSOFF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2195209%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%E8%AF%B7%E9%97%AE%E4%BD%A0%E9%82%A3%E6%9C%89s32k3%20busoff%20%E6%81%A2%E5%A4%8D%E7%9A%84%E7%9B%B8%E5%85%B3%E4%BB%A3%E7%A0%81%E4%BE%9B%E5%8F%82%E8%80%83%E5%90%97%EF%BC%9F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2194999%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K314%20BUSOFF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2194999%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3EHi%40rujunzhou%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E1.%20I%20can't%20pinpoint%20the%20cause%20of%20the%20problem%20by%20your%20description%2C%20you%20need%20to%20provide%20at%20least%20a%20basic%20test%20routine%20for%20us%20to%20help%20you%20analyze%20the%20cause.%3C%2FP%3E%0A%3CP%3E2.%20I%20don't%20recommend%20you%20to%20do%20it%20this%20way%2C%20you%20should%20turn%20off%20autorecovery%2C%20check%20the%20bus-off%20event%2C%20then%20turn%20on%20autorecovery%2C%20if%20no%20bus-off%20event%20is%20generated%20in%20t1%20time%2C%20then%20the%20recovery%20is%20successful%2C%20if%20not%2C%20then%20turn%20off%20autorecovery%2C%20wait%20for%20a%20number%20of%20time%20and%20try%20to%20turn%20on%20autorecovery%20again.%3C%2FP%3E%3C%2FLINGO-BODY%3E