-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can Bus off (IDFGH-393) #2519
Comments
@MrAlexandrKolesnikov I'm able to restart the CAN module and send messages after a bus off by doing the following
Could you send a code snippet of your bus off handling code to recreate the issue you mentioned above? |
I use only can_types.h on idf version 3.0. Any way restart can use cleaning and setting can module register? |
I'm not sure where you got
This should have the effect of resetting the CAN module on the hardware level (gates the clock signal and sets the reset line) after which the registers in the CAN module should have the same default values as a power-on reset. |
I use only direct access to can registers like CAN object on your code. And can work fine. But sometimes i get bus-off interrupt from it. I try clear register and set it as you do in
but it has no effect. I also try:
then call my init function |
Do you have a code snippet you could show of which registers you set/clear after a bus off? |
Of course! When I get bus-off interrupt i do:
|
I'm still unable to recreate the issue. Could you send your |
Sory, i can't show you everything, but this is the whole part responsible for initializing the driver and our register description |
I don't see anything wrong with your init. Try running the following code but check the following points listed below.
How do you determine that the re-init was unsuccessful? Are you attempting to transmit/receive a frame after re-initialization with no results? If so, check the following
|
Ok, i see that RXERROR counter not clear after enable/disable. I try clear it but it steel equal 128. I check the line and see than CAN H and CAN L have the same level. Do you have any example how init into self-test mode? Yes, after re-init I can't transmit/receive a frame but other nodes can communicate with each other |
Here's what should ideally occur
Could you verify at which stage the RX error counter becomes 128 and ALC becomes 7. If the RX counter is 0 after a hardware reset and becomes 128 after reset mode exits, it suggests that something on the bus or the RX pin is causing the CAN module to interpret RX errors after re-initialization. If the RX error counter becomes 128 after calling If the RX error counter becomes 128 after calling |
After a hardware reset ECC clear to zero, ALC not clear. My bad - RX error counter after init clear to zero but Receive Status register equal 0x1. |
Is the status register = 0x1 or just the receive status bit in the status register? |
receive status bit steel equal 0x1 |
As mentioned above, once |
@MrAlexandrKolesnikov Could you help share if any updates for this issue? Thanks. |
@MrAlexandrKolesnikov closing this issue due to lack of updates. Please feel free to open a new issue if you are still experiencing problems and suspect it is a bug in ESP-IDF. Please also take a look at the ESP32 ECO document to see if any of the CAN Errata are relevant to the issues you are facing. |
Reopening as further testing has shown a possible edge case that can cause Bus Off Recovery to get stuck. When the Bus Off interrupt occur, the REC can still increase after Bus Off. The ISR handles this by freezing both counters. However, if the ISR is delayed in running, the REC will be non zero when Bus Off recovery begins. This in turn will result in interrupt that indicates Bus Off recovery completion to fail to trigger. Workaround: In the ISR that handles Bus Off condition. Set the TEC to 0 and the back to 255 immediately. I'll push a commit to fix this shortly. |
Hi! Is there any way to restart the can module when bus off without waiting for 128 bus free signal?
Reset Mode or full reinit has no effect.
The text was updated successfully, but these errors were encountered: