STM32WBA Bluetooth® LE – Data Throughput Measurement

1. Introduction


2. Data Throughput

3. Requirements

3.1. Software and system requirements

3.2. Hardware requirements

3.3. Collector applications compatible

4. STM32WBA Data Throughput Server example description

4.1. Project directory

The "BLE_DataThroughput_Server" application is available by downloading STM32CubeWBA MCU Package[1].

Data Throughput Server project directory

4.2. Project description

4.2.1. Structure

Software project structure with the most important parts:

Data Throughput Server project structure


4.2.2. Application initialization

The different steps of the application initialization are described below:

4.2.3. GAP and GATT initialization and interaction

puce3.png

The Bluetooth LE Data Throughput Server application initialization is done within app_ble.c

  • Start the BLE stack - initialize the device as peripheral - configure and start advertising: ADV parameters, local name, UUID - APP_BLE_init()
  • Call the services controller initialization SVCCTL_Init() - svc_ctl.c
  • Manage the GAP event - SVCCTL_App_Notification()
    • EVT_LE_CONN_COMPLETE - provides information of the connection interval, slave latency, supervision timeout
    • EVT_LE_CONN_UPDATE_COMPLETE - provides the new information of the connection
    • EVT_DISCONN_COMPLETE - informs the application about the link disconnection and the reason
    • EVT_ENCRYPT_CHANGE - informs the application weather the link is encrypted
puce4.png

The Services management is done by the service controller - svc_ctl.c

  • Call the Initialization function of all the developed services - SVCCTL_SvcInit()
    • Data Throughput Service - DT_SERV_Init() - dt_serv.c
  • Register Services Event Handler - SVCCTL_RegisterSvcHandler(...)
  • Manage events - SVCCTL_UserEvtRx ()- from the BLE Host Stack and redirect them to the services registered - DT_SERV_EventHandler() - or gap event handler - SVCCTL_App_Notification
puce5.png

The Data Throughput Service dt_serv.c manages the specification of the service:

  • Service Init - DT_SERV_Init()
    • Register Data Throughput Event Handle to Service Controller - SVCCTL_RegisterSvcHandler(DT_SERV_EventHandler);
    • Initialize Service UUID – add Data Throughput service as Primary services

TBU

      • Initialize Heart rate measurement characteristic
      • Initialize Body Sensor location characteristic
  • Update Heart Rate measurement characteristic - HRS_UpdateChar()
  • Update Body Sensor location characteristic Value - HRS_UpdateChar()
  • Manage the GATT event from BLE Stack - DT_SERV_EventHandler()
    • ACI_GATT_WRITE_PERMIT_REQ_VSEVT_CODE
      • Reception of a Write Command: HR Control Point Characterictic Value
        • Send an aci_gatt_write_response() with an OK or KO status.
        • Notify the application to Reset Energy Expended - HRS_Notification(HRS_RESET_ENERGY_EXPENDED_EVT)
    • ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE
      • Reception of an attribute modification - HR Measurement Characteristics Description Value : ENABLE or DISABLE Notification
        • Notify application of the Measurement Notification - HRS_Notification(HRS_NOTIFICATION_ENABLED/DISABLED)
Heart Rate Sensor software module interaction
Connectivity HeartRate-Project.png


puce6.png

The application level of the Heart Rate Sensor is done with hrs_app.c:

  • Initialization of the context of the application
    • Measurement value flags support
    • Body sensor location - HRS_BODY_SENSOR_LOCATION_HAND
  • Receive notification from the Heart Rate Service - HRS_Notification()
  • When Heart rate measurement characteristics are enabled by the remote, simulate every 1 s the Heart Rate Measure (HRSAPP_Measurement) and increase the energy expended to transfer to the remote device (collector) - HRS_UpdateChar()

4.3. Build and install

4.4. How to use

4.5. UART debug trace

5. STM32WBA Data Throughput Client example description

5.1. Project directory

The "BLE_DataThroughput_Client" application is available by downloading STM32CubeWBA MCU Package[1].

Data Throughput Client project directory

5.2. Project description

5.2.1. Structure

Software project structure with the most important parts:

Data Throughput Client project structure


5.2.2. Application initialization

The different steps of the application initialization are described below:

5.2.3. GAP and GATT initialization and interaction

5.3. Build and install

5.4. How to use

5.5. UART debug trace