Hi friends,
I am using AT91SAM7SE256 processor. Tool : Keil
i am using the watchdog timer interrupt for my application. I am unable to initialize the watch dog timer in interrupt mode.
Anybody is having an idea about this or having the example source code for watchdog timer?
should i enable or disable the watchdog in the startup code configuration wizard?
Please help me to solve this problem?
thanks, with regards, Murthy.R
you are going to use a watchdog to reset the processor in case of a hung application, then it is normally best to initialize the watchdog as early as possible. The only reason for not activating the watchdog early is if the startup code calls a library function that takes too long (for example decompressing constant data) that the watchdog may trig before you enter main(). Then you might have to take a chance and move the initialization into main(), where you get in full control of all program loops.
If you are going to use a watchdog as a normal timer interrupt, then you should normally wait until you reach main() before initializing it. It is easier to create debug builds with different parts of the logic disabled if you wait until main(). Then you can even read a configuration area in flash/eeprom or listen to a serial port before you make the decision if your application should enter test mode with some features simulated or disabled.
Hi,
Thanks for your reply.
i am using the watchdog timer as a interrupt.
i have enabled the watchdog timer interrupt and i restart it every 1 second,otherwise i will get a interrupt in 5 seconds.
My problem is
By using this code i am getting a watchdog interrupt in every 5 seconds. 1. Once i receive the watchdog interrupt i want to disable the watch dog interrupt. 2. How to disable this interrupt?
Please advise me on this.
This is my code
void watchdog_irq_handler(void)__irq { printf("watchdog interrupt"); *AT91C_AIC_EOICR = 0; // End of Interrupt } void watchdog_init ( void ) { int i=0; i = AT91F_WDTGetPeriod(5000); AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDFIEN | i | (i-0)<<16; AT91C_BASE_AIC->AIC_SMR[AT91C_ID_SYS] = 3; AT91C_BASE_AIC->AIC_SVR[AT91C_ID_SYS] = (unsigned long) watchdog_irq_handler; AT91C_BASE_AIC->AIC_IECR = (1 << AT91C_ID_SYS); } /*------------------------Main Program--------------------------------------------*/ int main (void) { unsigned int i=0; DBGU_init(); watchdog_init(); while(1) { printf("\n\rmain\n\r"); delay_1ms(1000); //AT91F_WDTRestart(AT91C_BASE_WDTC); /**Restart the watchdog timer/ } }
with regards, Murthy.R
I don't know the AT91, but I think you need to disable the interrupt source for the interrupt controller. here, I guess?
AT91C_BASE_AIC->AIC_IECR = (1 << AT91C_ID_SYS);