English
Language : 

AN92584 Datasheet, PDF (13/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
* Place code to place the application components to deepsleep here
************************************************************************/
break;
}
}
System Power Management
The application should call the ManageSystemPower() function to put the system into low-power modes. The
function puts the system into the allowed low-power modes as follows:
 [C9] Get the current internal state of the BLESS by calling the CyBle_GetBleSsState()function.
 [C10, C11] If the BLESS is in the DEEPSLEEP mode and the non-BLE application components are also in the
Deep-Sleep mode [C10], then put the system into the Deep-Sleep mode [C11]. The code execution halts here
until the system wakes up from the Deep-Sleep mode due to an interrupt.
 [C12] If the BLESS does not enter the DEEPSLEEP mode, it is either because it is at the beginning or in the
middle of an event. The system can be put into the Sleep mode in this period except in the
CYBLE_BLESS_STATE_EVENT_CLOSE state.
 [C13, C14, C15, C16] There are two possibilities about the application power mode under the above condition. If
the application is in the Deep-Sleep mode [C13], the system can use the ECO instead of the IMO as the clock
source in the Sleep mode. First, the HFCLK source is switched to the ECO and the IMO is stopped [C14]. The
system is then put into the Sleep mode [C15]. The code execution halts here until the system wakes up from the
Sleep mode due to an interrupt. The IMO is restarted upon wakeup and the clock source for HFCLK is reverted
to the IMO [C16].
 [C17, C18] If the application is in the Sleep mode and requires the IMO [C17], then the system is put into the
Sleep mode [C18], without switching OFF the IMO.
Note 1: It is important that the code to handle the low-power transitions is protected in a critical section and that
interrupts are not allowed to change the thread of operation. In the code snippet, this critical section is bound by
the CyEnterCriticalSection() function at the beginning and the CyExitCriticalSection() function at
the end. If you do not put the code in this critical section, it may result in race conditions between the system and
the BLESS in entering the BLESS low-power modes, causing the device to enter an unknown state from which it
cannot recover.
Note 2: When you put the BLESS into the DEEPSLEEP mode in the application using the
CyBle_EnterLPM()function call, the ECO is configured to be OFF within the function. Therefore, the
application need not do an explicit ECO OFF. However, if you are not using the BLESS, then you need to
explicitly stop the ECO in the system if it is not required. This is because the system API call,
CySysPmDeepSleep(), will not turn OFF the ECO. This can be done by calling the
CySysClkEcoStop()API, described previously, just before putting the system into the Deep-Sleep mode.
The code snippet follows.
void ManageSystemPower()
{
/* Variable declarations */
CYBLE_BLESS_STATE_T blePower;
uint8 interruptStatus ;
/* Disable global interrupts to avoid any other tasks from interrupting this
section of
code*/
interruptStatus = CyEnterCriticalSection();
/* C9. Get current state of BLE sub system to check if it has successfully
www.cypress.com
Document No. 001-92584 Rev. *A
13