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.

How to leave the diagnostic state of TPS65381

Hi All,

I already posted one message in Automotive forum but I did not found how to transfer it from there... I guess this would be better to handle it from here.

I am using the Companion Chip TPS65381 with a RM46L852 device.

RM46 flash memory contains two software: a boot program launched when the MCU starts-up and an applicative.

The boot program performs some initialization for both the MCU and the Companion Chip, then performs some applicative consistency checks and finally configure the TPS to leave diagnostic state (by setting to 1 DIAG_EXIT bit and to 0 DIAG_EXIT_MASK of CHECK_CTRL TPS register).

My issue comes when I try to leave the DIAGNOSTIC mode. First I set to 1 DIAG_EXIT_MASK bit in safety control register and then I reset to 0 the value of DIAG_EXIT bit of same register.

I used the function called ConfigureSafetyCheckControl from the SAFE TI library; my code is as follow

blRetVal = TPS_ConfigureSafetyCheckControl(DIAG_EXIT_MASK, FALSE);
blRetVal = ((TPS_ConfigureSafetyCheckControl(DIAG_EXIT, TRUE) && blRetVal);


I compared this code with the one provided in SAFE TI library about exiting the diagnotic mode; SAFE TI library is as follow:

blRetVal = TPS_ConfigureSafetyCheckControl(DIAG_EXIT_MASK, FALSE);
blRetVal = ((TpsIf_SetRegisterBitField(TPS_SAFETY_CHECK_CTRL, BF_DIAG_EXIT_START, BF_DIAG_EXIT_LENGTH, (uint8)1U)) && blRetVal);

I ported the SAFE TI code into my software and this works as it should.

But what is the difference? Why does the SAFE TI lib not use two times the ConfigureSafetyCheckControl function?

Hope you can help.

Thanks by advance !!

PS: I paid attention to set to true DIAG_EXIT_MASK less than 600ms after the power up to ensure that the TPS is in DIAGNOSTIC mode.

I also paid attention to clear error counters and flags prior to try reaching the ACTIVE mode.

  • Hi Jules,
    I will forward your question to the Safe TI lib team.
  • Hi Jules,

    The difference is that in case of SafeTI Lib code, we are bypassing the checking of TPS Driver state when setting the DIAG_EXIT bit to 0. We wanted to set the diag exit bit and did not want to check whether we are in diagnostic state. Hence we use the API "TpsIf_SetRegisterBitField" which does not check whether we are in diagnostic mode. Moreover, the time which the API "TPS_ConfigureSafetyCheckControl(DIAG_EXIT_MASK, FALSE)" takes is more since it first does a TPS state request and then based on the state of the TPS device it decides to set/clear the safety_check_control register. The APIs of TPS driver library have been tested and optimizied to meet the timing requirements of the TPS device.

    What's the issue that you are facing when using the API TPS_ConfigureSafetyCheckControl instead of TpsIf_SetRegisterBitField? The cause would likely be the time taken by API in making the TPS exit diagnostic state. I think the call “blRetVal = ((TPS_ConfigureSafetyCheckControl(DIAG_EXIT, TRUE) && blRetVal);” is resulting in FALSE. Did you check the return value of the API?

    Hope that helps,
    Regards
    Vivs
  • Hi Vivs,


    First of all thanks for your anwser.

    You are right, I got a false return value when I set the DIAG_EXIT command because of the TPS state which is not equal to DIAGNOSTIC.

    But what I can't understand is WHY? Resetting the DIAG_EXIT_MASK does not make the TPS leave the DIAGNOSTIC state as far as I can understand the TPS specification. As per my understandings, this would only say that the DIAG_EXIT bit is not masked anymore and that as soon as DIAG_EXIT will be set to 1, the TPS will enter the ACTIVE state. Am I wrong?

    Jules

  • Note: As suggested in the the Datasheet the diag_exit_mask is a debug feature and  is not supposed to be used in production.

    We will try to debug this behavior at our end and get back to you by tomorrow.


  • Hi Jules,

    Thanks for waiting.We have been discussing this  behavior with the TPS team.The TPS team has started testing this behavior.We may need  some more time to reason this behavior.

    Meantime you  can clear the  bits DIAG_EXIT_MASK, and set the bit DIAG_EXIT in a single write(and not use multiple register writes).As suggested in the TPS spec usage of the DIAG_EXIT_MASK is not suggested to be used in a production code.

    We will come back to you on this as soon as we have more information.

    Regards

    Manoj 

  • Hi

    Any update on this topic?
    Thanks,

    Jules
  • Hi Jules,

    I've requested a follow-up with our safeTI diagnostic software team on this topic. They should get back with you soon.
  • Hi,

    The older datasheets of TPS65381 did not cover this behavior. Now the latest TPS65381 datasheet dated May  2016 -  section 5.4.1.23 (check the note part) clearly captures this behavior and it is recommended that the bits DIAG_EXIT and DIAG_EXIT_MASK be changed using a single SPI write. I hope this answers this query. Please mark this forum query as answered if your problem is resolved.

    Regards

    Manoj

  • Hi Jules,

    In addition to making sure if you were using DIAG_EXIT_MASK that it is cleared in the same SPI write command that DIAG_EXIT is set. There is the DIAGNOSTIC state time out that you mentioned, so if you do not either use DIAG_EXIT to stay in DIAGNOSTIC state or DIAG_EXIT to go to ACTIVE state before DIAGNOSTIC state time-out occurs (512ms is a better number to use than 600ms) you will end up in SAFE state. Also, you need to make sure while in DIAGNOSTIC state, the MCU must clear the ERROR_PIN_FAIL bit and the WD_FAIL bit in the SAFETY_ERR_STAT register before setting the DIAG_EXIT bit. Otherwise, a transition to SAFE state occurs (outlined in DS section 5.4.1.24). You can see these visually outlined on the state diagram in section 5.4.1.20.

    Hopefully this helps.

    Scott