Announcements
Community Announcement : Welcome to the NEW Cypress Developer Community.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

moshc_4060821
New Contributor II

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
moshc_4060821
New Contributor II

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