This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Urgent : Anybody having example source code for watchdog timer

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

Parents
  • 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

Reply
  • 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

Children