nRF5 SDK v12.1.0
Cycling Speed and Cadence Application
This example requires one of the following SoftDevices: S130, S132

Important: Before you run this example, make sure to program the SoftDevice.

The Cycling Speed and Cadence Application is an example that implements the Cycling Speed and Cadence profile using the hardware delivered in the nRF5 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

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\ble_peripheral\ble_app_cscs

Button assignments: BSP BLE Button Assignments

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 value 02 (OpCode: BLE_SCPT_START_AUTOMATIC_CALIBRATION) to the SC Control Point Characteristic (UUID 0x2A55).
    • Observe that you receive one indication of the SC Control Point Characteristic indicating success (100201).
  5. Do a 'set cumulative value' speed and cadence control point operation:
    • Write value 0112345678 (OpCode: BLE_SCPT_SET_CUMULATIVE_VALUE, Operand: 0x012345678) to the SC Control Point Characteristic (UUID 0x2A55).
    • Observe that you receive one indication of the SC Control Point Characteristic 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 value 04 (OpCode: BLE_SCPT_REQUEST_SUPPORTED_SENSOR_LOCATIONS) to the SC Control Point Characteristic (UUID 0x2A55).
    • Observe that you receive one indication of the SC Control Point Characteristic indicating success and the list of supported locations (1004010405060708090A0B0C0D).
  7. Do an 'update sensor location' speed and cadence control point operation:
    • Write value 030A (OpCode: BLE_SCPT_UPDATE_SENSOR_LOCATION Operand: SENSOR_LOCATION_REAR_DROPOUT) to the SC Control Point Characteristic (UUID 0x2A55).
    • Observe that you receive one indication of the SC Control Point Characteristic indicating success (100301).
    • Read the Sensor Location Charactersitic (UUID 0x2A5D) and verify that the read value is 0x0A (SENSOR_LOCATION_REAR_DROPOUT).

Documentation feedback | Developer Zone | Subscribe | Updated