This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28335 - Manual CAN Bus Recovery after Bus Off

Hi all,

Please bear with as I am not a native English speaker and the following post may not be the easiest to read.

I am currently overhauling a CAN bus off recovery implementation based on the auto bus on recovery (CANMC.ABO) in one of our projects.

Due to some specification changes a specific timing for the bus recovery and hence also for the restart of the CAN transmission is required. This makes using the automatic configuration impossible. Basically the automatic bus on recovery is too fast.

I would like to stick to the using CANMC.ABO implementation, but I so far I found no way to indicate to the application software that an automatic bus on has occurred. As a result I started to check the manual bus recovery.

In my understanding of the bus off detection according to "SPRUEU1" for this Controller the CANTEC will increase in case off bus off passing various error levels (EW & EP) before finally at reaching a CANTEC counter value of 256 trigger a Bus off and flagging this state using CANES.BO and CANMC.CCR for the appropriate CAN bus.

Once the bus off state is reached the CANREC counter will provide the information if the CAN bus is once more ok. Unfortunately I find the description in  "SPRUEU1" for what circumstances cause the change of meaning for the CANREC counter rather ambiguous. What is considered to be the “bus off state”? Is it required that CANES.BO is set to 1 or is it required that CANMC.CCR bit is set to 1 or are both bits required to change the function of CANREC to counting recessive bits?

In my understanding in a bus off state once the CANREC counter has reached 128 the bus can be considered ok and a manual bus on by setting the CANMC.CCR to 0 can be considered safe.

So far during my implementation and testing, although the bus off condition is applied continuously (CAN High and CAN Low are shorted), the CANES.BO is first set to 1 and the CANMC.CCR is set to 1, but somehow the CANES.BO is reset to state 0 without performing any manual bus on (and CANMC.ABO == 0). So far I haven't found any code line writing to the CANES register.

When the bus off condition is removed (CAN High and CAN Low are no longer shorted) I never found the CANREC counter to be set to a different values as 0. As a result I do not know when to perform the manual bus on and restart sending.

Is my understanding of the mechanics for recognizing the bus off state and also for recognizing the bus on condition correct? Any idea for why the CANES.BO changes its value or how to get the information to start the manual bus recovery?

Thanks for reading this rather long post. I'd tried my best to describe my problem as on point as possible.

  • Carlo,

    The CCR bit is a reliable indicator of the node having entered the bus-off state. If that is bit is set, the node is in bus-off. Once this state is reached, CANREC indeed changes its function (to counting 11-bit recessive times to 128). You are correct that once this has been monitored, it is safe to clear CCR and come out of bus-off. Are you sure BO bit is indeed set to 1 upon bus-off but gets cleared automatically without the code writing to CANES register?

  • Hi Hareesh,

    Thank you for your reply. 

    To the best of my knowledge I have disabled every write access in the application software to the CANES register. When the Bus Off occurs I do see the EP & EW flags beeing set and those flags are also not reset. With the BO flag this is however different.

    With regard to the CCR Bit:

    I have checked that once the bus off occurs the CCR Bit of the matching bus is set continuously. However, when the bus off condition is removed the CANREC counter does not change its value although the CCR Bit is still set permanently. Other nodes on the same bus also resume their normal operation. Therefore I assume that the bus is in fact ok.

    On doing a manual reset of the CCR Bit for my bus, despite the current state of CANREC for my bus (is still 0), my node also recovers and operates normally. Unfortunately with this setup I cannot match the required timing for the bus recovery, since I am missing the reference point for when the bus actually changed to operational state.

    Best case for me would still be to use the original ABO bit for the bus recovery. Is there any indication from the CAN Controller when it has performed a bus on due to the Bit ABO? In this case I could adapt the recovery of the CAN sending of the application based on such indication to match the required timing.

    Best regards.

  • Carlo,

                How many nodes are there on your network? When the F28335 goes bus-off, what do the other nodes on the network do?

     

    You say "when the bus off condition is removed the CANREC counter does not change its value although the CCR Bit is still set permanently." When the bus-off condition is removed, CCR should get cleared automatically (if ABO=1). I also don’t understand what you mean by "CANREC counter does not change its value ". Please read the excerpt from the module spec below:

     

    After reaching the „bus off“ state the transmit error counter is undefined while the receive error counter changes its function. After reaching the state „bus off“, the receive error counter is cleared. It will then be incremented after every 11 consecutive recessive bits on the bus. These 11 bits correspond to the gap between two telegrams on the bus. If the counter reaches the count 128, the module changes automatically back to the status „bus on“ if this feature is enabled (Auto Bus On bit (ABO) in Master Control Register (MCR) set.). All internal flags are reset and the error counters are cleared.

     

    Per the last statement, BO bit is cleared and CANREC is made 0 upon exiting the bus-off condition.

     

    Regarding your last question " Is there any indication from the CAN Controller when it has performed a bus on due to the Bit ABO? ", you should see the CCR bit cleared upon exiting bus-off. You could poll the CCR bit to determine the moment when the node exits bus-off.

  • Hi Hareesh,

    I hope you had a nice weekend.

    The current configuration of the ABO bit is ABO = 0 and therefore "manual" bus on. 

    What I referred to by "when the bus off condition is removed the CANREC counter does not change its value although the CCR Bit is still set permanently." is, that the even though the CCR bit is still active (after a bus off occurred),  the ABO bit is set to 0 and the bus off condition removed the CANREC counter is not incrementing. It always stays at CANREC = 0 (no manual bus on was done).

    As I understand your first reply "If that is bit is set, the node is in bus-off. Once this state is reached, CANREC indeed changes its function (to counting 11-bit recessive times to 128)." I am expecting to see an incrementing CANREC counter. For the above described configuration.

    With regard to my second question "Is there any indication from the CAN Controller when it has performed a bus on due to the Bit ABO?" As far as I have tested it the CCR bit is not active during bus off when the ABO bit is set to 1. In  "sprueu1" the description for the CCR states: "The CCR bit will also be set upon a bus-off condition, if the ABO bit is not set." So I wasn't expected to see any change in the CCR bit when ABO = 1 during bus off/bus on recovery.

    That’s why I was asking, if there is any indication for a state change of the controller due to the ABO = 1 configuration.

    To answer your questions: “How many nodes are there on your network? When the F28335 goes bus-off, what do the other nodes on the network do?

    For my testing (this is only a bench test setup) the CAN consists of three different nodes: my test system, a vector CAN case for monitoring the messages and a third CAN node based on the SJA1000. 

  • What I referred to by "when the bus off condition is removed the CANREC counter does not change its value although the CCR Bit is still set permanently." is, that the even though the CCR bit is still active (after a bus off occurred), the ABO bit is set to 0 and the bus off condition removed the CANREC counter is not incrementing. It always stays at CANREC = 0 (no manual bus on was done).

     

    Answer--> Once the bus-off condition is removed, why would CANREC increment? Are you expecting to see it at 128? I am suspecting it is cleared to 0 after counting up to 128, but the node itself does not participate in any communication until CCR is cleared to 0.

     

    As I understand your first reply "If that is bit is set, the node is in bus-off. Once this state is reached, CANREC indeed changes its function (to counting 11-bit recessive times to 128)." I am expecting to see an incrementing CANREC counter. For the above described configuration.

     

    Answer--> Please clarify "incrementing". The incrementing and subsequent clearing happens at a speed that is not observable by the human eye. Did you try taking a snapshot of the register and filling a memory buffer?

     

    Perhaps we have reached a stage where a conference call may be better. I have a feeling I have not understood your concern well.

  • Carlo,

    I wrote a test-case to verify this and I am able to see the CANREC counter increment correctly. I filled the CANREC values in a buffer. After CANREC counts 128 occurrences, it is reset to "0". CCR bit still stays as 1. Node comes out of bus-off when it is cleared.