3.14 Bluetooth® Low Energy Throughput

The purpose of this section is to demonstrate the BLE Throughput application for the Curiosity board. The BLE_THROUGHPUT application is designed to demonstrate several functionalities including:
  1. Connection with mobile phone via BLE.
  2. Data transmission from the Curiosity board to smart phone via BLE and throughput evaluation.
  3. Data transmission from smart phone to the Curiosity board via BLE and throughput evaluation.

Data Format for Advertising

Advertising Data:

The Service Data type is used in advertising data. The data format is as illustrated below:

Figure 3-160. Advertisement Data Format
Note: 0xFEDA is a 16-bit Service UUID which is purchased by Microchip from Bluetooth SIG.

Scan Response Data: The device name is placed in the scan response. the device name is set as “BLE_UART_XXXX”. (XXXX are the last two bytes of the device address.)

Supported Services and Profiles: The supported service and profile are listed in the following section.

Services:

Profiles:

LED Indication: The LED indication is defined as following based on the different role and state:
  • Advertising State (No LE link existed): Green LED flashes one time every 500 ms.
  • Connected with peer device: Green LED is solid ON.

Interaction with MBD App

Interaction with MBD App: Working with iOS MBD App

Scanning and Connecting the Device: The steps to scan and connect to the device via MBD app are described as follows:

  1. Tap “BLE UART” feature in MBD App

    Figure 3-161. MBD App iOS Version
  2. Tap on the PIC32CXBZ.

    Figure 3-162. BLE UART GUI
  3. Tap on START
    Figure 3-163. PIC32CXBZ GUI
  4. Select BLE_UART_XXXX (XXXX are the last two bytes of the device address)

    Figure 3-164. “START” Scanning GUI

Firmware Version

  1. To verify firmware version, once LE is connected, tap the Setting Icon:
    Figure 3-165. Settings Icon
  2. The firmware version detail will be listed along with other Device Information as illustrated in the following figure.
    Figure 3-166. Firmware Revision in "Setting" GUI

Select Transparent Profile

There are two profiles supported by the MBD “BLE UART” App but “BLE_THROUGHPUT” firmware supports TRP only.
  1. Legacy Transparent Profile (TRP): Supported by “BLE_THROUGHPUT” firmware.
  2. Transparent Credit Based Profile (TRCBP): Not supported by “BLE_THROUGHPUT” firmware.

Select GATT Write Type

TRP profile supports both “Write with Response” and “Write without Response”, which is much higher than the former.

Figure 3-167. GATT Write Type in “Setting” GUI

Demo Modes

There are two demo modes:
  • Burst Mode: is designed for the throughput evaluation via massive data transmission.
  • Text Mode: is designed for the simple text typing.
Figure 3-168. Demo Modes in "Setting" GUI
  1. Burst Mode

    There are four data transfer modes supported in the Burst mode:

    1. Check sum Mode: MBD App to the device (uni-direction).
    2. Fixed Pattern Mode: Device to MBD App (uni-direction).
    3. Loop back Mode: MBD App → Device → MBD App (bi-direction).
    4. UART Mode:

      MBD App → Device → UART output to PC. UART input from PC → Device → MBD App (bi-direction). This mode is not supported by “BLE THROUGHPUT” firmware.

    Figure 3-169. BLE UART Mode in “Setting” GUI
  2. Text Mode

    There are two data transfer modes supported in the Text mode:
    1. Loop back Mode: MBD App → Device → MBD App (bi-direction).
    2. UART Mode: MBD App → Device → UART output. This mode is not supported by “BLE THROUGHPUT” firmware.
    Figure 3-170. Text Mode “Setting” GUI

Working with Android MBD App

The operation of Android MBD App is quite similar as the iOS version MBD App.

Throughput Evaluation

This section describes the Throughput Evaluation steps and provides a list of throughput figures tested with various phone models (for reference only). Additionally, it examines the factors influencing throughput.

Hardware Requirement

Table 3-27. Hardware Requirement
ToolQty

Curiosity board

1

Micro USB cable

1

Android/iOS Smartphone

1

Software Requirement

  • MPLAB X IPE: For programming the precompiled hex file.
  • MPLAB X IDE: For programming the application example.
  • Teraterm: Terminal Emulator for displaying UART output.

Smart Phone App

  • Microchip Bluetooth Data (MBD)

Programming the Precompiled Hex File or Application Example

Programming the .hex File using MPLAB X IPE

  1. Import and program the precompiled .hex file located in “<Harmony Content Path>\wireless_apps_ble\apps\ble_throughput\hex” folder
  2. For more information on the programming steps, refer to the Programming a Device in MPLAB IPE.
    Note: Users must choose the correct device and tool information.

Programming the Application using MPLAB X IDE

  1. Follow the steps mentioned in Running a Precompiled Example
  2. Open and program the application example “ble_throughput_xxxx.X” where xxxx refer to device (for example: WBZ451, project file: ble_throughput_wbz451.X) located in “<Harmony Content Path>\wireless_apps_ble\apps\ble_throughput\firmware" using MPLAB X IDE

For more details on finding the Harmony content path, refer to Installing the MCC Plugin.

Demo Description

Developing the Application from Scratch using MCC

This section explains the steps required by a user to develop this application example from scratch using MCC
Note: It is recommended that new users of MCC to go through the MPLAB® Code Configurator (MCC) User's Guide.
  1. Create a new MCC Harmony Project by selecting the device. For more details, refer to Creating a New MCC Harmony Project.
  2. Launch the MPLAB Code Configurator from the toolbar as illustrated below. The project graph will open with the default components.
    Figure 3-171. MCC
  3. In the Device Resources window, expand Libraries > Harmony > Wireless > Application Services. Then, click the Plus Symbol to add the BLE Config App Service Component to the project
    Figure 3-172. BLE Config App Service
  4. All BLE Stack related components will be added into the project graph. Accept dependencies or satisfiers by selecting Yes.
  5. For configuring BLE Config App Service component based on the device refer to Adding BLE Config App Service Component to Project Graph and Selecting the Device in Getting Started with WME Bluetooth Low Energy Applications from Related Links.
  6. Add and verify Transparent App Service Component configuration as illustrated in the following figure:
    Figure 3-173. Transparent App Service
  7. To enable digital and communication interfaces, refer to Enabling Digital Input/Output and Communication Interfaces Through System Hardware Definition (SHD) component in Getting Started with WME Bluetooth Low Energy Applications from Related Links.
  8. For FreeRTOS component settings refer to the Configuring FreeRTOS in Getting Started with WME Bluetooth Low Energy Applications from Related Links. Additionally, change FreeRTOS Component settings as illustrated in the following figure.
    Figure 3-174. FreeRTOS Configuration
  9. For WBZ451
    1. Change WBZ451-CURIOSITY Component setting as illustrated in the following figure
      Figure 3-175. WBZ451-CURIOSITY Configuration
    2. Verify if the project graph window has all the expected components. as illustrated in the following figure:
      Figure 3-176. Project Graph
  10. For WBZ451
    1. Change WBZ351-CURIOSITY Component setting as illustrated in the following figure image
      Figure 3-177. WBZ351-CURIOSITY Configuration
    2. Change SERCOM0 Component setting as illustrated in the following figure
      Figure 3-178. SERCOM0 Configuration
    3. Verify if the project graph window has all the expected components as illustrated in the following figure:
      Figure 3-179. Project Graph
  11. Change BLE Stack component configuration as illustrated in the following figure:
    Figure 3-180. BLE Stack Configuration
    Figure 3-181. BLE Stack Configuration
  12. Add and verify Device Information Service Component configuration as illustrated in the following figure:
    Figure 3-182. Device Information Service Configuration

Files Containing User Application Code

Source code for the application will be generated from the MCC interface by clicking Generate Code. User can add or edit the code in the highlighted files shown below.
Figure 3-183. Files
Details on files that user can modify
Table 3-28. Source Files
Source FilesUsage
app.cApplication State machine, includes calls for Initialization of all BLE stack (GAP,GATT, SMP, L2CAP) related component configurations
app_ble_callbacks.cAll the event functions related to GAP, GATT, SMP and L2CAP events that user can use or modify .
app_trsps_callbacks.cAll the event functions related to trspc event handles that user can use or modify.
app_utility.cContains generic utility functions that serve the purpose of providing reusable, common functionalities that can be applied across various parts of a program.
Note: app.c is auto generated and has a state machine based application code sample. Users can use this template to develop their application. Main application logic is implemented in void APP_Tasks() function.
Figure 3-184. app.c
Figure 3-185. app.c

The BLE Throughput Example Firmware Diagram

The BLE_THROUGHPUT firmware is designed for the Curiosity board. The firmware is based on TRP service. There are three data transfer modes supported by the BLE_THROUGHPUT firmware, including Check sum mode, Fixed pattern mode and Loop back mode. To simplify, the UART mode is not implemented in this example. The firmware diagram below illustrates the main part of the firmware.
Figure 3-186. Example Firmware Diagram

References