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.

RTI watch dog #TMS570LC43x

#TMS570LC43x

I want to set a RTI watchdog for my program. 

//////////////////////////

after initializing, 

rtiStartCounter(rtiREG1, rtiCOUNTER_BLOCK1);

dwdInit(rtiREG1, RTICLK/10);

dwdCounterEnable(rtiREG1);

1, Do I need to test the status of watchdog? such as

while(1){

if(~IsdwdKeySequenceCorrect(rtiREG1))

dwdGenerateSysReset(rtiREG1);

}

or watchdog will automatically reset the program?

2, how should I reset the watchdog every time? I think this maybe ok, but I don't know how to set COMPARE2  

void rtiNotification(rtiBASE_t *rtiREG, uint32 notification)
{
if(rtiREG == rtiREG1 && notification == rtiNOTIFICATION_COMPARE2)
dwdReset(rtiREG1);

}

 

thanks

  • HI,

      Once you enable the digital watchdog you will need to write the proper key within the window of RTICLK/10. If you don't write the key then by default the watchdog will automatically reset the device. 

      You will use dwdReset() API to write the key so that the reset does not generate. See below code the dwdReset() simply writes two back to back keys to the WDKEY register. When proper key is written the watchdog counter will restart from its preload value and down count again. You must write proper key before the watchdog counter down count to 0. The proper key is a 0xE51A followed by 0xA35C. This is described in the RTI module userguide.

    void dwdReset(rtiBASE_t *rtiREG)
    {
    /* USER CODE BEGIN (26) */
    /* USER CODE END */
    rtiREG->WDKEY = 0x0000E51AU;
    rtiREG->WDKEY = 0x0000A35CU;
    /* USER CODE BEGIN (27) */
    /* USER CODE END */
    }

    If you want to intentionally generate a reset you can write incorrect watchdog key by calling the dwdGenerateSysReset(). See below. Here you see that the second key is intentionally written incorrectly with the value of 0x2345.

    void dwdGenerateSysReset(rtiBASE_t *rtiREG)
    {
    /* USER CODE BEGIN (28) */
    /* USER CODE END */
    rtiREG->WDKEY = 0x0000E51AU;
    rtiREG->WDKEY = 0x00002345U;
    /* USER CODE BEGIN (29) */
    /* USER CODE END */
    }

      

  • Thanks very much for your answer.
    There is also something I don't understand.
    The RTI has 2 independent counters and 4 compares. However in the dwd init, we don't associate it with some certain counter. Then if I start two counters both, which one should I reset for dwd? Because I need another for timing.
    Thanks
  • Hi,

     The watchdog uses its own counter. It does not use the counters dedicated for compares. You can use the two counters and 4 compares for your regular timer use. See below diagram from userguide. The DWD uses its own counter called RTIDWDCNTR. The counter is preloaded with the watchdog timer value. It then starts to down count when you enable. You need to write the proper keys to prevent the RTIDWDCNTR from reach 0 or otherwise a watchdog reset will trigger.

  • Thank you very much. It is of great value.
  • Hi,
    Glad that it is clear to you now.