nRF51 SDK - S130 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Power Profiling Application

The Power Profiling Applicationis designed to be used to measure the current consumption of the nRF51822, loaded with the S130 SoftDevice, during advertisement and data transmission. The user can change some of the parameters (listed below) of this application and measure current consumption.

This application also demonstrates the use of Vendor Specific (128 bit) UUIDs.

This application can be used in two different modes:

1. Connectable mode:

In this mode, the application advertises in connectable mode. It sets itself up with a service and a characteristic with 'Notify' property. This characteristic has a CCCD associated with it.

Once the central enables notification of this characteristic (writes 0x0001 to this CCCD), the application starts sending notifications of this characteristic for a time interval equal to the value of APP_CFG_CHAR_NOTIF_TIMEOUT. The application will attempt to send one notification per connection interval, but this is not guaranteed. There is a possibility that in one connection interval there are no notifications but in the next there are two notifications. This depends on when exactly the repeating application timer expires. The total number of notifications sent by the application will be close to (APP_CFG_CHAR_NOTIF_TIMEOUT / (APP_CFG_CONNECTION_INTERVAL)). After sending these notifications, the application puts the chip in 'System Off' mode.

2. Non-connectable mode:

In this mode, the application advertises the given length of data (APP_CFG_ADV_DATA_LEN) for a given duration of time (APP_CFG_NON_CONN_ADV_TIMEOUT) in non-connectable mode and then puts the chip in System Off mode.

Note
In both modes, the device name does not show up in the advertisement packet as per design. The advertisement packet has only 'Flags' and 'Manufacturer specific data' fields. This is done to make the least possible size of an advertisement packet as 8 bytes.

Power Management

The application demonstrates the use of two different power saving modes, namely CPU Sleep and System-Off mode. All sample applications delivered with the SDK use these two modes.

Low Power Mode:

The application uses the nrf_wait_for_app_event() function to enter CPU sleep mode. This will place the chip in 'Low Power' mode. The chip will wake up from this mode on application interrupts. Typically, any application should call nrf_wait_for_app_event() in an infinite loop in main. It will return when an application interrupt has occurred, thereby allowing the main thread to process it if needed.

System OFF Mode:

This is the deepest power saving mode the system can enter. In this mode, all core functionality is powered down, and most peripherals are therefore non-functional or non-responsive. The only mechanisms that are functional and responsive in this mode are the reset mechanism and the wakeup mechanism.

This sample application starts up, configures wakeup buttons, and enters the Szstem OFF mode. On button presses, the application wakes up and goes into either 'Connectable mode' or 'Non-connectable mode' based on which button is pressed.

For more information on both modes, see nrf_wait_for_app_event() and the nRF51 Series User Specification (Section: POWER - Power control).

Compiler Optimization:

This example is optimized for reduced power consumption. Therefore, the default optimization level for this example application is 'Level 3' (-O3) and 'Optimize for Time' (-Otime). If the Keil debugger is needed for debugging purposes, the optimization level should be changed to 'Level 0' (-O0), and 'Optimize for Time' should be removed to ease the use of the debugger.

Setup

The name of the example is ble_app_pwr_profiling_s130_pca10028. If you are not using the Keil Pack Installer, you can find the source code and project file of the example in the following folder: <InstallFolder>\examples\ble_peripheral\ble_app_pwr_profiling

The application does not use any LEDs.

Button assignments:

  • Button 1: Place the application in connectable mode.
  • Button 2: Place the application in non-connectable mode.

Testing

Test the Power Profiling Application with the Master Control Panel by performing the following steps:

  1. Compile and program the application.
  2. Start Master Control Panel on the computer.
  3. Click File -> Options. Verify that the connection interval value displayed in the 'Options' window is the same as APP_CFG_CONNECTION_INTERVAL.
  4. Close the Options window and click 'Start discovery' in the Master Control Panel main window.
  5. Push Button 1 on the board. Observe that the application is advertising in connectable mode.
  6. Connect to the device from Master Control Panel, click 'Service discovery', then click 'Enable Services'.
  7. Observe notifications of the characteristic being received by the central.
  8. After APP_CFG_CHAR_NOTIF_TIMEOUT, the Master control panel will lose connection with the chip because it enters System Off mode.
  9. Verify that the size of the characteristic value received in all the notifications was equal to APP_CFG_CHAR_LEN.
  10. Click the 'Back' button in the Master control panel, right click in the 'Discovered Devices' section in Master Control Panel, and click 'Clear list' to clear the list of devices.
  11. Verify that the device is not advertising.
  12. Push Button 2 on the board. Observe the application is advertising in non-connectable mode (the Adv. type field should be Non-Connectable).
  13. Verify that the number of bytes in the Manufacturer Specific Data in Adv. data is APP_CFG_ADV_DATA_LEN - 5.
  14. After APP_CFG_NON_CONN_ADV_TIMEOUT, clear the list of 'Discovered Devices'. Verify that the device is not advertising.