In today’s example we are showing users how they can use the PSoC 4 to enter and wake up from hibernate and stop modes. The example also shows the user how to retain SRAM variables in hibernate mode. The project uses the UART which allows the user to send a command to increment a variable, or enter hibernate and stop low power modes. Hibernate and Stop modes can also be entered using the same switch during active mode.
Forum Post Attachments:
At the bottom of this post we are including the following items:
- Example Project Zip File
- Project Images
The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:
- Global Signal Reference
The main.c firmware is included in the example project. Please review the commented sections for more details.
In the main function, the PSoC 4 checks for the source of reset (Hibernate or Stop) and initializes components accordingly. The example then reads the command from the UART terminal and executes it.
The example will accept a set of UART commands to perform actions:
- ‘I’ – Increments the SRAM variable
- ‘D’ – Decrements the SRAM variable
- ‘H’ – Enters Hibernate power mode
- ‘S’ – Enters Stop mode
The SRAM variable retains its value when it wakes up from hibernate mode and is reset when the device wakes up from Stop mode.
To enter lower power mode from active mode without using the UART communications follow the wakeup switch procedure for various modes:
- Press the switch to enter hibernate mode from active mode.
- Press and hold the switch to enter stop mode from active mode.
The Lower Power Comparator interrupts are used as wakeup sources to bring back the device from hibernate mode. The dedicated wake-up pin P0.7 is used as a wake-up source to bring back the device from stop mode.
In this example we will need to connect our UART pins from the PSoC 4 P0.4 and P0.5 to the PSoC 5LP P12.6 and P12.7 pins.
Connect the DC voltage to the inverting terminal of the Low Power Comparator P0.1.
Connect P1.5 to an oscope.
Test Your Project:
Program the board and launch the hyperterminal application and begin communicating with the PSoC 4. Use the comparator and push button inputs to control the power modes.
I hope this example can help you in your design.