- 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
Hello,
As per my understanding, you want o use WDT interrupt to wake up CPU from sleep periodically. Please correct me, if I am wrong.
In the project that you attached, CySysWdtDisable(CY_SYS_WDT_COUNTER2_MASK) is called periodically in the for() loop in the main function. The function CySysWdtDisable() will disable WDT counters and they won't generate an interrupt. Also, the function to enable WDT counters is commented out CySysWdtEnable(CY_SYS_WDT_COUNTER2_MASK). You have to call this function to start WDT counters. Please test again after modifying your main() function as below and let me know the results.
int main()
{
CyGlobalIntEnable; /* Enable global interrupts. */
WdtIsr_StartEx(WdtIsrHandler);
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
CySysWdtWriteMode(CY_SYS_WDT_COUNTER2, CY_SYS_WDT_MODE_INT);
CySysWdtWriteToggleBit(22);//32s
// CyBle_Start(AppCallBack);
CySysWdtEnable(CY_SYS_WDT_COUNTER2_MASK);
Uart_PutString("Start!\r\n");
for(;;)
{
// CyBle_ProcessEvents();
/* Place your application code here. */
// ManageBlePower();
/***********************************************************************
* Run your application specific code here
***********************************************************************/
// if(applicationPower == ACTIVE)
// {
// RunApplication();
// }
//
// /***********************************************************************
// * Process application power modes
// ***********************************************************************/
// ManageApplicationPower();
//
/***********************************************************************
* Manage system power mode based on application and BLE power modes
***********************************************************************/
// ManageSystemPower();
CySysPmSleep();
Uart_PutString("test\r\n");
CySysWdtResetCounters(CY_SYS_WDT_COUNTER2_MASK);
}
}
Thanks and Regards,
Sudheesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
As per my understanding, you want o use WDT interrupt to wake up CPU from sleep periodically. Please correct me, if I am wrong.
In the project that you attached, CySysWdtDisable(CY_SYS_WDT_COUNTER2_MASK) is called periodically in the for() loop in the main function. The function CySysWdtDisable() will disable WDT counters and they won't generate an interrupt. Also, the function to enable WDT counters is commented out CySysWdtEnable(CY_SYS_WDT_COUNTER2_MASK). You have to call this function to start WDT counters. Please test again after modifying your main() function as below and let me know the results.
int main()
{
CyGlobalIntEnable; /* Enable global interrupts. */
WdtIsr_StartEx(WdtIsrHandler);
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
CySysWdtWriteMode(CY_SYS_WDT_COUNTER2, CY_SYS_WDT_MODE_INT);
CySysWdtWriteToggleBit(22);//32s
// CyBle_Start(AppCallBack);
CySysWdtEnable(CY_SYS_WDT_COUNTER2_MASK);
Uart_PutString("Start!\r\n");
for(;;)
{
// CyBle_ProcessEvents();
/* Place your application code here. */
// ManageBlePower();
/***********************************************************************
* Run your application specific code here
***********************************************************************/
// if(applicationPower == ACTIVE)
// {
// RunApplication();
// }
//
// /***********************************************************************
// * Process application power modes
// ***********************************************************************/
// ManageApplicationPower();
//
/***********************************************************************
* Manage system power mode based on application and BLE power modes
***********************************************************************/
// ManageSystemPower();
CySysPmSleep();
Uart_PutString("test\r\n");
CySysWdtResetCounters(CY_SYS_WDT_COUNTER2_MASK);
}
}
Thanks and Regards,
Sudheesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sudheesh,
Thanks for your reply. You are right, it is me write a bug.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
你在 for loop 中不断的调用 disable 指令关闭 WDT, 芯片当然无法唤醒了。
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vision,
谢谢。不好意思确实是我写了bug。我在另一份代码里wdt_timer_1用了两次,设置了不同的中断函数。disable wdt interrupt 后enable出了问题,中断函数有调用,而且低功耗下在跑,但是不能唤醒低功耗。我找了之前写的demo code一试有同样的现象。巧合了。
现在问题已经解决了,感谢。
sophie