3.11 Bluetooth® Low Energy Transparent UART Central with LE Coded PHY
This section assists users in creating a central device and sending/receiving characters between two connected BLE devices over Microchip proprietary Transparent UART Profile. The central and peripheral devices using LE Coded PHY in this section are two devices. The following instructions are applicable for a BLE Central device.
User can either choose to just run the precompiled application example
.hex
file on the Curiosity board and experience the demo or can go
through the steps involved in developing this application from scratch.
These examples are incrementally structured upon one another. Recommendation is to follow the examples in order, by learning the basic concepts first and then progressing to the more advanced topics.
Recommended Reading
- BLE Software Specification
- Getting Started with WME Bluetooth Low Energy Applications
Hardware Requirement
Tool | Qty |
---|---|
Curiosity Board | 2 |
Micro USB cable | 2 |
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.
Programming the Precompiled Hex file or Application Example
Programming the .hex
File using MPLAB X IPE
-
Precompiled
.hex
file for central is located in “<Harmony Content Path>\wireless_apps_ble\apps\central_trp_uart_codedPhy\hex
” folder - Precompiled
.hex
file for peripheral is located in “<Harmony Content Path>\wireless_apps_ble\apps\peripheral_trp_uart_codedPhy\hex
” folder - 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 MPLABX IDE
- Follow the steps mentioned in Running a Precompiled Example
- Open and program the central
application example “
central_trp_uart_codePhy_xxxx.X
” where xxxx refer to device (for example: WBZ451, project file:central_trp_uart_codePhy_wbz451.X
) located in “<Harmony Content Path>\wireless_apps_ble\apps\central_trp_uart_codedPhy\firmware
“ using MPLAB X IDE - Open and program the peripheral
application example “
peripheral_trp_uartcodePhy_xxxx.X
” where xxxx refer to device (for example: WBZ451, project file:peripheral_trp_uartcodePhy_wbz451.X
) located in “<Harmony Content Path>\wireless_apps_ble\apps\peripheral_trp_uartcodePhy\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
- Create a new MCC Harmony Project by selecting the device. For more details, refer to Creating a New MCC Harmony Project.
- Launch the MPLAB Code Configurator from the toolbar as illustrated below. The
project graph will open with the default components.
Figure 3-120. MCC - In the Device Resources window,
expand Libraries > Harmony > Wireless > Application
Services. Then, click the Plus Symbol to add the
Transparent App Service Component to the project
Figure 3-121. Transparent App Service - All BLE Transparent App Service-related components will be added into the project graph. Accept dependencies or satisfiers by selecting Yes.
- 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.
- 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.
- Change the Transparent App
Service component settings as illustrated in the following figure.
Figure 3-122. Transparent App Service - Change FreeRTOS component
settings, refer to Configuring FreeRTOS in Getting Started with WME
Bluetooth Low Energy Applications from Related Links. Additionally
change the setting as illustrated in the following figure
Figure 3-123. FreeRTOS Configuration - Verify the SERCOM0 Component settings, refer to SERCOM0 Settings for Applications in Getting Started with WME Bluetooth Low Energy Applications from Related Links. Additionally change the SERCOM0 component settings as illustrated in the following figure.
- For WBZ451
- Change SERCOM0
Component setting as illustrated in the following figure
Figure 3-124. SERCOM0 Configuration - Verify if the project
graph window has all the expected components, as illustrated in the
following figure:
Figure 3-125. Project Graph
- Change SERCOM0
Component setting as illustrated in the following figure
- For WBZ351
- Change SERCOM0
Component setting as illustrated in the following figure
Figure 3-126. SERCOM0 - Verify if the project
graph window has all the expected components, as illustrated in the
following figure:
Figure 3-127. Project Graph
- Change SERCOM0
Component setting as illustrated in the following figure
- Change BLE Stack Component
configuration by selecting Enable Extended Scan and Scan PHY to
“Scan advertisement on the LE 1M PHY and LE Coded PHY” as illustrated in the
following figure.
Figure 3-128. BLE Stack
Generating a Code
For more details on code generation, refer to the MPLAB Code Configurator (MCC) Code Generation.
Files Containing User Application Code
Details on files that user can modify
Source Files | Usage |
---|---|
app.c | Application State machine, includes calls for Initialization of all BLE stack (GAP,GATT, SMP, L2CAP) related component configurations |
app_ble_callbacks.c | All the event functions related to GAP, GATT, SMP and L2CAP events that user can use or modify . |
app_trspc_callbacks.c | All the event functions related related to
trspc event handles that user can use or
modify. |
app_utility.c | Contains generic utility functions that serve the purpose of providing reusable, common functionalities that can be applied across various parts of a program. |
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.app.c
app.c