This document describes how to get started with Bluetooth
development using the Bluetooth software development kit (SDK)
and Simplicity Studio with a compatible wireless starter kit (WSTK).
If you have purchased a Blue Gecko Bluetooth Wireless Starter Kit
you can first experiment with precompiled demos and an Android
or iOS smartphone app before continuing with your own application
development.
KEY POINTS
• Introducing the Bluetooth development
environment.
• Using the Blue Gecko Wireless Starter K it
demos and Android or iOS smartphone
app to demonstrate Bluetooth features.
• Installing the Bluetooth SDK in Simplicity
Studio.
• Starting application development for Bluetooth dev ices with Simplicity Studio.
silabs.com | Building a more connected world. Rev. 1.7
QSG139: Bluetooth® SDK v2.x Quick Start Guide
Introduction
1 Introduction
This document describes how to get started with Bluetooth development using Silicon Labs products. It introduces the features of the
Silicon Labs Bluetooth stack and the resources available to help with development. Application development is started using the Silicon
Labs development environment Simplicity Studio and the Bluetooth Software Development Kit (SDK). The SDK comes with a number of
example application that you can then modify to create your own applications. If you are developing with an EFR32BG device and have
purchased a Blue Gecko Bluetooth Wireless Starter Kit, you can use precompiled demos and an Android or iOS smartphone app to
demonstrate Bluetooth software features.
This document describes the following:
• Bluetooth Stack features and components (see section 2 About the Bluetooth Stack)
• Installing Simplicity Studio and the Bluetooth SDK (see section 3 Getting Started with Simplicity Studio and the Bluetooth SDK
• A description of the precompiled demos and example code available in the SDK (see section 4 About Demos and Examples)
• How to test prebuilt demo software with either an iOS or Android smartphone app (see section 5 Getting Started with Bluetooth Demo
Software)
• How to develop your own applications in Simplicity Studio (see section 6 Starting Application Development)
• A description of other section 7 Development Tools that are useful in the development process
1.1 Prerequisites
As well as Simplicity Studio v4, you should have the following before beginning application development:
• A basic understanding of Bluetooth technology and terminology. UG103.14: Bluetooth LE Fundamentals provides a good starting
point if you have not yet learned about Bluetooth.
• A compatible compiler:
• Simplicity Studio comes with a free GCC C-compiler.
• IAR Embedded Workbench for ARM (IAR-EWARM) can also be used as the compiler for all Silicon Labs protocols. See the
Bluetooth SDK’s release notes for the compatible IAR-EWARM version.
• A registered account at Silicon Labs is required in order to download the Silicon Labs Bluetooth SDK.
• You can register at https://siliconlabs.force.com/apex/SL_CommunitiesSelfReg?form=short
To get a 30-day evaluation license for IAR:
• Go to the Silicon Labs support portal at https://www.silabs.com/support
• Scroll down to the bottom of the page, and click Contact Support
• If you are not already signed in, sign in.
• Click the Software Releases tab. In the View list select Development Tools. Click Go. In the results is a link to the IAR-EWARM
version named in the release notes.
• Download the IAR package (takes approximately 1 hour).
• Install IAR.
• In the IAR License Wizard, click Register with IAR Systems to get an evaluation license.
• Complete the registration and IAR will provide a 30-day evaluation license.
• Once IAR-EWARM is installed, the next time Simplicity Studio starts it will automatically detect and configure the IDE to use IAR-
EWARM.
.
.
1.2 Support
You can access the Silicon Labs support portal at https://www.silabs.com/support
in section 3.7 Accessing Documentation and Other Resources. Use the support portal to contact Customer Support for any questions
you might have during the development process.
silabs.com | Building a more connected world. Rev. 1.7 | 2
through Simplicity Studio’s Resources tab, as described
QSG139: Bluetooth® SDK v2.x Quick Start Guide
Introduction
1.3 Documentation
Documentation for the Bluetooth SDK is summarized in the following figure.
silabs.com | Building a more connected world. Rev. 1.7 | 3
QSG139: Bluetooth® SDK v2.x Quick Start Guide
Introduction
SDK documentation is accessed through Simplicity Studio, as described in section 3.7 Accessing Documentation and Other Resources.
Other resources available include Knowledge Base Articles (KBAs)
Simplicity Studio.
and Hardware documentation. All may be accessed through links in
Training materials are available on the Silicon Labs website at https://www.silabs.com/support/training/bluetooth and on
labs.com/bluetooth/latest/.
https://docs.si-
silabs.com | Building a more connected world. Rev. 1.7 | 4
QSG139: Bluetooth® SDK v2.x Quick Start Guide
Introduction
1.4 Gecko Platform
The Gecko Platform is a set of drivers and other lower layer features that interact directly with Silicon Labs chips and modules. Gecko
Platform components include EMLIB, EMDRV, RAIL Library, NVM3, and mbedTLS. For more information about Gecko Platform, see
release notes that can be found in Simplicity Studio’s Launcher Perspective, under SDK Documentation > Bluetooth SDK n.n.n.n >
Release Notes.
silabs.com | Building a more connected world. Rev. 1.7 | 5
QSG139: Bluetooth® SDK v2.x Quick Start Guide
About the Bluetooth Stack
2 About the Bluetooth Stack
The Silicon Labs Bluetooth stack is an advanced Bluetooth 5-compliant protocol stack implementing the Bluetooth low energy standard.
It supports multiple connections, concurrent central, peripheral, broadcaster, and observer roles. The Silicon Labs Bluetooth stack is
meant for Silicon Labs Wireless Gecko SoCs and modules.
The Silicon Labs Bluetooth stack provides multiple APIs for the developer to access the Bluetooth functionality. Two modes are supported:
1. Standalone mode, where both the Bluetooth stack and the application run in a Wireless Geckos SoC or module. The application can
be developed with C programming language.
2. Network Co-Processor (NCP) mode, where the Bluetooth stack runs in a Wireless Gecko and the application runs on a separate
host MCU. For this use case, the Bluetooth stack can be configured into NCP mode where the API is exposed over a serial interface such as UART.
silabs.com | Building a more connected world. Rev. 1.7 | 6
QSG139: Bluetooth® SDK v2.x Quick Start Guide
EFR32[B|M]G21, EFR32[B|M]G22: NVM3
About the Bluetooth Stack
2.1 Bluetooth Stack Features
The features of the Silicon Labs Bluetooth stack are listed in the following table.
Feature Value and comments
Bluetooth version Bluetooth 5.2
Bluetooth 5.2 GATT caching
Bluetooth 5 2M PHY (EFR32[B|M]G12, EFR32[B|M]G13, EFR32[B|M]G21, and EFR32[B|M]G22)
Bluetooth 5 LE Long Range (EFR32[B|M]G13, EFR32[B|M]G21, and EFR32[B|M]G22)
Bluetooth 5 advertisement sets and scan event reporting
Bluetooth 5 extended advertisements (EFR32[B|M]G12, EFR32[B|M]G13, EFR32[B|M]G21, and
Bluetooth features
Simultaneous connections Up to 8 simultaneous connections regardless of role (master or slave)
EFR32[B|M]G22)
• Anonymous advertisement
• Periodic advertisement
• Extended advertisement packet size: up to 1650 B
Concurrent central, peripheral, broadcaster and observer modes LE secure connections
LE Privacy 1.2 (peripheral) LE packet length extensions LE dual topology
Whitelisting (central side only)
Maximum throughput
1300 kbps over 2M PHY
700 kbps over 1M PHY
Encryption AES-128
Pairing modes
Just works
Man-in-the-Middle with numeric comparison and passkey Out-Of-Band
Number of simultaneous
bondings
EFR32[B|M]G1, EFR32[B|M]G12 and EFR32[B|M]G13: Up to 13 when using PS, up to 32 with NVM3
EFR32[B|M]G21, EFR32[B|M]G22: Up to 32
Link Layer packet size Up to 251 B
ATT protocol packet size Up to 250 B
Supported Bluetooth profiles
and services
All GATT based profiles and services are supported
Apple HomeKit R15-compliant implementation (EFR32[B|M]12, EFR32[B|M]13, EFR32[B|M]21, and
Apple HomeKit
EFR32[B|M]G22)
Implements all Apple HomeKit profiles and services Available separately for Apple MFi licensees
Host (NCP) interfaces
4-wire UART with RTS/CTS control or 2-wire UART without RTS/CTS
GPIOs for sleep and wake-up management
Wi-Fi Coexistence Using Packet Trace Arbitration (PTA)
Secure Gecko Bootloader supporting authenticated and encrypted updates over OTA or UART and
Bootloaders
Secure Boot. The Gecko Bootloader also supports flash partitioning and both internal and external
(SPI) flash.
Non-volatile memory
* Example applications in the SDK that are generated for these platforms will use PS by default.
silabs.com | Building a more connected world. Rev. 1.7 | 7
EFR32[B|M]G1, EFR32[B|M]G12, EFR32[B|M]G13: NVM3 or Persistent Store (PS)*
QSG139: Bluetooth® SDK v2.x Quick Start Guide
Link Layer (Bluetooth 5.2)
147971
About the Bluetooth Stack
2.2 Bluetooth Qualification
All products using Bluetooth technology must go through the Bluetooth SIG's Qualification Process, even if the product does not have the
Bluetooth logo or Bluetooth is not mentioned in the packaging and the documentation. In practice this means that, before you can sell a
Bluetooth-enabled product, the product must be qualified as an End Product through the Bluetooth SIG. The qualification listing has a
Declaration Fee. There are online resources to learn more about the Bluetooth Qualification Process as well as tutorials on the
Studio, which is the online tool used to complete the Bluetooth Qualification Process. If you need assistance to qualify your device you
can consider reaching out to your nearest Bluetooth Qualification Consultant.
When qualifying your end-product based on Silicon Labs’ Bluetooth stack you will integrate the pre-qualified components listed in the
table below, depending on which SDK version was used to build your application.
Bluetooth SDK version Component QDID
v2.10.x up to 2.13.x Link Layer (Bluetooth 5.1) 127618
Host stack (Bluetooth 5.1) [*] 126252
v2.13.x and above
v3.0.x and above
Host stack (Bluetooth 5.2) 146950
[*] Launch Studio: For end-product qualifications based on this component, you must check the items 21/19 and 34/15 and uncheck the
items 21/17 and 34/13 in the "Summary ICS" and upload the Erratum 11838 Test Evidences, which can be requested through the support
portal.
Launch
Note: According to Bluetooth SIG Qualification Program Reference Document (PRD)
, the Assessment Date of the tested Component
must be less than three years old at the time it is being imported into a Launch Studio project for a new End Product Listing (EPL). After
the expiration of a Component QDID (Qualified Design ID), a newer SDK version than the one used for the outdated QDID should be
used in order to qualify your product. There can be also newer QDIDs than the ones listed in the table above if there are newer Component
versions. You can browse our valid Qualified Components and their Assessment Date by inserting Silicon Laboratories in the search bar
of
Launch Studio. Contact technical support if there is a need to use an older SDK version.
The above software-based pre-qualified components are two out of the three components to integrate when proceeding with the
"Qualification Process with Required Testing
". Despite the “Required Testing", customers do not need to do any additional testing, given
that the test reports are embedded in the pre-qualified components for the SIG to review.
In addition to these two software components you must also have integrated a qualified RF-PHY component in your end-product listing.
If you are designing with one of Silicon Labs’ Bluetooth modules then refer to the module datasheet for the appropriate component QDID
to use. If you are designing with an SoC, then you may need to obtain your own RF-PHY qualification with the Bluetooth SIG, depending
on your hardware design. In the latter case, consult your nearest Bluetooth Qualification Consultant
, or Silicon Labs through the support
portal, to understand if an existing Silicon Labs RF-PHY pre-qualification could be used.
Silicon Labs does not provide prequalified profiles. Customers must provide these with their end applications that implement the functionality as per the SIG profile specification.
2.3 The Bluetooth Stack APIs
This section briefly describes the different software APIs available for the developer.
2.3.1 The BGAPI Bluetooth API
The BGAPI is the Bluetooth API provided by the Silicon Labs Bluetooth stack. It provides access to all the Bluetooth functionality implemented by the Bluetooth stack, such as: the Generic Access Profile (GAP), connection manager, the security manager (SM), and GATT
client and server.
In addition to the Bluetooth APIs, the BGAPI also provides access to a few other functions like the Direct Test Mode (DTM) API for RF
testing purposes, the Persistent Store (PS) API for reading and writing keys to and from the devices flash memory, the DFU (Device
Firmware Update) API for field firmware updates, and the System API for various system level functions.
2.3.2 CMSIS and emlib
The Cortex Microcontroller Software Interface Standard (CMSIS) is a common coding standard for all ARM Cortex devices. The CMSIS
library provided by Silicon Labs contains header files, defines (for peripherals, registers and bitfields), and startup files for all devices. In
silabs.com | Building a more connected world. Rev. 1.7 | 8
QSG139: Bluetooth® SDK v2.x Quick Start Guide
About the Bluetooth Stack
addition, CMSIS includes functions that are common to all Cortex devices, like interrupt handling, intrinsic functions, etc. Although it is
possible to write to registers using hard-coded address and data values, it is recommended to use the defines to ensure portability and
readability of the code.
To simplify programming Wireless Geckos, Silicon Labs developed and maintains a complete C function library called emlib that provides
efficient, clear, and robust access to and control of all peripherals and core functions in the device. This library resides within the em_xxx.c
(for example, em_dac.c) and em_xxx.h files in the SDK.
The emlib documentation is available on the Silicon Labs’ website
.
2.3.3 The BGAPI Serial Protocol and BGLIB Host API
When configured in NCP (network co-processor) mode, the Bluetooth stack also implements the BGAPI serial protocol. This allows the
Bluetooth stack to be controlled over a serial interface such as UART from a separate host like an EFM32 microcontroller. The BGAPI
serial protocol provides exactly the same Bluetooth APIs over UART as the BGAPI API when used in a standalone mode.
The BGAPI serial protocol is a lightweight, binary protocol that carries the BGAPI commands from the host to the Bluetooth stack and
responses and events from the Bluetooth stack back to the host.
The Bluetooth SDK delivers a ready-made BGAPI serial protocol parser implementation, called BGLIB. It implements the serial protocol
parser and C language function and events for all the APIs provided by the Bluetooth stack. The host code developed on top of BGLIB
can be written to be identical to the code for the Wireless Gecko, which allows easy porting of the application code from the Wireless
Gecko to a separate host or vice versa.
Figure 2-1. BGAPI Serial Protocol Message Exchange
The BGAPI serial protocol packet structure is described below.
Table 2-1. BGAPI Packet Structure
Byte Byte 0 Byte 1 Byte 2 Byte 3 Byte 4-255
Explanation Message type
0x20: command
Values
0x20: response
0xA0: event
Minimum payload
length
Message class Message ID Payload
0x00 - 0xFF 0x00 - 0xFF 0x00 - 0xFF
Specific to command,
response, or event
2.3.4 The Bluetooth Profile Toolkit GATT Builder
The Bluetooth Profile Toolkit is a simple XML-based API and description language used to describe the GATT-based service and characteristic easily without the need to write them in code. The XML files can be easily written by hand based on the information contained
silabs.com | Building a more connected world. Rev. 1.7 | 9
QSG139: Bluetooth® SDK v2.x Quick Start Guide
About the Bluetooth Stack
in UG118: Blue Gecko Bluetooth® Profile Toolkit Developer Guide. Use the Profile Toolkit GATT Builder if you are developing outside of
Simplicity Studio.
Within Simplicity Studio, we provide the GATT Configurator, a tool that allows building the GATT in a visual way, without hand editing the
XML file. See section 7.1, The GATT Configurator for summary information, and UG365: GATT Configurator User’s Guide for details.
The GATT database developed with the Profile Toolkit is converted to a .c file and a .h file and included in the application project as a
pre-build step when the firmware is compiled. Then the GATT can be accessed with the Bluetooth stack GATT APIs or by a remote
Bluetooth device.
Figure 2-2. Example of a Generic Access Service
2.4 About the Bluetooth SDK
The Bluetooth SDK is a full software development kit that enables you to develop applications on top of the Bluetooth stack using C
programming language. The SDK also supports making standalone applications, where the Bluetooth stack and the application both run
in the Wireless Gecko, or the network co-processor (NCP) architecture, where the application runs on an external host and the Bluetooth
stack runs in the Wireless Gecko. SDK contents and folder structure are described in the following sections.
2.4.1 Libraries
The following libraries are delivered with the Bluetooth SDK and must be included in C application projects.
Library Explanation Mandatory
libbluetooth.a Bluetooth stack library Yes
librail_efr32xg1_gcc_release.a RAIL library for GCCYes for GCC projects on EFR32xG1 platform
librail_efr32xg12_gcc_release.a RAIL library for GCCYes for GCC projects on EFR32xG12 platform
librail_efr32xg13_gcc_release.a RAIL library for GCCYes for GCC projects on EFR32xG13 platform
librail_efr32xg14_gcc_release.a RAIL library for GCCYes for GCC projects on EFR32xG14 platform
librail_efr32xg21_gcc_release.a RAIL library for GCCYes for GCC projects on EFR32xG21 platform
librail_efr32xg22_gcc_release.a RAIL library for GCCYes for GCC projects on EFR32xG22 platform
librail_efr32xg1_iar_release.a RAIL library for IARYes for IAR projects on EFR32xG1 platform
librail_efr32xg12_iar_release.a RAIL library for IARYes for IAR projects on EFR32xG12 platform
librail_efr32xg13_iar_release.a RAIL library for IARYes for IAR projects on EFR32xG13 platform
librail_efr32xg14_iar_release.a RAIL library for IAR Yes for IAR projects on EFR32xG14 platform
silabs.com | Building a more connected world. Rev. 1.7 | 10
QSG139: Bluetooth® SDK v2.x Quick Start Guide
bootloader
Gecko Bootloader source code and project files.
common
Silicon Labs status codes
About the Bluetooth Stack
Library Explanation Mandatory
librail_efr32xg21_iar_release.a RAIL library for IARYes for IAR projects on EFR32xG21 platform
librail_efr32xg22_iar_release.a RAIL library for IARYes for IAR projects on EFR32xG22 platform
libmbedtls.a mbedtls libraryYes
libpsstore.a PSStore libraryYes, on series 1
binapploader.o Apploader for OTA updates No
libcoex.a Wi-Fi and Bluetooth coexistence No
libnvm3_CM33_gcc.a Yes, on series 2
2.4.2 Include Files
The following files are delivered with the Bluetooth SDK and must be included in C application projects.
Library Explanation When needed
Must be included in standalone C applications
where both Bluetooth stack and application run in
a Wireless Gecko.
Required when the Bluetooth stack is used
together with Micrium RTOS.
native_gecko.h
rtos_gecko.h
Bluetooth stack API for standalone applications
without Micrium RTOS
Bluetooth stack API for standalone applications
with Micrium RTOS
Must be included in NCP applications where the
ncp_gecko.h Bluetooth stack API for NCP applications
host controls the device via BGAPI protocol over
UART
gecko_configuration.h Bluetooth stack configuration Included automatically.
bg_errorcodes.h Error codes produced by the Bluetooth stack Included automatically.
bg_gattdb_def.h Bluetooth GATT database structure definition Included automatically.
bg_types.h Simple data type definitions and structures Included automatically.
gecko_bglib.h
An adaptation layer between host application and
BGAPI serial protocol
host_gecko.h Bluetooth API for host (NCP) applications
Must be included in C applications developed for
external hosts.
Must be included in C applications developed for
external hosts.
2.4.3 Platform Components
The following components are delivered with the Bluetooth SDK. The platform components are under the platform folder.
Folder Explanation
CMSIS
Device
Silicon Laboratories CMSIS-CORE device headers.
Documentation
EFR32BG and EFR32MG device files.
Documentation
silabs.com | Building a more connected world. Rev. 1.7 | 11
A set of function-specific high-performance drivers for EFR32 on-chip peripherals. Drivers are typically
emdrv
emlib
Halconfig Peripheral configuration
DMA based and are using all available low-energy features. For most drivers, the API offers both
synchronous and asynchronous functions.
Documentation
A low-level peripheral support library that provides a unified API for all EFM32, EZR32 and EFR32 MCUs
and SoCs from Silicon Laboratories.
Documentation
middleware
Display driver for WSTK development kits
Documentation
Sleeptimer driver and configuration file. Used by the BLE stack.
silabs.com | Building a more connected world. Rev. 1.7 | 12
QSG139: Bluetooth® SDK v2.x Quick Start Guide
Getting Started with Simplicity Studio and the Bluetooth SDK
3 Getting Started with Simplicity Studio and the Bluetooth SDK
Simplicity Studio is a free Eclipse-based Integrated Development Environment (IDE) and a collection of value-add tools provided by
Silicon Labs. Developers can use Simplicity Studio to develop, debug and analyze their Bluetooth and other Silicon Labs SDK (Software
Development Kit) applications. Its main goal is to reduce development time so that you can focus on your application instead of researching the Bluetooth specification and hardware reference manuals. See section 3.3 Functionality in the Launcher Perspective for a review
of Simplicity Studio’s features.
If you have already installed Simplicity Studio with a different protocol stack, see section 3.4 Updating Software/New Elements for in-
structions on updating the installation with the Bluetooth stack.
3.1 Connect your Hardware
Connect your WSTK using a USB cable to the PC on which you will install Simplicity Studio. By having it connected when Simplicity
Studio installs, Simplicity Studio will automatically obtain the relevant additional resources it needs.
Note: For best performance in Simplicity Studio, be sure that the power switch on your WSTK is in the Advanced Energy Monitoring or
“AEM” position as shown in the following figure.
Figure 3-1. EFR32BG12 on a WSTK
silabs.com | Building a more connected world. Rev. 1.7 | 13
Loading...
+ 30 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.