English
Language : 

AN92584 Datasheet, PDF (9/42 Pages) Ramtron International Corporation – Designing for Low Power and Estimating Battery Life for BLE Applications
Designing for Low Power and Estimating Battery Life for BLE Applications
Figure 6. Debug Pin Setting
2.5.2
Implementing Low-Power Operations in Application Code
The implementation is divided into three functional blocks in your application:
 System initialization and main loop
 BLE stack event handler
 Power management functions
System Initialization and Main Loop
After a power on or reset, the system initializes various components by calling the respective start functions. The
following steps are performed at initialization for a low-power operation. Refer to the code snippet with comments
(comments are labeled with “C<number>”) for the reference implementation.
 [C1] Stop the ILO to reduce current consumption.
 [C2] Configure the divider values for the ECO so that a 3-MHz ECO divided clock can be provided to the CPU in
the Sleep mode. The clock to the CPU is switched from the IMO to the ECO before entering the Sleep mode.
The ECO-derived clock is available when the CPU wakes up from the Sleep mode.
 [C3] In the main while loop, call the function CyBle_EnterLPM()() to put the BLESS into the DEEPSLEEP
mode soon after the BLE event processing is completed. Note that this function will internally check the BLESS
conditions if it can enter the DEEPSLEEP mode. Therefore, no check is required before calling this function.
 [C4, C5] If the system is active, run your application as illustrated by calling the run_application()function
[C4]. Once the application completes all its tasks, check if it is ready to enter a low-power mode. The
application can enter a low-power mode if all the non-BLE components used in the application are idle. The
application should enter the Sleep mode if some of the components need the high-frequency clock (ECO or IMO)
to wake up the system. The application should enter the Deep-Sleep mode if the clock to all the components can
be shut down. This is done by setting a flag (called applicationPower in the code) to SLEEP or
DEEPSLEEP. The flag is used by the ManageApplicationPower() function to put the components into the
Sleep or Deep-Sleep modes. Note that the definition of the Sleep and Deep-Sleep modes are application-
specific. Refer to the function definition of run_application()for a reference implementation [C5].
www.cypress.com
Document No. 001-92584 Rev. *A
9