STM32WBA Bluetooth® LE – Data Throughput Measurement

Revision as of 13:18, 8 February 2023 by Registered User (→‎Introduction)

1. Data Throughput

Data Throughput applications (BLE_DataThroughput_Client and BLE_DataThroughput_Server) are proprietary applications used to measure the throughput between devices according to different parameters, 1M or 2M PHY, different connection intervals.

The Data Throughput Server is the device exposing three characteristics to be controlled by the remote client​

  • Characteristics DATA_TRANSFER_TX (Notification) to notify data from Server TO Client​
  • Characteristics DATA_TRANSFER_RX (Write) to Send data from Client TO Server​
  • Characteristics DATA_TRANSFER_TX_RX_INFO (Notification) to notify throughput measurement of data received

The Central & GATT Client Collector can be three different applications​

  • Data Throughput Client to measure performances between 2 STM32WBA devices​
  • Smartphone ST BLE Toolbox to performs Smartphone benchmarking​
  • Web Bluetooth Interface to use laptop

This wiki page is the description of the Data throughput project provided within the STM32CubeWBA MCU Package[1]

Bluetooth® LE Data Throughput project & STM32WBA


The table below describes the structure of Data Throughput service:

Bluetooth® LE Data Throughput project & STM32WBA


Example 1 of flow diagram between a Data Throughput server (STM32WBA) & a Client Collector


Example 2 of flow diagram between a Data Throughput server (STM32WBA) & a Client Collector


1.1. STMicrolectronics Manufacturer Advertising Data

2. Requirements

2.1. Software and system requirements

2.2. Hardware requirements

2.3. Collector applications compatible

3. STM32WBA Data Throughput Server example description

3.1. Project directory

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

Data Throughput Server project directory

3.2. Project description

3.2.1. Structure

Software project structure with the most important parts:

Data Throughput Server project structure


3.2.2. Application initialization

The different steps of the application initialization are described below:

Data Throughput Server project initialization
puce1.png
  • Initialize the system (HAL, Clock, Power Mode, RTC IP, Timer Server)
  • Infinite loop for run mode
puce2.png
  • Initialize the BSP (LEDs, buttons…), Transport Layer Interface, Debugger
  • Wait for initialization done
puce3.png
  • Initialize the Bluetooth® LE App – GAP level
  • Manage GAP events (advertising,scanning)
puce4.png
  • Initialize the Bluetooth® LE App – GATT level
  • Initialize the Bluetooth® LE Stack
  • Manage GATT events
puce5.png
  • Register Event Handler
  • Initialize and manages services
  • Update characteristic
puce6.png
  • Initialize the context
  • Manage Data Throughput Service notification

3.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

  • Update Data Throughput DT_SERV_THROUGH measurement characteristic - DT_SERV_UpdateValue()
  • Update Data Throughput DT_SERV_TX characteristic Value - DT_SERV_UpdateValue()
  • Manage the GATT event from BLE Stack - DT_SERV_EventHandler()
    • ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE
      • Reception of a Write Command: DT_SERV_RX Characteristic Value
    • ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE
      • Reception of an attribute modification - DT_SERV_TX Value : ENABLE or DISABLE Notification
      • Reception of an attribute modification - DT_SERV_THROUGH Value : ENABLE or DISABLE Notification
        • Notify application of the Transmitted Data - DT_SERV_Notification(DT_SERV_TX_CHAR)
        • Notify application of the Received Data - DT_SERV_Notification(DT_SERV_THROUGH_CHAR)
Data Throughput Server software module interaction


puce6.png

The application level of the Data Throughput Server is done with dt_serv_app.c:

  • Initialization of the context of the application
    • TBC
    • TBC
  • Receive notification from the Data Throughput Service - DT_SERV_Notification()
  • When Data Throughput TX characteristic is enabled by the remote, data are sent continuously DT_SERV_UpdateValue(DT_SERV_TX_CHAR)
  • When Data Throughput THROUGH characteristic is enabled by the remote, on reception of data (DT_SERV_RX_CHAR) the calculation of received data is done and sent every second DT_SERV_UpdateValue(DT_SERV_THROUGH_CHAR)

3.3. Build and install

Follow the steps described in Bluetooth® LE Build and Install Application page, applying them for STM32WBA BLE_DataThroughput_Server project.

3.4. How to use

3.5. UART debug trace

4. STM32WBA Data Throughput Client example description

4.1. Project directory

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

Data Throughput Client project directory

4.2. Project description

4.2.1. Structure

Software project structure with the most important parts:

Data Throughput Client 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

4.3. Build and install

Follow the steps described in Bluetooth® LE Build and Install Application page, applying them for STM32WBA BLE_DataThroughput_Client project.

4.4. How to use

4.5. UART debug trace