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.

Compiler/TMS570LS3137: tps65381-TMS570

Part Number: TMS570LS3137
Other Parts Discussed in Thread: TMS570LS0432

Tool/software: TI C/C++ Compiler

Hello

 When I  use tps65381 connect with tms570ls0432,I found 

program stay here “while (ecmpIfGetRegister(ECMP_SAFETY_STATUS5) != 7);”

unsigned short ecmpIfGetRegister(unsigned short reg)
{
unsigned short command = ecmpIfCOMMAND[reg].Read;
unsigned short value = 0;

spiREG2->DAT1 = 0x04FE0000 | command;
while((spiREG2->FLG & 0x100)!=0x100);
value = (spiREG2->BUF) & 0xFF;

return value & 0xFF;
}

 return 7

why?

this is my configure

  • Hello Whong,

    You got the returned value: 7, which means there is no issue with the SPI communication. The TPS65x is in diagnostic state (7). 

    The code should not get stuck at this location since the returned value = 7:

    while (ecmpIfGetRegister(ECMP_SAFETY_STATUS5) != 7); 

  • sorry

     return 4 .

    I said wrong

  • whong zhao said:

    sorry

     return 4 .

    I said wrong

  • Thank you 

    Now my program can run, but the watchdog doesn't work.

    void rtiNotification(uint32 notification)
    {
    /* enter user code between the USER CODE BEGIN and USER CODE END. */
    /* USER CODE BEGIN (9) */
    uint16_t WdgFailCount;
    switch(notification)
    {
    case 4:
    switch (WDWindow)
    {
    /** send three answers during open window */
    case ECMP_WINDOW_OPEN :
    WdgFailCount = ecmpGetWdgFailCount();
    if(WdgFailCount == 0)
    {
    switch (Curr_Sta)
    {
    case 0:
    if(ecmpEnableWdg()) Curr_Sta++;
    ecmpLockRegisters();
    break;
    case 1:
    Curr_Sta++;
    break;
    default:
    break;
    }
    }

    //

    WdgFailCount = ecmpGetWdgFailCount();      I Set breakpoints, WdgFailCount=7

    but my program can run regular.the watchdog doesn't work.

     

  • void InitWatchDog(void)
    {
    uint16_t OPEN_WINDOW_CONFIG = 40U;
    uint16_t CLOSE_WINDOW_CONFIG = 15U;

    // _mpuInit_();
    // spiInit();
    ecmpInit();

    if(ecmpIfGetRegister((uint16_t)ECMP_SAFETY_STATUS5) != 7U)
    {
    /*TPS65381 does not stay in diagnostic state.*/
    while(1)
    { /*do nothing*/}
    }
    ecmpWdgWindowConfig(OPEN_WINDOW_CONFIG, CLOSE_WINDOW_CONFIG);
    TrgPulseOpen = ((uint32_t)OPEN_WINDOW_CONFIG*1000u)/2u;
    TrgPulseClose = (((uint32_t)OPEN_WINDOW_CONFIG*1000u)/2u) + (((uint32_t)CLOSE_WINDOW_CONFIG*1000u)/3u);
    /* select desired WD mode - time in mu seconds */

    rtiEnableNotification (rtiNOTIFICATION_COMPARE2);

    WDWindow=ECMP_WINDOW_OPEN;/*watchdog window is open.*/
    rtiREG1->CMP[2U].COMPx = TrgPulseOpen;/*write to the open window in the middle of Topen*/
    rtiREG1->CMP[2U].UDCPx = TrgPulseClose;/*write to the close window at 1/3 of Tclose*/
    rtiStartCounter(rtiCOUNTER_BLOCK1);

    return ;
    }

  • void ecmpInit(void)
    {
    while (ecmpIfGetRegister(ECMP_SAFETY_STATUS5) != 7);

    /* Stay in Diagnostic State and configure SAFETY_CHECK_CONTROL register */
    ecmpIfSetRegister(ECMP_SAFETY_CHECK_CONTROL, 0x17);

    ecmpIfSetRegister(ECMP_SAFETY_FUNCTION_CONFIG, 0xE4);

    /* Clear Status Innformation */
    ecmpIfGetRegister(ECMP_VMON_STATUS1);
    ecmpIfGetRegister(ECMP_VMON_STATUS2);
    ecmpIfGetRegister(ECMP_SAFETY_STATUS1);
    ecmpIfGetRegister(ECMP_SAFETY_STATUS2);
    ecmpIfGetRegister(ECMP_SAFETY_STATUS3);
    ecmpIfGetRegister(ECMP_SAFETY_STATUS4);
    ecmpIfSetRegister(ECMP_SAFETY_ERROR_STATUS, 0x00);
    }

  • I found the tps65381  always ecmpIfGetRegister(ECMP_SAFETY_STATUS5) = 7;

    I already delete 

    ecmpSendWdgAnswer();
     ecmpSendWdgAnswer();
    ecmpSendWdgAnswer();

      but  the tps65381 always ecmpIfGetRegister(ECMP_SAFETY_STATUS5) = 7;

  • The issue has been solved in another thread.