Basic BLE Project
Table of Contents
- Introduction
- ble_app_services
- basic_advertise
- basic_peripheral
- basic_central
- Configuration
- Hardware Prerequisites
- Software Prerequisites
Introduction
The basic_ble_project
project is a BLE framework that enables the user
to simply add one function appMain() in order to run full BLE application
The basic_ble_project
is a set of ble services and project task and empty appMain() function
ble_app_services
- Support creation of App and ICALL tasks, creation of App queue and event
- The application itself is app_main.c which is empty application using app_empty.c
- The app_empty.c can be replaced by user application, currently we have 3 samples: advertise, peripheral, central
- Support logger, UartLog module
- Supported services:
- Init - bleApp_stackInit – init GAP/BOND/GATT modules, configuration from SysConfig
- Advertise - bleStack_initAdvSet – init GAP advertising info
- Scan - bleApp_scanInit – initiate the can process, scan params can be configured by SysConfig
- Pairing/Bonding
- bleApp_processPairState – process GapBond callbacks
- bleApp_processPasscode – process GapBond callbacks
- Switch context - bleApp_enqueueMsg – for the user to switch context, used on user callbacks
- Connection list - bleApp_addConn, bleApp_removeConnInfo – support list of 4 connections
- Service discovery
- bleApp_startServiceDiscovery – for central to start the service discovery
- bleApp_processGATTServiceDiscoveyEvent – handle service discovery states till done
- bleApp_findServiceUuid – used by central to find certain UUID in the services
- GATT
- bleApp_processGATTMsg – process GATT events
- bleApp_setGattRead
- bleApp_setGattWrite
basic_advertise
The basic_advertise
application starts legacy advertisement by calling bleStack_initAdvSet().
Remove CONNECTABLE from ADV params, SysConfig: BLE-->Broadcaster Configuration-->Advertisement Parameters 1-->Legacy Event Properties Options-->Scannable undirected * Supports: * Legacy advertisement configured by SysConfig
basic_peripheral
The basic_peripheral
application initiates the simple profile services by calling bleApp_initProfiles()
On event INIT_DONE, the application starts legacy advertisement by calling bleStack_initAdvSet()
On event GAP_LINK_ESTABLISHED_EVENT, the connection is done and the application restart the ADV set to enable more connections
On GATT read from central, the value is ready and there is no application calls
On GATT write from central, event BLEAPP_EVT_CHAR_CHANGE, just print the change
- Supports:
- Legacy advertisement configured by SysConfig
- 4 connections
- Update link params
- Pairing/Bonding
- Simple profile r/w
basic_central
The basic_central
application initiates scan discovery of devices by bleApp_scanInit(), wait for scan reports
event BLEAPP_EVT_ADV_SCAN_REPORT, searching for SIMPLEPROFILE_SERV_UUID (save as a connection candidate).
On scan done by event BLEAPP_EVT_SCAN_DISABLED, the application connect to the candidate by GapInit_connect() and
wait for the connection to be established
On connection established, by event GAP_LINK_ESTABLISHED_EVENT the application start service discovery by calling bleApp_startServiceDiscovery() searching for service SIMPLEPROFILE_SERV_UUID and characteristic SIMPLEPROFILE_CHAR1_UUID
On service discovery done by event GATT_MSG_EVENT and return value of 1 from bleApp_processGATTMsg the application writes value 0x55 to SIMPLEPROFILE_CHAR1_UUID
- Supports:
- Scan
- Auto connect by Simple profile UUID
- Service discovery
- Pairing/Bonding
- GATT read/write
Configuration
This project has the following app configurations available:
App Build Configuration | Description |
---|---|
FlashROM_Release (default) | All TI-RTOS debug features disabled but application-logging to UART remains enabled. The application uses the config file ble_release.cfg and the defines are in <app name>_FlashROM_Release.opt . |
FlashROM_Debug | All TI-RTOS debug features enabled. The application uses the config file ble_debug.cfg and the defines are in <app name>_FlashROM_Debug.opt . |
All application configurations use the stack library configuration, FlashROM_Library. This build configuration will yield additional flash footprint optimizations by the linker since the application and stack can share contiguous flash pages. This configuration is further discussed in the Stack Library Configuration section of the BLE5-Stack User's Guide provided in the SDK.
Hardware Prerequisites
The default Basic ble project board configuration uses the device's LaunchPad development kit. This hardware configuration is shown in the below image:
For custom hardware, see the Running the SDK on Custom Boards section of the BLE5-Stack User's Guide.
Software Prerequisites
For information on what versions of Code Composer Studio and IAR Embedded Workbench to use, see the Release Notes file provided in the SDK. For information on how to import this project into your IDE workspace and build/run, please refer to the device's Platform section in the BLE5-Stack User's Guide.