AN77900 - PSoC 5LP Power Modes Example Project hibernate FAIL on CY8CKIT-059

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.
DaMi_1020716
Level 1
Level 1
5 sign-ins First reply posted First question asked

I tried to implement the hibernate example from this project on my board and it gets stuck in hibernate mode.  So I took out the CY8CKIT-059 and modified my code example a bit to fit this board and it still gets stuck in hibernate mode, well sort of. I think it is accepting the GPIO interrupt partially since the current draw increases after the button press, but it does not execute any of the code after the CyPmHibernate(); CyPmRestoreClocks();.   The code is slightly modified from the by example by blinking the LED so I can see where in the code we are without debugging.  I have attached the project. 

The CE95346 - Power Management and Hibernate with PSoC 3/5LP  example does work maybe because of the custom ISR?

Any Ideas? (could I have some system setting wrong?) I haven't found any note to a similar problem.

Here is the Hibernate section of the code:

case HIBERNATE : /* 0x41 - Hibernate - PICU */
{
/* Display mode and set LCD pins for low-power. */
LCD_Position(1,0);
LCD_PrintString("Hibernate ");
LED_S_Write(LED_OFF);
/* Start the button interrupt. */
isr_ButtonPress_Start();
SleepComponents();

LED_S_Write(LED_OFF);
CyDelay(1000u);
LED_S_Write(LED_ON); //blink the LED so I know where I am in the code
CyDelay(1000u);
LED_S_Write(LED_OFF);
CyDelay(1000u);
LED_S_Write(LED_ON);
CyDelay(1000u);
LED_S_Write(LED_OFF);

/* Save clocks and enter low power. */
CyPmSaveClocks();
CyPmHibernate();

/* The PSoC wakes up here. Restore everything and clear PICU interrupt. */
CyPmRestoreClocks();

LED_S_Write(LED_ON); //Status LEDs so I know where I am in the code
CyDelay(1000u);
LED_S_Write(LED_OFF);
CyDelay(1000u);
LED_S_Write(LED_ON);

WakeComponents();
/* Stop the button interrupt. */
isr_ButtonPress_Stop();
Button_ClearInterrupt();

break;
}

0 Likes
1 Solution
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hello,

I tried recreating the issue using the attached project and I had a similar observation.  The code was stuck in the Hibernate case. 

After the wakeup PICU interrupt occurs, the Button_ClearInterrupt() (where Button is instance name of the Pins component) function must be called to clear the latched pin events to allow the proper Hibernate mode entry and to enable detection of future events.

Therefore, on adding this line in the  CY_ISR(isr_ButtonPress_Interrupt) I was able to resolve the issue.

CY_ISR(isr_ButtonPress_Interrupt)
{
#ifdef isr_ButtonPress_INTERRUPT_INTERRUPT_CALLBACK
isr_ButtonPress_Interrupt_InterruptCallback();
#endif /* isr_ButtonPress_INTERRUPT_INTERRUPT_CALLBACK */

/* Place your Interrupt code here. */
Button_ClearInterrupt();
/* `#START isr_ButtonPress_Interrupt` */

/* `#END` */
}

 

Best Regards

Ekta

View solution in original post

0 Likes
2 Replies
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hello,

I tried recreating the issue using the attached project and I had a similar observation.  The code was stuck in the Hibernate case. 

After the wakeup PICU interrupt occurs, the Button_ClearInterrupt() (where Button is instance name of the Pins component) function must be called to clear the latched pin events to allow the proper Hibernate mode entry and to enable detection of future events.

Therefore, on adding this line in the  CY_ISR(isr_ButtonPress_Interrupt) I was able to resolve the issue.

CY_ISR(isr_ButtonPress_Interrupt)
{
#ifdef isr_ButtonPress_INTERRUPT_INTERRUPT_CALLBACK
isr_ButtonPress_Interrupt_InterruptCallback();
#endif /* isr_ButtonPress_INTERRUPT_INTERRUPT_CALLBACK */

/* Place your Interrupt code here. */
Button_ClearInterrupt();
/* `#START isr_ButtonPress_Interrupt` */

/* `#END` */
}

 

Best Regards

Ekta

0 Likes
DaMi_1020716
Level 1
Level 1
5 sign-ins First reply posted First question asked

Thank you. That makes sense since the examples with _StartEx versions included the ClearInterrupt.  

0 Likes