- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Easiest is to count wakeups and when lesser than 10 seconds deepsleep again, else wakeup.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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