nRF5 SDK v15.0.0
Cycling Speed and Cadence Application
This example requires one of the following SoftDevices: S132, S140

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 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 nRF Connect 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 nRF Connect (the device is advertising as 'Nordic_CSC'), then bond to the device. To bond, click the settings button for the device in nRF Connect, select "Pair", check "Perform Bonding", and click "Pair". Wait until the bond is established before you continue. Observe that the BSP_INDICATE_CONNECTED state is indicated.
  3. Observe that the services are shown in the connected device and that you can start receiving values by clicking the 'Play' button. 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 '01 12 34 56 78' (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 '03 0A' (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