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.