
Application Note RE01B Group Bluetooth Low Energy Sample code (using CMSIS Driver Package) Introduction This application note describes the sample code of the application (hereinafter referred to as BLE application) which controls Bluetooth® Low Energy communication and uses RE01 Group CMSIS Driver Package. Target Device RE01B Group Related Documents • Bluetooth Core Specification (https://www.bluetooth.com) • RE01B Group Product with 1.5-Mbyte Flash Memory User’s Manual: Hardware (R01UH0903) • Getting Started Guide to Development Using CMSIS Package (R01AN5310) • e2 studio Getting Started Guide (R20UT4204) • RE01B Group Tuning procedure of Bluetooth dedicated clock frequency (R01AN5488) • Bluetooth Low Energy Profile Developer’s Guide (R01AN5638) • RE01B Group Bluetooth Low Energy Application Developer’s Guide (R01AN5643) • Bluetooth Low Energy MCU Bluetooth Test Tool Suite operating instructions (R01AN4554) • RE01B Group IAR Embedded Workbench for Arm patch Setup Guide (R20AN0596) The Bluetooth® word mark and logos are registered trademarks owned by Bluetooth SIG, Inc. and any use of such marks by Renesas Electronics Corporation is under license. Other trademarks and registered trademarks are the property of their respective owners. R01AN5606EJ0220 Rev.2.20 Page 1 of 109 Jul.30.2021 RE01B Group Bluetooth Low Energy Sample code (using CMSIS Driver Package) Contents 1. Overview ................................................................................................................................. 4 1.1 BLE module ............................................................................................................................................. 5 1.2 Software Structure ................................................................................................................................... 6 1.3 Directory / File structure .......................................................................................................................... 7 2. Sample code............................................................................................................................ 8 2.1 Operating environment ............................................................................................................................ 8 2.2 Startup procedure .................................................................................................................................... 9 2.3 Using sample code .................................................................................................................................. 9 2.4 Programming firmware .......................................................................................................................... 10 2.5 Importing sample code .......................................................................................................................... 14 2.5.1 In case of e2 studio .............................................................................................................................. 14 2.5.2 In case of EWARM .............................................................................................................................. 15 2.6 Building and debugging ......................................................................................................................... 16 2.6.1 In case of e2 studio .............................................................................................................................. 16 2.6.2 In case of EWARM .............................................................................................................................. 16 2.7 GATT Server sample code .................................................................................................................... 17 2.8 GATT Client sample code ..................................................................................................................... 21 2.9 A/D converter (ADC) + Bluetooth operation sample code .................................................................... 23 2.10 HCI mode sample code ......................................................................................................................... 25 3. BLE module detail ................................................................................................................. 26 3.1 BLE Protocol Stack................................................................................................................................ 26 3.1.1 Structure .............................................................................................................................................. 26 3.1.2 Features overview ............................................................................................................................... 29 3.1.3 Operation overview ............................................................................................................................. 32 3.2 app_lib (Application Library) .................................................................................................................. 34 3.2.1 Structure .............................................................................................................................................. 34 3.2.2 Features overview ............................................................................................................................... 34 3.3 Configuration options ............................................................................................................................ 35 3.4 Abstraction API ...................................................................................................................................... 40 3.5 Software timer ....................................................................................................................................... 40 3.6 Profile common ...................................................................................................................................... 43 3.7 Logger ................................................................................................................................................... 44 3.8 Command Line ...................................................................................................................................... 46 3.8.1 Standard command ............................................................................................................................. 47 3.8.2 User command creation procedure ..................................................................................................... 67 3.9 LED and Switch control ......................................................................................................................... 68 3.9.1 Changing board ................................................................................................................................... 68 3.10 MCU low power consumption ................................................................................................................ 69 4. Create project ........................................................................................................................ 71 4.1 Import a project ...................................................................................................................................... 71 4.2 Stack/Heap size configuration ............................................................................................................... 71 4.3 Clocks configuration .............................................................................................................................. 72 R01AN5606EJ0220 Rev.2.20 Page 2 of 109 Jul.30.2021 RE01B Group Bluetooth Low Energy Sample code (using CMSIS Driver Package) 4.4 Linker configurations ............................................................................................................................. 73 5. How to implement user code ................................................................................................. 76 5.1 Behavior of skeleton program ............................................................................................................... 78 5.2 app_main function ................................................................................................................................. 79 5.2.1 Initialize process (ble_init function) ..................................................................................................... 80 5.2.2 Main loop and scheduler (R_BLE_Execute) ....................................................................................... 83 5.3 GAP event (gap_cb function) ................................................................................................................ 84 5.4 GATTS event (gatts_cb function) .......................................................................................................... 86 5.5 GATTC event (gattc_cb function) .......................................................................................................... 87 5.6 VS event (vs_cb function) ..................................................................................................................... 88 5.7 Server-side Profile API event ([service_name]s_cb function) ............................................................... 89 5.8 Client-side Profile API event ([service_name]c_cb function) ...............................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages111 Page
-
File Size-