4.1.2.1 Peripheral - FreeRTOS BLE Stack and App Initialize
Getting Started with Peripheral Building Blocks
FreeRTOS and BLE Stack Setup --> Adding UART --> Legacy Advertisements(sleep)
Introduction
This document will help users create a new MCC Harmony project, configure FreeRTOS component and BLE stack component in the project and generate code using the MPLAB Code Configurator.
It is recommend to follow the examples in order, by learning the basic concepts first and then progressing to the more advanced topics.
Recommended Reading
Hardware Requirement
None
Software Setup
Steps to Init BLE Stack
Create a new MCC Harmony Project. For more details on creating a new MCC Harmony Project, refer to 3.4 Creating a New MCC Harmony Project .
- Open MPLAB Code Configurator.Default MPLAB Code Configurator window
- In Available component window, expand Wireless > BLE and click plus symbol the BLE stack component on to the project graph
Upon BLE Stack being added to project graph, the different component dependencies will be requested to be added. User has to select yes to add the dependant component
- Activate the components and select yes
Verify Project Graph
- Display FreeRTOS component configuration options by Selecting the component in Project Graph. Configure FreeRTOS component to the following. The configuration chosen here must suit most application needs. Users are recommended to follow the FreeRTOS Customization documented in Customization, accordingly.Note: Upon selecting any component, the default configuration options available for user are displayed.Note: 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 caght. Then user can adjust the "Total heap size" to avoid this situation.Note: 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" allocated by core component is not sufficient. Allocate atleast
59392
size Display BLE Stack component configuration options by Selecting the component in Project Graph.
Default Configuration: Peripheral Device functionality is enabled by default.For more details on code generation , refer to Generate Code
Switch to IDE window, right click on project and open Project Properties
Ensure correct compiler version as suggested inGetting Started with Software Development is chosen
- Build Project, upon building project user action is required as mentioned 13.1 User Action
Build Project. The project will compile successfully.