watchdog timer ISR not working

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
moshc_4060821
Level 2
Level 2
First like received First like given

i am working with Psoc4 Ble pioneer kit.

i want to generate a WDT based interrupt after every hour. so to do that i have i have used global signal component.

this is my code

CY_ISR(WDT_ISR_handler)

{

    WDT_ISR_ClearPending();

}

int main(void)

 

    HW_Init();

   

    /* Starts RTC component */

    RTC_Start();

    /* Set RTC time update period */

    RTC_SetPeriod(1u, SYSTICK_EACH_1_HZ);

   

    RTC_ClearAlarmStatus() ;

    RTC_SetAlarmHandler( alarm_handler ) ;

    RTC_SetAlarmMask( RTC_ALARM_SEC_MASK ) ;

   

    WDT_ISR_StartEx(WDT_ISR_handler);

  

   

   

    for(;;)

    {

      

    }

}

please find attached screen shots for WDT2 clock configuration.(currently i am testing it with only 4 seconds)

so my problem is first time interrupt is generated after 4 seconds but then it could not clear and the pending register or something.

please guide me.

0 Likes
1 Solution

hi

i have solved the problem.

this is my code.

    

CY_ISR(WDT_ISR_handler)

{

      CySysWdtClearInterrupt(CY_SYS_WDT_COUNTER2_INT);

}

int main(void)

{

    HW_Init();

 

    /* Starts RTC component */

    RTC_Start();

    /* Set RTC time update period */

    RTC_SetPeriod(1u, SYSTICK_EACH_1_HZ);

 

    RTC_ClearAlarmStatus() ;

    RTC_SetAlarmHandler( alarm_handler ) ;

    RTC_SetAlarmMask( RTC_ALARM_SEC_MASK ) ;

     /* Enable WDT0 counter */

    CySysWdtEnable(CY_SYS_WDT_COUNTER2_MASK);   // WDT=PeriodicTimer

    WDT_ISR_StartEx(WDT_ISR_handler); // Start ISR for pin toggle

    CySysWdtEnable(CY_SYS_WDT_COUNTER2);

    for(;;)

    {

    

    }

}


thanks for helping.

Mohit

View solution in original post

0 Likes
3 Replies