STM32WBA Bluetooth® LE – Data Throughput Measurement

Revision as of 19:20, 6 February 2023 by Registered User (→‎Data Throughput)

1. Introduction


2. Data Throughput

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 2 STM32WBAs or STM32WBA & ST BLE Toolbox


Example 2 of flow diagram between 2 STM32WBAs or STM32WBA & ST BLE Toolbox


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[2].

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:

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

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

  • 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)

4.3. Build and install

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

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[2].

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

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

5.4. How to use

5.5. UART debug trace