Bluetooth: Peripheral Running Speed and Cadence Service (RSCS)
The peripheral RSCS sample demonstrates how to use the Running Speed and Cadence Service (RSCS).
The sample supports the following development kits:
When built for an
_ns build target, the sample is configured to compile and run as a non-secure application with Cortex-M Security Extensions enabled.
Therefore, it automatically includes Trusted Firmware-M that prepares the required peripherals and secure services to be available for the application.
This sample demonstrates the use of Running Speed and Cadence Service. It simulates a sensor and sends measurements to the connected device, such as a phone or a tablet.
The mobile application on the device can configure sensor parameters using the SC Control Point characteristic.
- LED 1:
Blinks every two seconds with the duty cycle set to 50% when the main loop is running and the device is advertising.
- LED 2:
On when connected.
This sample can be found under
samples/bluetooth/peripheral_rscs in the nRF Connect SDK folder structure.
When built as firmware image for the
_ns build target, the sample has Cortex-M Security Extensions (CMSE) enabled and separates the firmware between Non-Secure Processing Environment (NSPE) and Secure Processing Environment (SPE).
Because of this, it automatically includes the Trusted Firmware-M (TF-M).
To read more about CMSE, see Processing environments.
To build the sample with Visual Studio Code, follow the steps listed on the How to build an application page in the nRF Connect for VS Code extension documentation. See Building and programming an application for other building and programming scenarios and Testing and debugging an application for general information about testing and debugging in the nRF Connect SDK.
This testing procedure assumes that you are using nRF Connect for Mobile. After programming the sample to your development kit, test it by performing the following steps:
Power on your development kit.
Connect to the device through nRF Connect for Mobile (the device is advertising as “Nordic_RSCS”).
Observe that the services of the connected device are shown.
In Running Speed and Cadence Service, tap the Notify button for the “RSC Measurement” characteristic.
Observe that notifications with the measurement values are received.
In RSC Feature, tap the Read button to get the supported features.
In Sensor Location, tap the Read button to read the location of the sensor.
In SC Control Point, tap the Indicate button to control the sensor.
The following Op Codes (with data if required) can be written into the SC Control Point:
01 xx xx xx xxto set the Total Distance Value to the entered value in meters. (if the server supports the Total Distance Measurement feature).
02to start the sensor calibration process (if the server supports the Sensor Calibration feature).
03 xxto update the sensor location (if the server supports the Multiple Sensor Locations feature).
04to get a list of supported localizations (if the server supports the Multiple Sensor Locations feature).
The answer consists of the following fields:
xxRequired Op Code.
02Op Code not supported,
dataOptional, response data.
This sample uses the following nRF Connect SDK libraries:
In addition, it uses the following Zephyr libraries:
The sample also uses the following secure firmware component: