Today (March 23, 2020), Silicon Labs released the next generation of their Bluetooth SoCs: the EFR32BG22 chipset family.

The chipset features an ARM Cortex-M33 which supports the latest version of Bluetooth: version 5.2 (including features from versions 5.1 and 5.0). More importantly, the chipset features the following enhancements:

  • Significantly lower power consumption compared to the previous generations (up to 60% lower)
  • Enhanced security features including a Hardware-Accelerated Crypto, a True Random Number Generator (TRNG), Secure Boot with Root of Trust and Secure Loader (RTSL), Secure Debug with Lock/Unlock, and ARM TrustZone.

Here’s a table that provides a comparison of the new chipset and the previous generation:

Source: Silicon Labs

So, as a BLE developer, why should you care?

With the increased demand for securing embedded devices, especially those with wireless connectivity capabilities, this new generation of Silicon Labs Bluetooth chipsets provides an attractive platform for developing your next-generation BLE product. This is especially applicable in applications that require low-power consumption and need to run on batteries for long periods of time.

Here are some examples of applications suitable for implementation based on the new BG22 chipset:

  • Asset Tags and Beacons
  • Consumer Electronics Remote Controls
  • Portable Medical devices
  • Bluetooth mesh Low Power Nodes (LPN)
  • Sports, Fitness, and Wellness devices
  • Connected Home devices
  • Building Automation and Security applications

In terms of BLE features, here are the main ones supported by the new chipset:

  • LE Power Control (Bluetooth 5.2)
  • GATT Caching (Bluetooth 5.1)
  • 2M PHY and Coded PHY (Bluetooth 5)
  • Extended Advertisements and Advertisement Sets (Bluetooth 5)
  • Up to 8 simultaneous connections (mix of master or slave)

In collaboration with Silicon Labs, I was provided with early access to their SDK and development kit based on the new BG22 chipset.

In this post, I will guide you through setting up your development environment and getting started with your first BG22-based BLE application.

Hardware and Software Requirements

Here’s the list of hardware and software requirements for following this tutorial:

  • EFR32xG22 Wireless Gecko Starter Kit (SLWSTK6021A)
  • A mini USB cable (included with the development kit)
  • A development PC (macOS, Linux, or Windows) – we’ll be using macOS in this tutorial
  • Silicon Labs Simplicity Studio IDE
    • Included free GCC compiler – we’ll be using this option in this tutorial
    • IAR Embedded Work Bench for ARM (30-day eval license available)

Development Environment Setup

Let’s go through the steps for setting up your development environment.

The first step is to install the Simplicity Studio IDE.

Once you’ve downloaded Simplicity Studio and installed it, you may run into an error that complains that the application not being secure to run. This issue can be fixed from within the Security settings under System Preferences and clicking on “Open Anyway”.

After launching the application, you will be presented with a login screen. If you do not have a Silicon Labs account, you can sign up from this screen as well (or simply go to https://siliconlabs.force.com/apex/SL_CommunitiesSelfReg?form=short):

Once signed in, the application will check for software updates. It’s recommended that you allow it to download and install these updates – this may take a few minutes.

Once finished, the updates may require a restart of the application. After restarting, make sure you have the main development board with the radio board mounted and plugged into the development computer.

Make sure that the development board Power Switch is set to “AEM” (which stands for “Advanced Energy Monitor” and is necessary for using the energy profiler application) :

Source:
UG430: EFR32xG22 2.4 GHz 6 dBm Wireless Starter Kit User’s Guide

Now, click on the software update icon:

Once clicked, you will be presented with the following screen:

Since we are developing for a specific device (the BG22), the easiest method is to choose the “Install by Device” option:

The application should detect the connected device (shown above). Click on the device, then on the “>>” button to add it to the “Selected devices:” section:

Click “Next” and make sure you have at least “Bluetooth” and “32 bit MCU” are selected:

Press “Next” again, and make sure the latest “Bluetooth SDK” is selected (I have the “32 bit MCU SDK” package selected as well, but that is not required):

Press “Next” again and wait for the installation to finish. This will likely take a few minutes.

Once the installation is finished, click the “Close” button – a restart of the application may be required.

Running a BLE Peripheral Example

The Silicon Labs Bluetooth SDK includes a few examples that you can run on the board. Let’s take a look at the different examples included:

But before we run any of the examples. check to see if there’s an update for the Adapter. If so, then click on “Download”:

Make sure you do not unplug the development board while the Adapter firmware is being updated. Once the download and update are complete, it will display a prompt informing you that it’s “Waiting for the kit to restart”:

If you’re using the development board for the first time, then you will need to flash the bootloader to the chipset. To do so, you have two choices:

  • Flash the “Internal Storage Bootloader (single image on 512 kB device)” project (located under the “Gecko Bootloader Examples”) to the board.
    If you take this path, open the project then double click the *.isc file and click on “Generate”. The .isc file allows you to customize the bootloader in a GUI tool and then generates the source code for that configuration.
  • Flash one of the “Bluetooth (SoC)” to the board (which already includes the bootloader).

Now, we’re ready to run one of the BLE examples.

Let’s run the Thermometer example (labeled “SOC – Thermometer”). Simply click on the name, and you will be presented with the following view:

GATT Configurator Tool

Silicon Labs provides a very useful interface for setting up and designing your GATT Services and Characteristics. It also allows you to import and adopt Bluetooth SIG standard GATT Profiles (e.g. Heart Rate, Find Me, etc.), Services, and Characteristics.

This is really helpful for visualizing your GATT design and is much easier than trying to visualize and manage your Services and Characteristics in source code.

In the Thermometer [Server] example, you’ll notice that the following GATT is defined:

Building, Flashing, and Testing

To build the application, right-click on “soc-thermometer” in the left-hand side and then click on “Build Project”:

In the Console area, you’ll see the output of the build process:

Once the build is successful, now we can flash and run it on the device. To do this, click on the “Debug” icon:

Once the application is run, we can confirm this by running a BLE scanner mobile app. The Silicon Labs EFR Connect allows us to do just that.

The EFR Connect mobile is available for both iOS and Android.

Once you run the app, you’ll be presented with the following screen:

You’ll notice that the main screen is the “Demo” screen with the “Health Thermometer” listed. If you navigate to the “Develop” screen, you’ll see the option for a “Browser” which allows you to scan for any BLE peripheral in the vicinity.

Since we are running the Thermometer example on our development board, we can utilize the “Health Thermometer” scanner within the app. Click on “Health Thermometer”:

If you’ve set up and run the Thermometer example correctly on the board, you’ll see your device listed in the app (as shown above). If the device does not show up in the “Blue Geckos” tab, try switching to the “Other” tab.

Tap on the device with the name “Thermometer Example” and the app will attempt to connect to the device. Once connected, you’ll be presented with the following screen:

To test out the sensor’s functionality, place your finger on the temperature sensor on the development board and notice that the temperature reported rises gradually:

Source:
UG430: EFR32xG22 2.4 GHz 6 dBm Wireless Starter Kit User’s Guide

Basic Structure of a BLE Application

The Bluetooth SDK enables the development of BLE apps in two different configurations:

  • Standalone application configuration, where the Bluetooth stack and the application both run in the BGM22 chipset.
  • Network Co-Processor (NCP) configuration, where the application runs on an external host and the Bluetooth stack runs in the BGM22 chipset.

The Thermometer example we ran on the development board is a standalone configuration. Here’s a diagram that shows the architecture used in each configuration:

To better understand the structure of a standalone BLE application, let’s take a look at the different parts of main.c in the project.

First, the header files included in the file:

Following the header file includes, we have a few configuration variables defined. The first of which is the maximum number of connections, which is defined as 4 in our example:

Another crucial part is the main gecko configuration data structure:

The most important configurations defined above are:

  • Bluetooth max connections = 4
    .bluetooth.max_connections = MAX_CONNECTIONS,
  • Device name = “OTA”
    .ota.device_name_len = 3,
    .ota.device_name_ptr = "OTA",
  • Pointer to generated GATT database
    gattdb = &bg_gattdb_data
    This

Next in main.c we have the definition for the function temperatureMeasure(). The code is self-explanatory with very detailed comments:

Finally, we have the main() function. We won’t list the whole contents of the function, but here are some of the most important parts.

First, we have different general initializations:

Next, in the while() loop, we have a function call to wait for events to be reported from the Gecko stack:

The return value from the gecko_wait_event() API is then parsed to handle the reported event from the stack. A few cases are handled:

  • The boot-up event, in which case the device then starts advertising.
  • An event generated in the case of a notification or indication being enabled/disabled, or when an indication confirmation was received.
  • A timer event in which case the function temperatureMeasure() used to measure the temperature is called
  • An event generated when a connection has been closed, in which case the device either enters DFU mode (if the dfu boot flag was set) or going back to BLE advertising mode.
  • Events of characteristic write operations related to DFU mode.

As you can see, the main structure of a BLE application is event-driven.

Silicon Labs Thunderboard™ BG22 Kit

The SiLabs Thunderboard™ EFRBG22 is a small and cost-effective prototype and development platform based on the EFR32 Wireless Gecko SoC. It features a number of on-board sensors:

  • Humidity and temperature sensor
  • UV index and ambient light sensor
  • Hall effect sensor
  • 6-axis inertial sensor
  • PDM stereo microphones

In addition to the sensors, the board features a user LED and push-button. It is powered by either USB or a coin-cell battery.

Source: Thunderboard™ Wireless EFR32BG22 User’s Guide

The board ships with a ready-to-use Bluetooth demo and includes a built-in SEGGER J-Link debugger.

To learn more about this development kit: https://www.silabs.com/products/development-tools/thunderboard/thunderboard-bg22-kit

Silicon Labs Software Tools

There are a few tools provided by Silicon Labs as part of the Blue Gecko suite of software tools.

Some of these tools are integrated into Simplicity Studio including: GATT Configurator, Multi-Node Energy Profiler, and Network Analyzer.

Others such as Simplicity Commander and BGTool Application are external and exist separately from Simplicity Studio (though Simplicity Commander can also be run from within Simplicity Studio).

GATT Configurator

This tool allows you to define and design the GATT database of a device via a visual interface. To re-launch the GATT Configurator tool at any point for a specific project, simply double-click the *.isc file in the project explorer pane:

Multi-Node Energy Profiler

This tool allows you to accurately measure the energy consumption of your device in runtime including finding peak current consumption and sleep mode current measurement.

To run the profiler simply click on the Profile button in the Simplicity IDE perspective and select “Simplicity Energy Profiler Target”:

Network Analyzer

This tool is a packet capture and debugging tool that can be used to debug Bluetooth connectivity between Wireless Geckos and other Bluetooth devices.

The Packet Trace application captures the packets directly from the Packet Trace Interface (PTI) available on the Wireless Gecko SoCs and modules. It, therefore, provides more accurate capture of the packets compared to air-based capture.

Simplicity Commander

This tool is a simple, yet very effective, tool that allows you to efficiently flash firmware images, erase flash, lock and unlock debug access, and perform other related operations on your device.

To run the application from within Simplicity Studio, go to the Preferences menu under Simplicity Studio Adapter Packs Simplicity Commander commander: commander for macosx.x86_64 (or whatever operating system you’re running on):

Summary & Closing

In this tutorial, we introduced the new Silicon Labs BG22 SoC and covered how to get started with this exciting new platform.

The topics we covered are:

  • Hardware and Software Requirements
  • Development Environment Setup
  • Running a BLE Peripheral Example
    • GATT Configurator Tool
    • Building, Flashing, and Testing
    • Basic Structure of a BLE Application
  • Silicon Labs Thunderboard BG22 Kit
  • Silicon Labs Software Tools
    • GATT Configurator
    • Multi-Node Energy Profiler
    • Network Analyzer
    • Simplicity Commander

References

Take your BLE knowledge to the next level

If you’re looking to learn more about how to develop for Silicon Labs’ new family of BG22 chipsets, then check out the Bluetooth Developer Academy.

Upcoming courses are planned to be released and will cover different aspects of developing BLE applications using this platform including custom GATT Services and Characteristics and developing Peripheral and Central applications.

By joining the Bluetooth Developer Academy, you will get access to a growing library of courses and tutorials.

Here’s what one Academy member has to say:

If you’re developing a BLE project, you need two things, a good BLE sniffer and the Bluetooth Developer Academy. I am very happy to be part of this community and look forward to what comes next.

– Christopher Gates, Principal System Security Architect – Velentium

The current courses include:

  • The Basics of Bluetooth Low Energy
  • Analysis of BLE events using a BLE sniffer
  • Long-range mode (Coded PHY) using Bluetooth 5.0
  • Developing nRF52 applications using Visual Studio Code
  • Over the Air Device Firmware Update (OTA DFU) – nRF52 use case
  • Getting Started with Zephyr (including adding custom GATT Services and Characteristics)
  • The Developer’s Guide to what’s new in Bluetooth 5.2
  • SweynTooth: A Summary for BLE Developers
  • Introduction to BLE Security
  • Getting Started with BlueZ development
  • Introduction to BLE Development for iOS
  • …and more courses added each month!

For a full list of courses included, check out the Courses Library here:

Bluetooth Developer Academy Courses Library

The Academy also features a thriving community of Bluetooth experts, developers, and innovators. You’ll get to connect and interact with other experts in the Bluetooth space, learn from others’ experience and knowledge, and share yours.

Also included in the Academy is access to private support from me personally.

In the community, you will find:

  • Discussions around new features such as long-range mode (Bluetooth 5.0) and direction-finding (Bluetooth 5.1).
  • Discussions around the capabilities of different BLE sniffers.
  • Comparisons of BLE support and restrictions in iOS and Android.
  • Various technical questions and answers to these questions.
  • Listing of Bluetooth-related job openings.
  • And many more discussions!

Learn More About the Bluetooth Developer Academy

8 Comments

  1. Avatar Vinicius on April 7, 2020 at

    Your comment is awaiting moderation.

    Hi Mohammad,
    Nice Article!

    I am having problems using the GPIO of the BG22 kit.
    I’m trying to make a simple code to set the LED0 on the board. But the code just doesn’t work.
    Below are the functions used:

    GPIO_PinModeSet(gpioPortD, 2, gpioModePushPull, 1);
    GPIO_PinOutSet(gpioPortD, 2);

    Thanks.

  2. Avatar Badiss DJafar on March 31, 2020 at

    Nice article !

    Great learning material, well put together.

    • Mohammad Afaneh Mohammad Afaneh on April 1, 2020 at

      Thanks, Badiss.

  3. Avatar Walter on March 23, 2020 at

    nice … can you provide this in pdf format …..

  4. Avatar Sergio on March 23, 2020 at

    Nice article Mohammad

    As far as I understand those manufacturers lack for BT 5.2 support on their SOCs. Silabs just are refering that their SOCs will be BT 5.2 compatible. Isn’t it?
    Any news about when it support isochronous audio and multicast features?
    Best

    • Mohammad Afaneh Mohammad Afaneh on March 23, 2020 at

      Hi Sergio, there are actually some requirements for Bluetooth 5.2 compatibility. While many of the new features in the different Bluetooth versions are indeed optional, in the case of the SiLabs BG22, the chipset does support the new LE Power Control feature (in Bluetooth 5.2).

      But yes, in general, I would take a look at the spec sheet for the chipset before assuming any of the new (optional) features of a specific Bluetooth version are supported.

  5. Avatar Philip Cannon on March 23, 2020 at

    hi Mohammed.
    I am not thrilled about IAR – how much is the license after 30 days ?
    I scanned the example fast and did not see you use the IAR tools . why is that?
    I did not see the equivalent of the Nordic nRFconnect, or the sniffer ?
    i will looks this over again later in more detail.

    but bottom line. why should I drop Nordic and go to this product ?

    • Mohammad Afaneh Mohammad Afaneh on March 23, 2020 at

      Hi Phil, in this tutorial I did not use the IAR IDE or compiler. Instead, I used the free GCC compiler included with Simplicity Studio. So, you do not need IAR to develop for the BG22.

      I am not advocating switching from one platform to another 🙂 Instead, I want to cover the different platforms and provide other developers with all the information needed to make an informed decision.

Leave a Comment