How to increase watchdog timer wakeup interval from deepsleep mode?

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

cross mob
Anonymous
Not applicable

Hi,

   

Could someone guide how to increase the wakeup interval from DeepSleep mode when using watchdog timer?

   

In my example, I want an interval of 10 seconds before interrupt fires, but it seem to fire every second or 500 ms. Blue led toggles very frequently.

   

Below is the code I am using -

   

 

   

 

   

#include <project.h>
#define PERIOD 3200000u

   

static uint8 Toggle = 0u;

   

CY_ISR_PROTO(WDT_ISR);

   

CY_ISR(WDT_ISR1)
{
    // Blue LED toggle to test if ISR code is running
    CySysWdtClearInterrupt(CY_SYS_WDT_COUNTER0_INT);
    ISR_WDT_ClearPending();
}

   

int main()
{
    /* Setup WDT Counter 0 to generate interrupt on match */
    CySysWdtWriteMode(CY_SYS_WDT_COUNTER0,CY_SYS_WDT_MODE_INT);

   

    /* Write match count */
    CySysWdtWriteMatch(CY_SYS_WDT_COUNTER0, PERIOD);
     
    /* Enable clear of counter on match */
    CySysWdtWriteClearOnMatch(CY_SYS_WDT_COUNTER0, 1u);

   

    /* Enable WDT counter 0 */
    CySysWdtEnable(CY_SYS_WDT_COUNTER0_MASK);

   

    // Test if WDT resets...
    Red_LED_Write(0u);
    CyDelay(1000);
    Red_LED_Write(1u);

   

    /* Map interrupt vector to the WDT_ISR */
    ISR_WDT_StartEx(WDT_ISR1);  
    /* Enable Global Interrupt */
    CyGlobalIntEnable;
 
    /* 200us delay to ensure WDT configuration is complete */
    CyDelayUs(200);

   

    for(;;)
    {
        
    Blue_LED_Write(Toggle);
    CyDelay(200);
    Blue_LED_Write(~Toggle);
    
    CySysPmDeepSleep(); // Doesent work correct with Deep sleep
    //CySysPmSleep(); // It works with Sleep mode ???
    }
}

   

 

   

Please help!! What parameter value I need to change here?

   

Thanks,

   

Jitender

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

At the very begin of the document I pointed to are the pictures for setting the WDT for several different devices. Open your project, view the .cydwr file, select the "Clocks" tab and proceed exactly as shown in the pictures. Make sure, that you have got the latest Creator version which is as of today 3.3 SP1.

   

 

   

Blob

View solution in original post

0 Likes
5 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Easiest is to count wakeups and when lesser than 10 seconds deepsleep again, else wakeup.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi Bob,

   

Thanks. Now I have done same logic but that's just a quickfix. Can't we make the watchdog timer to wakeup after 10 seconds instead of counting total wakeup's.

   

Isn't there any way to set number of seconds or milliseconds to the Watchdog timer (Big number like 10 or 20 seconds)?

   

- Jitender

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Read this document to setup the WDT for durations up to some days.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi Bob,

   

This document seems to have too much information. Sorry, I am not very technical person. Could you plz point me to some simplest example of using it?

   

Thanks.

   

Jitender

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

At the very begin of the document I pointed to are the pictures for setting the WDT for several different devices. Open your project, view the .cydwr file, select the "Clocks" tab and proceed exactly as shown in the pictures. Make sure, that you have got the latest Creator version which is as of today 3.3 SP1.

   

 

   

Blob

0 Likes