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.

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.
  1. Create a new harmony project. For more details, see Creating a New MCC Harmony Project from Related Links.
  2. Open the MPLAB Code Configurator:
    Figure 5-1. MCC
    Default MPLAB Code Configurator window shown as follows.
    Figure 5-2. Default MCC Window
  3. 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
  4. 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
  5. Verify the Project Graph.
    Figure 5-7. Project Graph
    Figure 5-8. 
  6. 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.
  7. Click on the BLE Stack component in project graph, open Configuration Options and
    1. Peripheral Device functionality is enabled by default, this must be unchecked (BLE Stack>Generic Access Profile (GAP)>Peripheral)
    2. Central configuration must be checked (BLE Stack>Generic Access Profile (GAP)>Central)
    Figure 5-10. BLE Stack
  8. To generate the code, refer to MPLAB Code Configurator (MCC) Code Generation from Related Links.
  9. Build Project and upon building the project, user action is required. For more information, refer to User Action from Related Links.
  10. Switch to MPLAB X IDE window and Build Project. The project must compile successfully.
  11. Choose the correct compiler version, as suggested in Development Environment, refer to Getting Started with Software Development from Related Links.