nRF51 SDK - S110 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Cycling Speed and Cadence Application

The Cycling Speed and Cadence Application is an example that implements the Cycling Speed and Cadence profile using the hardware delivered in the nRF51 Development Kit.

The application includes the two services in the Cycling Speed and Cadence profile:

In addition, use of the Battery Service is also demonstrated.

When the application starts, it starts a timer to simulate Cycling Speed and Cadence Measurements.

Also, a timer for generating battery measurements is started.

The sensor measurements are simulated the following way:

When notification of Cycling Speed and Cadence Measurement characteristic is enabled, the Cycling Speed and Cadence Measurement, containing the current value for all the components of the Cycling Speed and Cadence Measurement characteristic, is notified each time the Cycling Speed and Cadence measurement timer expires. When notification of Battery Level characteristic is enabled, the Battery Level is notified each time the Battery Level measurement timer expires.

Note
This application is not power optimized!
The application will stop advertising after 3 minutes and go to system-off mode. Push the button 1 to restart advertising.

Setup

The name of the example is ble_app_cscs_s110_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>\Nordic\nrf51\exmples\ble_peripheral\ble_app_cscs

Button assignments:

  • Button 1: Wake up from system-off and restart advertising.
  • Button 2: Wake up from system-off, erase all bonds, and restart advertising.

Testing

Test the Cycling Speed and Cadence Application with the Master Control Panel by performing the following steps:

  1. Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
  2. Connect to the device from Master Control Panel (the device will be advertising as 'Nordic_CSC'), then perform service discovery. Observe that the BSP_INDICATE_CONNECTED state is indicated.
  3. Click the 'Enable services' button on the Master Control Panel. Observe that Cycling Speed and Cadence notifications are received every second, and Battery Level notifications are received every two seconds.
  4. Do a 'start auto calibration' speed and cadence control point operation:
    • Write 02 (OpCode : BLE_SCPT_START_AUTOMATIC_CALIBRATION) to Speed and Cadence
    • Control Point Characteristic (UUID 0x2A55).
    • Observe that you receive one indication of the Speed and Cadence Ctrlpt indicating success (100201).
  5. Do a 'set cumulative value' speed and cadence control point operation:
    • Write 0112345678 (OpCode : BLE_SCPT_SET_CUMULATIVE_VALUE, Operand : 0x012345678) to Speed and Cadence
    • Control Point Characteristic (UUID 0x2A55).
    • Observe that you receive one indication of the Speed and Cadence Ctrlpt indicating success (100101) and that the bytes 1-4 of the next Csc Measurement nofitications match the new value (received notification should be yyxx345678, where yy being the byte 0 containing flags, xx being the cumulative value LSB which changes quickly, and should be bigger than 12).
  6. Do a 'request supported sensor locations' speed and cadence control point operation:
    • Write 04 (OpCode : BLE_SCPT_REQUEST_SUPPORTED_SENSOR_LOCATIONS) to Speed and Cadence
    • Control Point Characteristic (UUID 0x2A55).
    • Observe that you receive one indication of the Speed and Cadence Ctrlpt indicating success and the list of supported locations (1004010405060708090A0B0C0D).
  7. Do an 'update sensor location' speed and cadence control point operation:
    • Write 030A (OpCode : BLE_SCPT_UPDATE_SENSOR_LOCATION Operand : SENSOR_LOCATION_REAR_DROPOUT) to Speed and Cadence
    • Control Point Characteristic (UUID 0x2A55).
    • Observe that you receive one indication of the Speed and Cadence Ctrlpt indicating success (100301).
    • Read the Sensor Location Charactersitic (UUID 0x2A5D) and verify that the read value is 0x0A (SENSOR_LOCATION_REAR_DROPOUT).