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.

CCS/TPS65381A-Q1: SAFETY_FUNC_CFG Register can not be written

Part Number: TPS65381A-Q1
Other Parts Discussed in Thread: TMS570LS0714,

Tool/software: Code Composer Studio

Dear E2E,

Recently, I have tried to initialize the TPS65381 register. But I found the SAFETY_FUNC_CFG register can not be written.The mcu I use is TMS570LS0714. It is so strange! Following is my test case:

(1) First, I have tried to write the values to SAFETY_ERR_PWM_H.

From above pictures, I think I have written the value to SAFETY_ERR_PWM_H. The value has been changed from 0xFFu to 0x0A. And this register can only be write in Diagnostic state and the write access is not locked.So I think spi communication and my test code is good.

(2) Then, I have tried to write the values to SAFETY_FUNC_CFG.

From above picture and test case 1, I think TPS is stay in diagnostic state and the write access is not locked. But I don't know why the SAFETY_FUNC_CFG can not be written. Is there any more limits in this register? What should I do if I want to write value to this register.

Maybe it is something wrong to my hardware. But when I test another two hardwares, the test result is the same.What do you think of these phonemenon? Or there is something wrong in my test code?

I am looking forward to your advice. Thanks!

Best Regard,

Yu Chen

  • Hi Yu Chen,

    The SAFETY_FUNC_CFG register is protected by the configuration CRC feature of the TPS65381A.

    There are other registers protected by configuration CRC, including SAFETY_ERR_PWM_L, but apparently SAFETY_ERR_PWM_H is excluded from this protection.

    I have looped in the device expert to continue the discussion for typical write sequences to these registers.

    Best Regards,

    Rick S.

  • Yu,

      It may be that you are going to the SAFE state because the DIAGNOSTIC State Time out is happening before you are writing those registers.

    Unfortunately on this device there is no software command way to go back to DIAGNOSTIC state from SAFE state without going through RESET state.

    During debug, before enabling reset from watchdog failures, maybe you can try the following minor change to configuration:
    1) staying in DIAGNOSTIC state for debug via the DIAG_EXIT_MASK bit (1) and cleared (DIAG_EXIT bit 0). Makes sure you are writing both of those to the intended states in one SPI write into the register to avoid some issues.
    2)Then work on the watchdog code while WD_RST_EN = 0, so the WD_FAIL bit will set but the device will not cause RESET which is likely then leading to SAFE state while debugging. You can tell if the watchdog code is stable by enabling the ENDRV (safing output) with the ENABLE_DRV bit. Once the watchdog code is stable and holds the watchdog failure counter (WD_FAIL_CNT) < 5, the ENDRV pin will go high. 3) Once this is debugged you can try setting WD_RST_EN to 1 and see if the device remains in DIAGNOSTIC state as expected.

    Then try to write SAFETY_FUNC_CFG register.

    Let me know how this works for you.

  • Hello Gordon,

    Thanks for your reply !

    I am sure that TPS is stay in Diagnostic state because the test I done is in the debug mode. 

    From the suggestions you given, I revise my test case. Maybe it can be more clearly to express my problem.

    1. The test code:

    (1) Tps is set to debug mode

     The debug mode I set is in the initial task. I am sure it can be run before 500ms.

    (2) The test result will be watched by CAN

    From above picture, I wrote the values to SAFETY_FUNC_CFG and SAFETY_ERR_PWM_L register. These two registers are all protected by CRC and they can only be written in diagnostic mode. And I have saved the values to the array of u8tpsRegArr. And this array will be sent out by CAN.

    u8tpsRegArr[0] : the state of tps

    u8tpsRegArr[1]: the value read from SAFETY_FUNC_CFG before writing

    u8tpsRegArr[2]: the value read from SAFETY_FUNC_CFG after writing

    u8tpsRegArr[3]:the value which will be written to SAFETY_FUNC_CFG

    u8tpsRegArr[4]:the value read from SAFETY_FUNC_CFG after writing

    u8tpsRegArr[5]:the value read from SAFETY_ERR_PWM_L before writing

    u8tpsRegArr[6]:the value read from SAFETY_ERR_PWM_L before writing

    2. Test result from CAN

     From above picture, u8tpsRegArr[0] = 0x7, u8tpsRegArr[1] = 0x00, u8tpsRegArr[2] = 0x00, u8tpsRegArr[3] = 0x01, u8tpsRegArr[4] = 0xE1, u8tpsRegArr[5] = 0x01, u8tpsRegArr[6] = 0x0A

    We can find that the tps is stay in diagnostic state. And the register of SAFETY_FUNC_CFG  can be written, but the register of SAFETY_ERR_PWM_L can not be written. It is so stange!

    Could you give me some advice for these problem? Should I do more tests for you to analyze this problem? And the register of SAFETY_FUNC_CFG is important for us to write. 

    I am looking forward to your advice. Thanks!

    Best Regards,

    Yu Chen

  • Hello Richard,

    Thanks for your reply!

    I have checked the reason of CRC protection. And the test result you can see in my another reply!

    If you have any good ideas, please feel free to contact me. Thanks!

    Best Regards,

    Yu Chen

  • Hi Yu,

    I do not think this has anything to do with the CRC since that is only a diagnostic feature after the device has been configured and will not impact the writing of this register. 

    If you are using a debugger with the MCU, it is likely no working in real time and therefore as Gordon pointed you, you are likely having the TPS65381A-Q1 go through it's DIAGNOSTIC state timeout (if the device isn't configured and transitioned to ACTIVE state by setting DIAG_EXIT bit to 1 before this timeout or the TPS is held in DIAGNOSTIC state by setting the DIAG_EXIT_MASK bit to 1 before this timeout) the device will transition to SAFE state.  (DIAG_EXIT and DIAG_EXIT_MASK bits are in the SAFETY_CHECK_CTRL register)

    Please read the FSM[2:0] bits in SAFETY_STAT_5 register to confirm what state the TPS is in.  DIAGNOSTIC state is 07h. 

    You may have to post to the TMS570 forum for help in how to use a bootloader of the debugger to set the DIAG_EXIT_MASK bit fast enough in the TPS once the TPS has powered up to avoid it transitioning to SAFE state due to DIAGNOSTIC state timeout.

  • Hi Scott,

    Thanks for your reply!

    Sorry, maybe I don't express clearly. I have taken the advice from the Gordon. I have revised my test case and have sent the test result to Gordon. If you have a minute, could you see the messsage that I replied to Gordon yesterday?

    (1) I have kept the Tps stay in diagnostic state in the initial task before the tps transition to safety state.

    (2) I do not use debugger to watch the variables got from SAFETY_ERR_PWM_L and SAFETY_FUNC_CFG. Instead I use can transceiver to send the variables to the can message window. And the variables will be watched every 1ms. In this way, I can watch whether these two registers can be written and the state of tps.

    (3)From the test result, I am sure the SAFETY_ERR_PWM_L can be written in the diagnostic state, but SAFETY_FUNC_CFG can not. I don't know why SAFETY_FUNC_CFG can not be written in the diagnostic state.Could you give me some advice of these problem?

    Best Regards,

    Yu Chen

  • Yu Chen,

      I am working on this, but do not have your answer yet. I will get back to you soon.

  • Hi Yu Chen,

    We just wanted to follow up with your question and see if this is still an open issue for you? Gordon is currently out of office and will not be able to address this until he gets back and we wanted to let you know that your question is not falling through the cracks.

    Thank you,

    Jadyn

  • Hi Jadyn,

    Thanks for your reply!

    To be honest, I did not solve this issue.  And I can not read the value of SAFETY_FUNC_CFG register correctly. I don't know the reason. Following is the question I want to ask.

    (1) From your side, can you reproduce this issue? If not, I think maybe there is something wrong with my chip. Or is there anything wrong with my code?

    (2) Is there any tests I can do? Maybe it can help you know my issue clearly or find my problem.

    Best Regards,

    Yu

  • Hi Yu,

    We are the PMIC team supporting the device and not the MCU team supporting the code composer studio, software or diagnostic library. I have just put the EVM on my bench and successfully written SAFETY_FUNC_CFG and SAFETY_ERR_PWM_L (and SAFETY_ERR_PWM_H) while the TPS65381A-Q1 is in DIAGNOSTIC state and the registers are UNLOCKED.  I have also changed the SAFETY_CHECK_CTRL to enable and disable the MCU ESM via the NO_ERROR bit and have changed the MCU ESM configuration between TMS570 mode and PWM mode via the SAFETY_FUNC_CFG register.  In all cases I can read and write these registers plus the SAFETY_ERROR_PWM_L and H registers. 

    There is an issue in the software or the device is not staying in DIAGNOSTIC state with the registers un-locked (maybe transitioning to SAFE state).

    Do you have issues reading or writing any other registers?  Maybe the command code for the SAFETY_FUNC_CFG read command is bad in your header file or other code structure if it is only this one register that has an issue. 

       

  • Hi Yu,

    One other point you could check in the software with respect to DIAGANOSTIC state is to make sure if you are setting or clearing the DIAG_EXIT_MASK bit and/or the DIAG_EXIT bit in the SAFETY_CHECK_CTRL register that you write the combination of those two bits you want at the same time and not sequentially.  That will help make sure if you are intending to stay in DIAGNOSTIC state there is no time where the DIAGNOSTIC state time out timer could re-start running and cause a transition to SAFE state.