5.1.1.1 Central - FreeRTOS BLE Stack and App Initialization
This section explains how to create a new MCC Harmony project, configure the FreeRTOS and BLE stack components in the project and generate code using the MPLAB Code Configurator (MCC).
It is recommended to follow the examples in sequence to understand the basic concepts before progressing to the advanced topics.
Recommended Readings
- Getting Started with Application Building Blocks – See Building Block Examples from Related Links.
- Getting Started with Peripheral Building Blocks – See Central Devices from Related Links.
- FreeRTOS and BLE Stack Setup – See Central - FreeRTOS BLE Stack and App Initialize from Related Links.
- See BLE Legacy Scan from Related Links.
- BLE Software Specification – See MPLAB® Harmony Wireless BLE in Reference Documentation from Related Links.
Hardware Requirement
None
Software Setup
Refer to Getting Started with Software Development from Related Links.
Initiating a BLE Stack
Follow the steps below to build the application manually:
Note: It is
recommended for the new users of the MPLAB Code Configurator to refer MPLAB® Code Configurator (MCC) User’s Guide in
Reference Documentation from Related Links.
- Create a new harmony project. For more details, see Creating a New MCC Harmony Project from Related Links.
- Open the MPLAB Code Configurator:
Figure 5-1. MCC Default MPLAB Code Configurator window shown as follows.Figure 5-2. Default MCC Window - To add the BLE Stack component to the project graph, go to Harmony>Wireless>Drivers>BLE>BLE Stack from the “Device Resources” field as illustrated in the following figure.
Figure 5-3. BLE Stack Figure 5-4. Project Graph - Upon selection, user will receive a prompt for auto-activation and auto-connect request of different component dependencies. Select Yes to add all the dependent components and also for all attachment auto-connect requests.
Figure 5-5. Auto-Activation Figure 5-6. Auto-Activation and Auto-Connect - Verify the Project Graph.
Figure 5-7. Project Graph Figure 5-8. - Click on the FreeRTOS component in project graph, open Configuration Options and configure as illustrated in the following image. the configuration must suit most application needs. It is recommended to refer the FreeRTOS Customization in Reference Documentation from Related Links.
Figure 5-9. FreeRTOS Note: Upon selecting any component, the default configuration options available for the user are displayed. - Click on the BLE Stack component in
project graph, open Configuration Options and
- Peripheral Device functionality is enabled by default, this must be unchecked (BLE Stack>Generic Access Profile (GAP)>Peripheral)
- Central configuration must be checked (BLE Stack>Generic Access Profile (GAP)>Central)
Figure 5-10. BLE Stack - To generate the code, refer to MPLAB Code Configurator (MCC) Code Generation from Related Links.
- Build Project and upon building the project, user action is required. For more information, refer to User Action from Related Links.
- Switch to MPLAB X IDE window and Build Project.
The project must compile successfully.
Choose the correct compiler version, as suggested in Development Environment, refer to Getting Started with Software Development from Related Links.