CYBLE-022001-00 doesn't wake from deepsleep

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

cross mob
MiVu_1533626
Level 1
Level 1

WDT Timer 1 is not triggering so I'm unable to wake up the Cypress from the deepsleep. Below is the code of WDT Timer implementation and activation of deepsleep.

WDT Timer initialization in main.c

void SetupWDT(uint16 timerPeriod)

{

    /* Use only timer 1 and do not cascade timers */

    CySysWdtWriteCascade(CY_SYS_WDT_CASCADE_NONE);

   

    /* Setup WDT1 for the specified period "timerPeriod".  */

    CySysWdtWriteMode(CY_SYS_WDT_COUNTER1,CY_SYS_WDT_MODE_INT);  /* Cause interrupt on match */

    CySysWdtWriteMatch(CY_SYS_WDT_COUNTER1,timerPeriod);         /* Set timer period */

    CySysWdtWriteClearOnMatch(CY_SYS_WDT_COUNTER1, 1u);          /* Reset counter on match  */

    CySysWdtEnable(CY_SYS_WDT_COUNTER1_MASK);                    /* Enable WDT1 */

   

    /* Lock WDT registers */

    CySysWdtLock();

   

    /* Setup the interrupt handler for the WDTs and enable it */

    CyIntSetVector(WDT_IRQN, WDT_Isr_Handler);

    CyIntEnable(WDT_IRQN);

}

Deepsleep activation

        if(CYBLE_STATE_DISCONNECTED == CyBle_GetState() || CYBLE_STATE_ADVERTISING == CyBle_GetState())

        {

            /* Local variable to store the status of BLESS Hardware block */

            CYBLE_LP_MODE_T sleepMode;

            CYBLE_BLESS_STATE_T blessState;

            // CyGlobalIntDisable; // disable all interrutpts

            /* Put BLE sub system in DeepSleep mode when it is idle */

            sleepMode = CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);

            blessState = CyBle_GetBleSsState();

            if(sleepMode == CYBLE_BLESS_DEEPSLEEP)

            {

                /* If the ECO has started or the BLESS can go to Deep Sleep, then place CPU

                * to Deep Sleep */

                if(blessState == CYBLE_BLESS_STATE_ECO_ON || blessState == CYBLE_BLESS_STATE_DEEPSLEEP)

                {

                    CySysPmDeepSleep();

                }

            }

            /* Re-enable global interrupt mask after wakeup */

            CyGlobalIntEnable;

        }

Can anyone tell me what I'm doing wrong?

Thank you in advance,

Milan.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi Milan,

Please divide the problem into two parts:

1. WDT part

2. BLE part

Please use the attached code snippet and ensure that the WatchDog Timer is properly configured.

Later please follow the below code to keep the BLE in the low power state.

/* Configure BLESS in Deep-Sleep mode */

        CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);

       

        /* Prevent interrupts while entering system low power modes */

        intrStatus = CyEnterCriticalSection();

       

        /* Get the current state of BLESS block */

        blessState = CyBle_GetBleSsState();

       

        /* If BLESS is in Deep-Sleep mode or the XTAL oscillator is turning on,

         * then PSoC 4 BLE can enter Deep-Sleep mode (1.3uA current consumption) */

        if(blessState == CYBLE_BLESS_STATE_ECO_ON ||

            blessState == CYBLE_BLESS_STATE_DEEPSLEEP)

        {

            CySysPmDeepSleep();

        }

        else if(blessState != CYBLE_BLESS_STATE_EVENT_CLOSE)

        {

            /* If BLESS is active, then configure PSoC 4 BLE system in

             * Sleep mode (~1.6mA current consumption) */

            CySysPmSleep();

        }

        else

        {

            /* Keep trying to enter either Sleep or Deep-Sleep mode */   

        }

        CyExitCriticalSection(intrStatus);

Please attach your project to this thread to check if still you are facing any issues after following above procedure.

Thanks

Ganesh

View solution in original post

0 Likes
2 Replies
lock attach
Attachments are accessible only for community members.
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi Milan,

Please divide the problem into two parts:

1. WDT part

2. BLE part

Please use the attached code snippet and ensure that the WatchDog Timer is properly configured.

Later please follow the below code to keep the BLE in the low power state.

/* Configure BLESS in Deep-Sleep mode */

        CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);

       

        /* Prevent interrupts while entering system low power modes */

        intrStatus = CyEnterCriticalSection();

       

        /* Get the current state of BLESS block */

        blessState = CyBle_GetBleSsState();

       

        /* If BLESS is in Deep-Sleep mode or the XTAL oscillator is turning on,

         * then PSoC 4 BLE can enter Deep-Sleep mode (1.3uA current consumption) */

        if(blessState == CYBLE_BLESS_STATE_ECO_ON ||

            blessState == CYBLE_BLESS_STATE_DEEPSLEEP)

        {

            CySysPmDeepSleep();

        }

        else if(blessState != CYBLE_BLESS_STATE_EVENT_CLOSE)

        {

            /* If BLESS is active, then configure PSoC 4 BLE system in

             * Sleep mode (~1.6mA current consumption) */

            CySysPmSleep();

        }

        else

        {

            /* Keep trying to enter either Sleep or Deep-Sleep mode */   

        }

        CyExitCriticalSection(intrStatus);

Please attach your project to this thread to check if still you are facing any issues after following above procedure.

Thanks

Ganesh

0 Likes

Hello MiVu_1533626 ,

Please share your complete project if you are still facing any issues.

Thanks,

P Yugandhar.

0 Likes