4.1.2.1 Peripheral - FreeRTOS BLE Stack and App Initialize
This section provide details on creating a new MCC Harmony project, configure the FreeRTOS and BLE stack components in the project and generate code using the 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 BLE Stack
Follow the steps below to build the application manually:
Note: It is
recommended for the new users of the MCC 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 MCC.
Figure 4-51. MCC -
Default MCC window is illustrated as follows.
Figure 4-52. 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 4-53. BLE Stack - 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 4-54. Auto-Activation and Auto-Connect Verify the Project Graph
Figure 4-55. Project Graph - Click on the FreeRTOS component in project
graph, open Configuration options and configure as illustrated in the following
figure. the configuration must suit most application needs. It is recommended to
refer the FreeRTOS Customization in Referenced Documentation from
Related Links.
Figure 4-56. FreeRTOS Configuration Note:- Upon selecting any component, the default configuration options available for the user are displayed.
- By default, the
“Total heap size” is set to a default value which might not be
sufficient to a specific project. If the total heap size is not
enough,
vApplicationMallocFailedHook( )will be caught. Then user can adjust the “Total heap size” to avoid this situation. - It is required to
address the heap needed or BLE stack library as defined in
initialization.c#define EXT_COMMON_MEMORY_SIZE (22*1024). Hence the default “Total heap size”.
- 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 4-57. BLE Stack Configuration - 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 Tools and Harmony Component Versions, refer to Getting Started with Software Development from Related Links.
