Creating a Heart Rate Sensor Using the Bluetooth Developer Studio and the Kinetis BLE Stack

Document created by TudorS. Employee on Oct 25, 2016
Version 1Show Document
  • View in full screen mode

This article will describe in detailed steps how to generate, build and test a Bluetooth low energy Heart Rate Sensor project on the FRDM-KW41Z evaluation board by using the Bluetooth Developer Studio (BDS) and the NXP Kinetis BDS Plug-in.

 

Getting Started

To use this plug-in and test its output, the following programs are required:

 - Bluetooth Developer Studio v1.1.306 or newer: Bluetooth Developer Studio & Plugins | Bluetooth Technology Website 

 - NXP Semiconductors Kinetis Plug-in v1.0.0: Link

 - Kinetis SDK 2.0 with support for MKW41Z and Bluetooth Stack version 1.2.2: Link

 - Kinetis SDK 2.0 add-on for BDS (found in the same package as the plug-in)

 - Kinetis BLE Toolbox Android or iOS mobile application

 

To enable the NXP Kinetis BDS Plug-in in the Bluetooth Developer Studio, follow please the installation details in the readme.txt document included in the downloaded plug-in archive.

 

Creating the project with BDS

Create a new project by clicking FILE-> NEW PROJECT. Add project location, name and namespace as detailed below:

 

 

Drag and drop an adopted Heart Rate Profile from the right hand side list. Your device should import the following services:

 

 

Next step will be to configure the GAP layer. Click on the GAP button. First tab will be the Advertising Data. Enter desired values and check which AD types you want to include in the advertising packets. A bar below will show you how much bytes your data uses. Make sure you do not use more than the 32 bytes available.

 

 

Next step is to configure the GAP properties. Make sure you check at least one advertising channel and a reasonable advertising interval range, as presented below:

 

 

 

Click TOOLS->GENERATE CODE. Select Server as GATT side to be generated and NXP Semiconductors Kinetis v1.0.0 as the plug-in. BDS will prompt you to enter a location for the exported files.

 

 

After generating the files, another window with the results log will appear. If no error messages appear, the generation is successful. Check the “Open output location when finished” box and hit the “Finish” button. A folder with the following content will open:

 

 

 

Using the generated code

Copy the contents inside the following folder:

 "<SDK 2.0 installation folder>\middleware\wireless\bluetooth_1.2.2\examples\bds_template_app".

To generate the “bds_template_app” embedded project and test it, follow the instructions detailed in the Bluetooth Quick Start Guide document from the SDK.

 

Seeing the application in action

Before compiling the application add the following code snippet in app.c inside BleApp_HandleKeys:

        case gKBD_EventPressPB2_c:

        {

            mUserData.cRrIntervals = 0;

            mUserData.expendedEnergy = 100;

            Hrs_RecordHeartRateMeasurement(service_heart_rate, 120, &mUserData);

            break;

        }

This will allow the board to send heart rate data of 120 bpm while in a connection and when pressing button SW3 on the FRDM-KW41Z board. The value can be seen when using Kinetis BLE Toolbox, as shown below:

 

2 people found this helpful

Attachments

    Outcomes