BLE Heart Rate Profile#
1. Purpose / Scope#
This application demonstrates how to configure RS9116W EVK Heart rate as GATT server in BLE peripheral mode and explains how to do indicate operation with GATT server from connected remote device using GATT client.
Also configure module as GATT client in BLE central mode and enables indicate operation of Heart rate service of connected remote GATT server from GATT client. In this Application, Heart rate GATT server configures with heart rate service with indicate characteristic UUID.
When connected remote device writes data to writable characteristic UUID, WiseConnect device receives the data which is received on writable characteristic UUID and writes the same data to readable characteristic UUID and sends indications to the connected device (or) remote device can read the same data using read characteristic UUID if indication enabled on client side.
2. Prerequisites / Setup Requirements#
Before running the application, the user will need the following things to setup.
2.1 Hardware Requirements#
Windows PC with Host interface(UART/ SPI/ SDIO).
Silicon Labs RS9116 Wi-Fi Evaluation Kit
Host MCU Eval Kit. This example has been tested with:
BLE Smart Phone with GATT client
2.2 Software Requirements#
Embedded Development Environment
Download and install the Silicon Labs EFR Connect App in the android smart phones for testing the BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.
3. Application Build Environment#
The Application can be built and executed on below Host platforms
3.2 Host Interface#
By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.
3.3 Project Configuration#
The Application is provided with the project folder containing Keil and Simplicity Studio project files.
The Keil project is used to evaluate the application on STM32.
The Simplicity Studio project is used to evaluate the application on EFR32MG21.
If the Radio Board is BRD4180A or BRD4181A, then access the path
If the Radio Board is BRD4180B or BRD4181B, then access the path
User can find the Radio Board version as given below
The Simplicity Studio project is used to evaluate the application on EFM32GG11.
3.4 Bare Metal/RTOS Support#
This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.
4. Application Configuration Parameters#
The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.
rsi_ble_heart_rate.c file and update/modify following macros,
4.1.1 User must update the below parameters
GATT_ROLE refers the role of the Silicon Labs module to be selected.
If user configures, SERVER, Silicon Labs module will act as GATT SERVER, means will add heart rate profile.
If user configures, CLIENT, Silicon Labs module will act as GATT CLIENT, means will connect to remote GATT server and get services and enable notify.
#define GATT_ROLE SERVER
RSI_BLE_DEV_ADDR_TYPE refers address type of the remote device to connect.
#define RSI_BLE_DEV_ADDR_TYPE LE_PUBLIC_ADDRESS
Valid configurations based on address type of the remote device are
Note: Depends on the remote device, address type will be changed.
RSI_BLE_DEV_ADDR refers address of the remote device to connect.
#define RSI_BLE_DEV_ADDR "00:23:A7:80:70:B9"
RSI_REMOTE_DEVICE_NAME refers the name of remote device to which Silicon Labs device has to connect.
#define RSI_REMOTE_DEVICE_NAME "SILABS_DEV"
Note: Silicon Labs module can connect to remote device by referring either RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAME of the remote device.
Power save configuration
By default, The Application is configured without power save.
#define ENABLE_POWER_SAVE 0
If user wants to run the application in power save, modify the below configuration.
#define ENABLE_POWER_SAVE 1
4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements
RSI_BLE_HEART_RATE_UUID refers to the attribute value of the newly created service.
#define RSI_BLE_HEART_RATE_SERVICE_UUID 0x180D
RSI_BLE_HEART_RATE_MEASUREMENT_UUID refers to the attribute type of the first attribute under this service (RSI_BLE_HEART_RATE_SERVICE_UUID`).
#define RSI_BLE_HEART_RATE_MEASUREMENT_UUID 0x2A37
RSI_BLE_SENSOR_LOCATION_UUID refers to the attribute type of the second attribute under this service (RSI_BLE_HEART_RATE_SERVICE_UUID`).
#define RSI_BLE_SENSOR_LOCATION_UUID 0x2A38
RSI_BLE_HEART_RATE_CONTROL_POINT_UUID refers to the attribute type of the second attribute under this service (
#define RSI_BLE_HEART_RATE_CONTROL_POINT_UUID 0x2A39
RSI_BLE_MAX_DATA_LEN refers to the Maximum length of the attribute data.
#define RSI_BLE_MAX_DATA_LEN 20
BLE_HEART_RATE_PROFILE refers name of the Repine device to appear during scanning by remote devices.
#define RSI_BLE_HEART_RATE_PROFILE "BLE_HEART_RATE_PROFILE"
Following are the non-configurable macros in the application.
RSI_BLE_CHAR_SERV_UUID refers to the attribute type of the characteristics to be added in a service.
#define RSI_BLE_CHAR_SERV_UUID 0x2803
RSI_BLE_CLIENT_CHAR_UUID refers to the attribute type of the client characteristics descriptor to be added in a service.
#define RSI_BLE_CLIENT_CHAR_UUID 0x2902
RSI_BLE_ATT_PROPERTY_READ is used to set the read property to an attribute value.
#define RSI_BLE_ATT_PROPERTY_READ 0x02
RSI_BLE_ATT_PROPERTY_WRITE is used to set the WRITE property to an attribute value.
#define RSI_BLE_ATT_PROPERTY_WRITE 0x08
RSI_BLE_ATT_PROPERTY_NOTIFY is used to set the NOTIFY property to an attribute value.
#define RSI_BLE_ATT_PROPERTY_NOTIFY 0x10
BT_GLOBAL_BUFF_LEN refers Number of bytes required by the application and the driver.
#define BT_GLOBAL_BUFF_LEN 15000
rsi_ble_config.h file and update/modify following macros,
#define RSI_BLE_PWR_INX 30 #define RSI_BLE_PWR_SAVE_OPTIONS 0
Zero indicate to below macro.
#define BLE_DISABLE_DUTY_CYCLING 0 #define BLE_DUTY_CYCLING 1 define BLR_DUTY_CYCLING 2 #define BLE_4X_PWR_SAVE_MODE 4
Opermode command parameters
#define RSI_FEATURE_BIT_MAP FEAT_SECURITY_OPEN #define RSI_TCP_IP_BYPASS RSI_DISABLE #define RSI_TCP_IP_FEATURE_BIT_MAP TCP_IP_FEAT_DHCPV4_CLIENT #define RSI_CUSTOM_FEATURE_BIT_MAP FEAT_CUSTOM_FEAT_EXTENTION_VALID #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP 0
rsi_ble_config.h files are already set with desired configuration in respective example folders user need not change for each example.
5. Testing the Application#
User has to follow the below steps for the successful execution of the application.
5.1 Loading the RS9116W Firmware#
Refer Getting started with PC to load the firmware into RS9116W EVK. The firmware binary is located in
5.2 Building the Application on the Host Platform#
5.2.1 Using STM32#
Refer STM32 Getting Started
Open the project
<SDK>/examples/snippets/ble/ble_heart_rate_profile/projects/ble_heart_rate_profile-nucleo-f411re.uvprojxin Keil IDE.
Build and Debug the project
Check for the RESET pin:
If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.
If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
Free run the project
Then continue the common steps from Section 5.3
5.2.2 Using EFX32#
Refer EFx32 Getting Started, for settin-up EFR & EFM host platforms
Import the EFR32/EFM32 project from
Select the appropriate .slsproj as per Radio Board type mentioned in Section 3.3 for EFR32 board. (or)
Select the *.brd2204a-gg11.slsproj for EFM32GG11 board.
Compile and flash the project in to Host MCU
Debug the project
Check for the RESET pin:
If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run
If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
Free run the project
Then continue the common steps from Section 5.3
5.3 Common Steps#
After the program gets executed, If Silicon Labs device is configured as SERVER specified in the macro GATT_ROLE, Silicon Labs will be in Advertising state.
Open a LE App in the Smartphone and do the scan.
In the App, Silicon Labs module device will appear with the name configured in the macro
RSI_BLE_HEART_RATE_PROFILE (Ex: "BLE_HEART_RATE_PROFILE")or sometimes observed as Silicon Labs device as internal name "SimpleBLEPeripheral".
Initiate connection from the App.
After successful connection, LE scanner displays the supported services of Silicon Labs module.
Select the attribute service which is added
Enable notify for the characteristic
So that GATT server indicates when value updated in that particular attribute.
Whenever the value is updated at server it will be notified to the client which can be read at Heart_Rate_Measurement attribute.
Refer the below images for notify operation from remote device GATT client.
When Silicon Labs device is configured as CLIENT specified in the macro GATT_ROLE, scans for remote device and tries to connect with the remote device specified in
RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAMEmacro.
Get all GATT profiles of remote device and Search for profile specified in the macro
RSI_BLE_HEART_RATE_SERVICE_UUID. And get all characteristics of the heartrate service and verify the characteristic
RSI_BLE_HEART_RATE_MEASUREMENT_UUIDwhich has notify property.
Observe notify property is enabled in the GATT server and indicates to the GATT client whenever the value is updated at server .
Also observe the updated heart rate measurement value on the teraterm.
After successful program execution, if the module configured as SERVER the print in teraterm looks as shown below.
After successful program execution, if the module configured as CLIENT the print in teraterm looks as shown below.
Compressed Debug Logging#
To enable the compressed debug logging feature please refer to Logging User Guide