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

Cycling Speed and Cadence Application

The Cycling Speed and Cadence Application is a firmware example that implements the Cycling Speed and Cadence profile using the hardware delivered in the nRF51822 Development Kit.

The source code and project file can be found in the <InstallFolder>\Nordic\nrf51822\Board\nrf6310\s110\ble_app_cscs folder.

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 optimised!
The application will stop advertising after 3 minutes and go to system-off mode. Push the button 0 restart advertising.

Setup

Instructions on how to set up the nRFgo Motherboard: nRFgo Motherboard Setup (nRF6310).

LED assignments:

  • LED 0: Advertising
  • LED 1: Connected
  • LED 7: Asserted (i.e. an assert check in the application has failed)

Buttons assignments:

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

Testing

The Cycling Speed and Cadence Application can be tested using the Master Control Panel as follows:

  1. Compile and program the application. Observe that the Advertising LED is lit.
  2. Connect to the device from Master Control Panel (the device will be advertising as 'Nordic_CSC'), then perform service discovery. Observe that the Connected LED is lit, and the Advertising LED is off.
  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 matches 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);