AN1134: Dynamic Multiprotocol Development with Bluetooth® and Proprietary Protocols on RAIL in GSDK v2.x

This application note provides details on how to develop a multiprotocol application running Bluetooth and a proprietary protocol at the same time. It discusses criteria for coexistence, guides through creating a new DMP application, configuring Bluetooth and proprietary protocols, and transmitting/receiving proprietary packets while Bluetooth is running. It also details the Light/Switch DMP example.

Key Points

1. Introduction

UG305: Dynamic Multiprotocol User's Guide provides information about the Dynamic Multiprotocol solution, where two protocols run in parallel. It includes general background on Bluetooth task priorities and scheduling. This application note introduces the Bluetooth / Proprietary multiprotocol solution, assuming familiarity with Dynamic Multiprotocol principles.

1.1 Requirements

To use the features discussed, the following must be installed:

To run the Light/Switch example, the following are also required:

2. Guidelines for Bluetooth and Proprietary Coexistence

When implementing a Bluetooth / Proprietary DMP application, consider the compatibility of your proprietary protocol with Bluetooth. Key guidelines include:

Summary: Bluetooth requires radio access every connection interval for short durations (230 µs – 2350 µs) with precise timing. Bluetooth packets can interrupt proprietary packet transmission/reception. Proprietary protocols should implement acknowledgment and retransmission mechanisms or deterministic, interleaved timing.

3. Software Architecture of a Bluetooth / Proprietary DMP application

DMP applications are based on Micrium RTOS, enabling parallel and independent operation of Bluetooth and proprietary protocols. The Bluetooth stack functions are accessed via BGAPI. The developer implements the Bluetooth application logic in bluetoothAppTask(). The proprietary protocol uses the RAIL API directly, with events handled by radioEventHandler(). Communication between Bluetooth and proprietary applications occurs via inter-process communication (IPC).

Diagram Description: A block diagram shows the interaction between bluetoothAppTask() (using Bluetooth stack, LinkLayerTask, BGAPI) and proprietaryAppTask() (using Radio, RAIL API, radioEventHandler()). Both communicate via IPC. The diagram indicates that the Bluetooth stack and LinkLayerTask can be used as-is, while the radio event handler is called from interrupt context.

4. Developing a Bluetooth / Proprietary DMP Project

4.1 Create a New Project

Silicon Labs Bluetooth SDK (v2.9 or later) provides the "SOC - Empty - RAIL - DMP" Software Example as a starting point. This example includes the multiprotocol RAIL library, Bluetooth library, Micrium RTOS, and default configurations for Bluetooth GATT, RAIL, and RTOS. It also implements Bluetooth, RAIL, and RTOS initialization.

To create a new project:

  1. Open Simplicity Studio.
  2. Select your device.
  3. Click [New Project] or File > New > Project.
  4. Select Bluetooth SDK.
  5. Select Bluetooth SDK v2.9.0 or later.
  6. Select SOC – Empty – RAIL - DMP sample application.
  7. Name your project.
  8. Check your part number.
  9. Select the compiler and click [Finish].

Diagram Description: A workflow diagram shows the creation of a DMP project. It starts with the Bluetooth SDK and Gecko SDK suite (including emlib, emdrv). These connect to the Radio Configurator (generating rail_config.c/h) and Visual GATT Editor (generating gatt_db.c/h). The output is a DMP project with project files and driver files.

4.2 Configure Bluetooth

Bluetooth configuration involves two steps:

Diagram Description: A screenshot shows the Bluetooth Configurator interface within Simplicity Studio, allowing configuration of GATT services and characteristics, and general Bluetooth settings.

4.3 Configure Proprietary Protocol

Proprietary protocol configuration involves:

To configure RAIL, open main.c and find the proprietaryAppTask() function where RAIL initialization is performed. Multiple radio configurations can be selected, and RAIL events can be subscribed to.

Diagram Description: A screenshot shows the EFR32 Multi PHY Configurator in Simplicity Studio, used for setting up protocol configuration, channels, modulation, packet formats, and generating RAIL configuration files.

4.4 Develop Bluetooth Application

Bluetooth applications are implemented similarly to non-DMP scenarios. BGAPI commands can be called from anywhere (except interrupt context), and BGAPI events are fetched from the Bluetooth stack's internal event queue, typically in an infinite loop. DMP Bluetooth applications require an RTOS. Event handling is implemented in bluetoothAppTask(), with new events added as case statements.

Diagram Description: A flowchart illustrates the process within bluetoothAppTask(): wait for Bluetooth event flag, fetch Bluetooth event, and then execute actions based on the event ID (e.g., event_id1, event_id2).

4.5 Develop Proprietary Application

Proprietary applications use the RAIL API directly. Commands can be called from anywhere, and events are handled in the callback function set during RAIL initialization (e.g., radioEventHandler()). This callback is executed in interrupt context, so only time-critical calculations should be performed, setting flags to inform the main loop.

The main loop for processing radio events is in proprietaryAppTask(). Communication between radioEventHandler() and proprietaryAppTask() is recommended via RTOS services like semaphores or flags.

Diagram Description: A flowchart shows the interaction between radioEventHandler() and proprietaryAppTask(). radioEventHandler() checks RAIL event flags, performs immediate actions, and sets flags. proprietaryAppTask() waits for these flags, checks protocol state, and executes actions.

4.6 Communication between Bluetooth and Proprietary Protocol

Bluetooth and proprietary protocols run in independent tasks but often require synchronization. To notify the Bluetooth task from the proprietary task, use gecko_external_signal() to place an event in the Bluetooth stack's queue, handled by gecko_evt_system_external_signal_id in bluetoothAppTask(). To notify the proprietary task from the Bluetooth task, set an RTOS flag.

5. Examples

5.1 Sending Proprietary Packets

This example sends a proprietary packet when a specific GATT characteristic is written. It involves creating a new "SOC - Empty - RAIL - DMP" project, adding a characteristic (e.g., "Proprietary characteristic" with Read, Write, Notify properties), and defining flags and FIFOs.

In bluetoothAppTask(), an event handler is added to detect changes to the proprietary characteristic and set a flag. In proprietaryAppTask(), the code waits for this flag, reads the characteristic's value, copies it to the Tx FIFO, and sends the packet using RAIL. The radioEventHandler() is used to yield the radio after a packet is sent.

5.2 Receiving Proprietary Packets

This example implements a receiver that updates a GATT characteristic upon receiving a proprietary packet. It extends the transmitter example by defining a packet reception flag and an Rx FIFO.

In proprietaryAppTask(), Rx transitions are set for automatic state restoration, Rx priority is set lower than Tx, and Rx is started. The radioEventHandler() checks for received packets, copies them to the Rx FIFO, and sets a flag. The main loop in proprietaryAppTask() waits for either a characteristic change or packet reception. If a packet is received, its content is written to the GATT database, and an external signal is sent to the Bluetooth stack. In bluetoothAppTask(), this external signal is handled to send a notification.

6. Light/Switch Example

This section details working with the Light/Switch example, which provides a user interface documented in QSG155. To use this example, Flex SDK v2.1.0+ and Bluetooth SDK v2.7.0+ are required, along with the Micrium kernel and specific IAR Embedded Workbench version.

6.1.1 Building the RAIL:Switch Application

Steps involve starting a new project in Simplicity Studio, selecting the Flex SDK and the "RAIL: Switch" application, configuring the project, and generating project files. Compilation and flashing can then be performed.

Diagram Description: An image shows "DMP Demo Switch" on an LCD display.

6.1.2 Building the Bluetooth Light Application

The Bluetooth Light application requires the Gecko Bootloader. This can be loaded with a precompiled "SOC - Light - RAIL - DMP" demonstration or by building a custom bootloader image. Steps involve starting a new project, selecting the Bluetooth SDK and the "SOC - Light - RAIL - DMP" application, configuring the project, and compiling/flashing.

Diagram Description: An image shows "DMP Demo Light" and "DMP:F754" on an LCD display.

6.1.3 Changing the PHY Configuration

The default PHY configuration is sub-Gigahertz. To change it, open the RAIL:Switch project, select the Radio Configuration tab, choose a new PHY, and generate new configuration files. These files (rail_config.c and rail_config.h) are then copied to the SOC - Light - RAIL - DMP project, overwriting existing ones. Both projects are then rebuilt and flashed.

PDF preview unavailable. Download the PDF instead.

an1134-bluetooth-rail-dynamic-multiprotocol Antenna House PDF Output Library 6.0.283 (Linux64)

Related Documents

Preview AN1269: Dynamic Multiprotocol Development with Bluetooth and Proprietary Protocols on RAIL in GSDK v3.x
Silicon Labs AN1269 provides a comprehensive guide to developing dynamic multiprotocol applications that combine Bluetooth and proprietary protocols using the Gecko SDK Suite (GSDK) v3.x. Learn about protocol coexistence, project setup, configuration, and implementation details for embedded systems.
Preview Silicon Labs UG305: Dynamic Multiprotocol User's Guide
Silicon Labs UG305: Dynamic Multiprotocol User's Guide details how to implement applications using Silicon Labs' Dynamic Multiprotocol solution, enabling multiple wireless protocols like Bluetooth and Zigbee to operate simultaneously on a single chip. Covers architecture, Radio Scheduler, Micrium OS integration, and examples.
Preview Silicon Labs Multiprotocol Development Guide
Explore Silicon Labs' multiprotocol solutions for developing devices that support multiple wireless connectivity options. This guide covers dynamic multiprotocol, concurrent multiprotocol, and Wi-Fi coexistence, providing insights into radio scheduling, protocol considerations, and implementation examples.
Preview Simplicity Studio 5 User's Guide
Explore Silicon Labs' Simplicity Studio 5, a powerful integrated development environment (IDE) for IoT and embedded systems. This user guide covers installation, project configuration, debugging, energy profiling, network analysis, and protocol-specific tools for Silicon Labs microcontrollers and wireless SoCs.
Preview Silicon Labs RAIL: Developing with Radio Abstraction Interface Layer
Explore the Silicon Labs RAIL (Radio Abstraction Interface Layer) for developing proprietary and standards-based wireless applications. This guide covers SDK versions, features, API changes, and bug fixes for efficient radio development.
Preview Silicon Labs Bluetooth C Application Developer's Guide for SDK v3.x
Comprehensive guide for C developers on building applications with the Silicon Labs Bluetooth SDK v3.x for Wireless Gecko devices, covering stack architecture, development flow, configuration, and resource management.
Preview RAIL: Silicon Labs Radio Abstraction Interface Layer Documentation
Comprehensive guide to Silicon Labs' RAIL (Radio Abstraction Interface Layer), covering its fundamentals, features, API, and specific applications for EFR32 wireless SoCs. Includes details on BLE, IEEE 802.15.4, and other protocols.
Preview Silicon Labs RAIL API Reference Guide
Comprehensive guide to the Silicon Labs Radio Abstraction Interface Layer (RAIL) API, covering development, configuration, and features for embedded wireless applications.