Hi, I am doing some testing of the CAN controller, and I saw that if a frame doesn't get acknowledged (in my tests, the wires are not connected to anything) the controller retries it and the tx_err counter goes up, triggering an interrupt for error warning, and then error passive, as I expected to happen
But then, after the error passive, the tx counter gets stuck at 128, even though the controller keeps retrying the frame and bus errors are continuously being raised but no other interrupt happens again
Is this the intended behaviour? Or should it keep counting tx errors until 256, then raise a bus-off interrupt?
Does the controller stop retrying the frame at some point? (assuming that it the wires stay disconnected)
Regards,
Unable to trigger CAN bus-off state
Re: Unable to trigger CAN bus-off state
Yes, this is the intended behavior of the CAN 2.0B protocol to prevent a unconnected transmitting node from putting itself into a BUS OFF state due to lack of acknowledgement.
For specifics, see the CAN 2.0B specification (Fault Confinment - Rule 3 and its exceptions):
For specifics, see the CAN 2.0B specification (Fault Confinment - Rule 3 and its exceptions):
3. When a TRANSMITTER sends an ERROR FLAG the TRANSMIT ERROR COUNTER is increased by 8
Exception 1: If the TRANSMITTER is 'error passive' and detects an ACKNOWLEDGEMENT ERROR because of not detecting a 'dominant' ACK and does not detect a 'dominant' bit while sending its PASSIVE ERROR FLAG
Re: Unable to trigger CAN bus-off state
Thank you for pointing out that exception!
I guess I will just disable the bus error alert when this happens to avoid being flooded and preserve the messages, but I tried to abort the transmission when (bus error && TEC is >=128) and I just saw that after calling can_abort_tx() I get a CAN_ALERT_TX_SUCCESS.
Shouldn't that be a CAN_ALERT_TX_FAILED?
I guess I will just disable the bus error alert when this happens to avoid being flooded and preserve the messages, but I tried to abort the transmission when (bus error && TEC is >=128) and I just saw that after calling can_abort_tx() I get a CAN_ALERT_TX_SUCCESS.
Shouldn't that be a CAN_ALERT_TX_FAILED?
Re: Unable to trigger CAN bus-off state
Not sure which driver you are using. ESP-IDF CAN driver doesn't contain a can_abort_tx(). Regardless, when setting the abort TX bit of the command register, the TX Successful bit will always be set to 1.jbreva wrote: I tried to abort the transmission when (bus error && TEC is >=128) and I just saw that after calling can_abort_tx() I get a CAN_ALERT_TX_SUCCESS.
If you are trying to achieve hot plugging, why not initially set the mode to NO ACK so that no acknowledgement is needed. After the ESP32 successfully receives a message (meaning another node is now on the bus), just reconfigure it to the normal operating mode. See the CAN Network Example for more details.
Re: Unable to trigger CAN bus-off state
Oops, my bad.
I modified the driver to implement the CMD_ABORT_TX defined here https://github.com/espressif/esp-idf/bl ... /can.c#L71 following your function name style while doing some tests a few weeks ago, but I just got back from holidays and thought it had always been there
Seems a bit weird to me that aborting a TX should raise a success instead of a failure, but anyway since the abort is not available in the IDF (is this PR worthy?) I will explore your suggestion with the NO ACK
Thank you very much for your time!
I modified the driver to implement the CMD_ABORT_TX defined here https://github.com/espressif/esp-idf/bl ... /can.c#L71 following your function name style while doing some tests a few weeks ago, but I just got back from holidays and thought it had always been there
Seems a bit weird to me that aborting a TX should raise a success instead of a failure, but anyway since the abort is not available in the IDF (is this PR worthy?) I will explore your suggestion with the NO ACK
Thank you very much for your time!
Who is online
Users browsing this forum: Google [Bot], MicroController and 91 guests