Application Development in Simplicity Studio#

Starting Application Development#

Developing a Bluetooth application consists of two main steps: defining the GATT database structure and defining the event handlers for events such as connection_opened, connection_closed, and so on.

More Demos and Examples lists the various examples available in the SDK. The most common starting point for application development is the SoC Empty example. This project contains a simple GATT database (including the Generic Access service, Device Information service, and OTA service) and a while loop that handles some events raised by the stack. You can extend both the GATT database and the event handlers of this example according to your needs.

Note: Beginning with Bluetooth SDK version 2.7.0.0, all devices must be loaded with the Gecko Bootloader as well as the application. While you are getting started, the easiest way to do this is to load any of the precompiled demo images that come with the bootloader configured as part of the image. When you flash your application it overwrites the demo application, but the bootloader remains. Subsequently you may wish to build your own bootloader, as described in UG266: Silicon Labs Gecko Bootloader User’s Guide for GSDK 3.2 and Lower or UG489: Silicon Labs Gecko Bootloader User’s Guide for GSDK 4.0 and Higher.

New Project creation is done through three dialogs:

  • Target, SDK, and Toolchain

    Target, SDK, and Toolchain SelectionTarget, SDK, and Toolchain Selection

  • Examples

    ExamplesExamples

  • Configuration

    ConfigurationConfiguration

An indicator at the top of the dialog shows you where you are.

BreadcrumbsBreadcrumbs

You can start a project from different locations in the Launcher Perspective, as described in the Simplicity Studio 5 User's Guide. While you are getting started, we suggest starting from the File menu, as that takes you through all three of the above dialogs.

  1. Select New >> Silicon Labs Project Wizard.

  2. Review your SDK and toolchain. If you wish to use IAR instead of GCC, be sure to change it here. Once you have created a project it is difficult to change toolchains. Click NEXT.

  3. On the Example Project Selection dialog, filter on Bluetooth and select Bluetooth - SoC Empty. Click NEXT.

On the Project Configuration dialog, rename your project if you wish. Note that if you change any linked resource, it is changed for any other project that references it. While you are getting started the default choice to include project files but link to the SDK is best. Click FINISH. If the example has documentation, the project opens on a readme tab. Note that a Simplicity IDE perspective control is now included in the upper right of the screen.

GATT Database#

A visual GATT Configurator is available on the gatt_configuration.btconf tab when you create the project, to help you create your own GATT database with a few clicks.

You can create your own database at this point, or return to it later either by double-clicking the gatt_configuration.btconf file under your project in Project Explorer, or through the Project Configurator’s Advanced > GATT Configurator component. For more information, see section The GATT Configurator.

Bluetooth GATT ConfiguratorBluetooth GATT Configurator

A reference for each characteristic is generated and defined in gatt_db.h. You can use this reference in your code to read / write the values of the characteristics in the local GATT database with sl_bt_gatt_server_read_attribute_value() / sl_bt_gatt_server_write_attribute_value() commands.

You can also build the GATT database from the application using the GATT database API. In this case you need to install the Dynamic GATT Database software component on the Project Configurator Software Components tab.

You will find the event handlers in the main loop in app.c. You can extend this list with further event handlers. The full list of events – and stack commands – can be found in the Bluetooth Stack API Reference.

Component Configuration#

Bluetooth SDK v3.x projects are based on a Gecko Platform component-based architecture. Software features and functions can be installed and configured through Simplicity Studio’s Component Editor. When you install a component, the installation process will:

  1. Copy the corresponding SDK files from the SDK folder into the project folder.

  2. Copy all the dependencies of the given component into the project folder.

  3. Add new include directories to the project settings.

  4. Copy the configurations files into the /config folder.

  5. Modify the corresponding auto-generated files to integrate the component into the application.

Additionally, “init” type software components will implement the initialization code for a given component, utilizing their corresponding configuration file as input.

Some software components (like OTA DFU) will fully integrate into the application to perform a specific task without the need of any additional code, while other components provide an API to be used in the application.

Note: All EFR32 parts have a unique RSSI offset. In addition, board, antenna and enclosure design can also impact RSSI. When creating a new project, install the RAIL Utility, RSSI component. This feature includes the default RSSI Offset Silicon Labs has measured for each part. This offset can be modified if necessary, after RF testing of your complete product.

To see the component library, click the <project-name>.slcp tab of your project, and click Software Components. A number of filters as well as a keyword search are available to help you explore the various component categories. Note that components for all SDKs are presented.

Software components tabSoftware components tab

Components installed in the project are checked (1) and can be uninstalled. Configurable components are indicated by a gear symbol (2).

Single component viewSingle component view

Click Configure to open the Component Editor and see a configurable component’s parameters.

Configurator viewConfigurator view

As you change component configurations, your changes are automatically saved and project files are automatically generated. You can see generation progress in the lower right corner of the Simplicity IDE. Wait until generation is complete before building the application image.