English
Language : 

AN91184 Datasheet, PDF (25/36 Pages) Ramtron International Corporation – Designing BLE Applications
PSoC® 4 BLE – Designing BLE Applications
System Normal Operation
In the system normal operation state, the firmware periodically calls CyBle_ProcessEvents() to process BLE
stack-related operations and checks if the connection is established.
Note: Any BLE stack-related operation such as receiving or sending data from or to the link layer and event
generation to the application layer are performed as a part of the CyBle_ProcessEvents() function call. In this
application, Code 1 initializes the stack, but the events related to the stack are generated only when the
CyBle_ProcessEvents() function is called. Similarly, other events related to device connection, disconnection,
advertising timeout, and the Health Thermometer Service are generated only when CyBle_ProcessEvents()is
called.
If the connection is established, the firmware measures the temperature at regular intervals (configured by the
Measurement Interval Characteristic of the Health Thermometer Service). After measuring the temperature, if
Indications are enabled by the Central device, the firmware sends the temperature data to the BLE Central device as
indications.
In a BLE application, the device transmits or receives data only at periodic intervals, also known as advertising
intervals or connection intervals, depending on the BLE connection state. Thus, when the system normal operation
task is complete, to conserve power, the device enters the system low-power operation mode and wakes up at the
next connection/advertisement interval.
4.2.3 System Low-Power Operation
In the system low-power operation state, the device operates in one of the three possible power modes:
 Sleep
This mode is entered when the CPU is free but the BLE subsystem (BLESS) is active and busy in data
transmission or reception. In this scenario, the CPU is put into the Sleep mode while the remaining core, such as
clocks and regulator, is kept active for normal BLE operation.
To conserve power, the internal main oscillator (IMO) frequency is reduced to 3 MHz; on wakeup, it is switched
back to 12 MHz.
 Deep-Sleep
The firmware continuously tries to put the BLESS into the Deep-Sleep mode. After the BLESS is successfully put
into the Deep-Sleep mode, the remaining system also transitions to the Deep-Sleep mode.
Note: Transitioning the device into the Deep-Sleep mode should happen immediately after the BLESS is put into
the Deep-Sleep mode. If this cannot be guaranteed, the firmware should disable interrupts (to avoid servicing an
ISR) and recheck if the BLESS is still in the Deep-Sleep mode or the ECO_ON mode. If the BLESS is in either of
these two modes, then the device can safely enter the Deep-Sleep mode; if not, the device must wait until the
Rx/Tx event is complete.
 Hibernate
When the device is disconnected or the advertising interval times out, it enters the ultra-low-power mode called
“Hibernate”. After waking up from this mode, the firmware starts to execute from the beginning of main.c,
although the RAM contents are retained.
4.2.4
Sensor Simulation
If you do not have a thermistor and a reference resistor to measure the temperature, you may use the temperature
simulation mode to test the application. In this mode, the temperature data is simulated and incremented by 1 0C per
measurement interval (default value is 1 second). This can be done in the application code by changing the value of
the constant MEASURE_TEMPERATURE_SENSOR from 1 to 0 in the Temperature.h file, as shown in Code 5.
Code 5. Simulate Temperature Sensor
#define MEASURE_TEMPERATURE_SENSOR (0u)
www.cypress.com
Document No. 001-91184 Rev. *B
25