PSOC4BLE WDT INTERRUPT CAN NOT WAKE SLEEP

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.
Sophie_Wang
Level 4
Level 4
Distributor - Zenitron(GC)
25 replies posted 10 replies posted 5 replies posted

Hi CY Friend,

As the title. I attach my code.

Thanks

sophie

0 Likes
1 Solution
SudheeshK
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

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

View solution in original post

0 Likes
4 Replies
SudheeshK
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

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

0 Likes
Sophie_Wang
Level 4
Level 4
Distributor - Zenitron(GC)
25 replies posted 10 replies posted 5 replies posted

Hi Sudheesh,

Thanks for your reply. You are right, it is me write a bug.

0 Likes
Vison_Zhang
Moderator
Moderator
Moderator
First comment on KBA 750 replies posted 250 sign-ins

你在 for loop 中不断的调用 disable 指令关闭 WDT, 芯片当然无法唤醒了。

0 Likes
Sophie_Wang
Level 4
Level 4
Distributor - Zenitron(GC)
25 replies posted 10 replies posted 5 replies posted

Hi Vision,

谢谢。不好意思确实是我写了bug。我在另一份代码里wdt_timer_1用了两次,设置了不同的中断函数。disable wdt interrupt 后enable出了问题,中断函数有调用,而且低功耗下在跑,但是不能唤醒低功耗。我找了之前写的demo code一试有同样的现象。巧合了。

现在问题已经解决了,感谢。

sophie

0 Likes