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.

TMS320F28388D: CAN TEC reports 248 in Bus Off Mode instead of greater than 255

Part Number: TMS320F28388D

Dear Sir/Madam,

TEC counter value in CAN controller reports as 248 while CAN controller goes to Bus-Off Mode. However, I am expecting the value could be more than 255.

Could you please let me know in case I am missing something.

Thanks in Advance,

Abhijit 

  • Abhijit,

         After reaching the BO state, TEC is undefined. Depending on how/when you capture the value of TEC, you may not be able to see it actually hit 255. Exactly how do you generate the BO condition? Have you looked at www.ti.com/lit/spracq3? 

  • Thank you for your inputs.

    In controller, every 10ms, I read TEC register irrespective of CAN mode.  I could see the value is getting increased from 0 to 248. Once it reaches to 248 the count stops. However, the program still continue reading the TEC registers.  

    I am generating the BO condition by stopping the bus. To display the TEC value in the desktop I am using NI Max library which executes in 40ms. Every 40ms it displays the value in the desktop.  I am currently not using LAB View.

  • The error counter behavior is defined by the CAN protocol spec. It has to be exactly the same across any MCU featuring the CAN module. Besides, our CAN module has been conformance tested to ensure the behavior is as per the protocol spec. 

    In the case of your experiment, there could be a problem in synchronizing the moment a node goes BO and your code reading TEC. This is not a silicon issue. You can try reading faster. However, you may not be able to read at the precise moment a node goes BO.

  • I have updated the code to read the CAN module status at 50us. Still I could see the TEC value still set at 248. I was expecting by the time the BOff is true then the value of the register would be 256. Looks like the bus off is getting set in error passive state only.  

  • Like I explained before, the status of TEC is undefined once the node enters BO. It could be that your code is not reading TEC at the precise moment it hits 255. Depending on how you generate the BO condition, I don't know if it is even possible to read the TEC to be 255.

    he value of the register would be 256

    It is a 8-bit register, with a max value of 255.

    Looks like the bus off is getting set in error passive state only

    No. That is not what the protocol spec specifies.

    Exactly what are you trying to do? i.e. what is the objective of your experiment?

  • As you mentioned "status of TEC is undefined once the node enters BO" - to clarify my doubt/understanding, is this means whatever value I am reading (i.e. 248) is the last value read from the controller before the controller goes to BO. Once the node enters into BO and the TEC value is undefined, then if I read the TEC counter value I will get the same value read i.e.248 in my case.

    "what is the objective of your experiment?"

    I am using the controller for the Aerospace program. Where I am trying to create a CAN Bus Off scenario. I was able to make the controller go to bus off mode. The experiment that I am trying is to make sure whatever TEC value I am Reading is Correct. 

  • is this means whatever value I am reading (i.e. 248) is the last value read from the controller before the controller goes to BO

    Yes.

    then if I read the TEC counter value I will get the same value read i.e.248 in my case.

    No. TEC is now undefined.

    What you could do is to copy (in a tight loop) the TEC value into a variable and then examine the variable, whos value will be undisturbed by the node going into BO.

    I am still not clear on exactly how you generate a BO condition. 

  • I am generating BO condition by physically removing the CAN bus. 

  • Please clarify what you mean by "physically removing the CAN bus". If you are making a node go BO by "human activity", you cannot precisely control the instant at which the node enters BO (and hence cannot capture the TEC value at a chosen precise time). This is the reason we developed the tool outlined in www.ti.com/lit/spracq3

  • We are using relay switch to make a node to go BO. I shall go through this spracq3. Currently we are using NI Max software for the CAN data verification.

  • What you could do is to copy (in a tight loop) the TEC value into a variable and then examine the variable, whos value will be undisturbed by the node going into BO.

    Please try the above method.

  • Sure. I am trying to make the setup available to tryout this method. It might take couple of days to try out this method. I shall reach you once I try this out.

  • Abhijit,

                    I got some update on this from the design group. According to the CAN protocol spec, bus-off is entered only when TEC>255 (“If the transmit error counter of a node is greater than 255 (carry condition in case of a 8-bit transmit error counter) then the supervisor shall request the Physical Layer to set the node into the bus-off state.”). 

    The Transmit Error Counter TEC is 8 bits wide, therefore it has a range from 0 to 255 (0x00 to 0xFF). 

    When the TEC is in the range from 248 to 255 and there is a further error condition that would require an increment by 8, this increment would result in a value > 255, which would be an overflow (=carry) condition. So, in this case, instead of incrementing the TEC, only the Bus-Off flag is set. 

    For example, let’s say there is one increment of the TEC from 240 to 248, which is followed by another error. This does not change the TEC, but sets the Bus-Off flag. Afterwards, the DCAN is in bus-off state as specified by ISO 11898-1. So, one cannot expect the TEC to increment to 0xFF and use that event to determine bus-off condition.