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 enable watchdog timer on 6431?

Dear Sir,

I try to enable the watchdog timer on my 6431 platform, but it doesn't work.

I find a article in the community, and it says watchdog timer is not available on DM648.

http://e2e.ti.com/forums/t/1287.aspx

Does watchdog timer function work in 6431? How can I enable it?

Following are the code I write:

void initDSPWatchDog(void)
{
 TIMER2_TGCR  = 0x0B; // Set watch dog timer more

 TIMER2_TIM12 = 0;// clear count
 TIMER2_TIM34 = 0;

  TIMER2_PRD12 = 0x600000;// around 20 ms
  TIMER2_PRD34 = 0x600000;

  CFG_TIMERCTL = 0x01;// WatchDog Timer Event (WDINT from Timer2) causes a device max reset

 TIMER2_WDTCR = 0x4000;// Watch dog enable
}

void resetDSPWatchDog(void)
{
 TIMER2_WDTCR = 0x0000;// Watch dog disable

 TIMER2_TIM12 = 0;// clear count
 TIMER2_TIM34 = 0;
 
 TIMER2_WDTCR = 0x4000;// Watch dog enable
}

Thank you for your help in advance.

Best Regards,

 

Eric Fang

 

  • You need to read chapter 3 in spru989 to get information about the watchdog.

  • I have not seen any notices in the errata or elsewhere suggesting that the watchdog timer will not actually reset the device. If you are experiencing otherwise we can investigate, but as Matt suggests you should read spru989 section 3 for more information on the watchdog.

  • Dear Sir,

    I had already studied the spru989, and based on the spec, I wrote the code. 

    But the watch dog just didn't reset.

    Is there any sample code I can refer? Thank you.

     

    Best Regards,

     

    Eric Fang

     

     

     

  • You're not following the state diagram showed in Figure 10.  When you set WDEN you need to write WDKEY at the same time.  It should be something like this:

    TIMER2_WDTCR = 0xA5C64000;  // move to pre-active state
    TIMER2_WDTCR = 0xDA7E4000; // move to active state

    You need to do the same when you kick the watchdog.

    Brad

  • Dear Brad,

    Thank you very much for the information. I am study the state diagram and re-write my code.

    By the way, if I want to set 500 ms watch dog, what value should I set to TIMER2_PRD12 & TIMER2_PRD34?

    Really appreciate your help!!

    Best Regards,

     

    Eric Fang

     

  • This will depend on your input clock. The timers are clocked by either AUXCLK which is essentially a bypass of the input clock CLKIN or the TIN pin. Either way, whatever frequency you are using will determine what values you should add into the PRD12 and PRD34 registers.

    For example, if you are using a 25MHz input clock then (25M * 0.5) = 12.5M, or 0xBEBC20. So assuming a 25MHz input clock you should be able to configure PRD12 as 0xBEBC20 and PRD34 0x0 to achieve a 500ms timeout on the watchdog.

  • HI, Tim,

    My input clock is 27MHz. Thanks a lot for the information!!

    Best Regards,

     

    Eric Fang

     

  • Hi, Brad and Tim,

    My watchdog is working now. Please refer to the following codes:

     

    void initDSPWatchDog(void)
    {
     // Refer to SPRU989 P.19 "Operation State Diagram"
     CFG_TIMERCTL = 0x01;// WatchDog Timer Event (WDINT from Timer2) causes a device max reset

     TIMER2_TGCR  = 0x0B; // Switch to Initial State

     TIMER2_PRD12 = 0xCDFE60;// 500 ms, 27MHz clock source 
     TIMER2_PRD34 = 0x000000;// 13.5M = 0xCDFE60

     TIMER2_WDTCR = 0xA5C64000; // move to pre-active state

     TIMER2_WDTCR = 0xDA7E4000; // move to active state

     TIMER2_WDTCR = 0xA5C64000; // move to service state

    }

    void resetDSPWatchDog(void)
    {
     TIMER2_WDTCR = 0xDA7E4000; // move to active state
     TIMER2_WDTCR = 0xA5C64000; // move to service state
    }

    Really appreciate your help!!

     

    Best Regards,

     

    Eric Fang

     

  • Glad to hear it! Best of luck with the rest of your project [:)]