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.

C64x+ Watchdog timer prevent sequence

Other Parts Discussed in Thread: TMS320C6424

Hello,

I'm using the TMS320C6424 DSP. I have a problem with preventing watchdog timout event. In datasheet (spruen5) said that i should write two words (A5C6h followed
by DA7Eh) to the watchdog timer service key (WDKEY) bits in WDTCR before the timer finishes counting up to prevent a watchdog timeout event. But in my case it doesn't work. I mean that after writing this sequence watchdog timer counter doesn't reset.

I can show u my code:

CSL_TmrRegsOvly CSL_TmrRegsOvly2 = (CSL_TmrRegsOvly)( 0x01C21C00 ); // Initialize a pointer to timer 2

...

//WATCHDOG TIMER initial function. After this fucntion watchdog timer works correctly.

//Period in seconds
void WatchDogTimerInit(double Period)
{
    long long LocPeriod = Period*OSCILLATOR;
    CSL_TmrRegsOvly2->PRD12  = LocPeriod;   
    CSL_TmrRegsOvly2->PRD34  = LocPeriod>>32;
    CSL_TmrRegsOvly2->TIM12  = 0;
    CSL_TmrRegsOvly2->TIM34  = 0;

    // disable timer0 3:4
   // disable timer0 1:2
    CSL_TmrRegsOvly2->TCR = 0
                                | (CSL_TMR_TCR_ENAMODE34_DISABLE << CSL_TMR_TCR_ENAMODE34_SHIFT)   
                                | (CSL_TMR_TCR_ENAMODE12_DISABLE << CSL_TMR_TCR_ENAMODE12_SHIFT)   
                                ;
    //Set TIMMODE. The timer is in 64-bit Watchdog Timer mode
    CSL_TmrRegsOvly2->TGCR = 0xF;
    // SET WDEN bit. Watchdog enabled
    CSL_TmrRegsOvly2->WDTCR = 0x00004000;

    //Start sequence   request
    CSL_TmrRegsOvly2->WDTCR = 0xA5C64000;
    CSL_TmrRegsOvly2->WDTCR = 0xDA7E4000;

    //Enable timer continuously
    CSL_TmrRegsOvly2->TCR |= CSL_TMR_TCR_ENAMODE12_EN_CONT << CSL_TMR_TCR_ENAMODE12_SHIFT;
}

//WATCHDOG TIMER reset fucntion

void WatchDogReset(void)
{
    /* ALL THIS DOESN'T WORK!!!
    CSL_TmrRegsOvly2->WDTCR = (0xA5C6<<16);
    CSL_TmrRegsOvly2->WDTCR = (0xDA7E<<16);
    */
    CSL_TmrRegsOvly2->WDTCR = 0xA5C64000;
    CSL_TmrRegsOvly2->WDTCR = 0xDA7E4000;
}

 

//Functions calling

int main()
{
 ....
  WatchDogTimerInit(10.0);
 ....
  while(true)
  {
  ...
    WatchDogReset();

  ...
  }
}

Thanks.

  • The problem solved.

         My mistake.

    CSL_TmrRegsOvly2->TGCR = 0xF; - incorrect initialization.

         Correct is:

    CSL_TmrRegsOvly2->TGCR = 0x8; //Set TIMMODE. The timer is in 64-bit Watchdog Timer mode

    CSL_TmrRegsOvly2->TGCR |= 0x3;// //SET TIM12RS=1, TIM34RS=1

     

    True code for init and reset watchdog timer!!!

    //Period in seconds
    void WatchDogTimerInit(double Period)
    {
        long long LocPeriod = Period*OSCILLATOR; //ôîðìèðóåì ðåàëüíûé ïåðèîä äëÿ òàéìåðà. 1îòñ÷åò = 1/F(c) => N(t) = t/(1/F) = t*F; F=25MHz

    // INITIAL STATE                               
        CSL_TmrRegsOvly2->TGCR = 0x8;//Set TIMMODE. The timer is in 64-bit Watchdog Timer mode
        //CSL_TmrRegsOvly2->TGCR = 0xF;
        CSL_TmrRegsOvly2->PRD12  = LocPeriod;   
        CSL_TmrRegsOvly2->PRD34  = LocPeriod>>32;
        CSL_TmrRegsOvly2->TIM12  = 0;
        CSL_TmrRegsOvly2->TIM34  = 0;
        CSL_TmrRegsOvly2->TGCR |= 0x3;//SET TIM12RS=1, TIM34RS=1

    // PRE_ACTIVE STATE
        CSL_TmrRegsOvly2->WDTCR = 0x00004000; // SET WDEN bit. Watchdog enabled
        CSL_TmrRegsOvly2->WDTCR = 0xA5C64000; //Start sequence    request. WORK!!!
        //CSL_TmrRegsOvly2->WDTCR = (0xA5C6<<16); //Start sequence    request. DOESN'T WORK!!!!!!!!!!!!

    // ACTIVE STATE
        //CSL_TmrRegsOvly2->WDTCR = (0xDA7E<<16);//DOESN'T WORK!!!!!!!!!!!!
        CSL_TmrRegsOvly2->WDTCR = 0xDA7E4000;//WORK!!!
    }

    void WatchDogReset(void)
    {

        CSL_TmrRegsOvly2->WDTCR = 0xA5C64000;
        CSL_TmrRegsOvly2->WDTCR = 0xDA7E4000;

    /* THIS CODE FOR RESET WORKS TOO!!!!!!!!!!
        CSL_TmrRegsOvly2->WDTCR = (0xA5C6<<16);
        CSL_TmrRegsOvly2->WDTCR = (0xDA7E<<16);
    */
    }