Silicon Labs UG305 User Manual

UG305: Dynamic Multiprotocol User’s Guide
This user's guide provides details about implementing an applica­tion using Silicon Labs' Dynamic Multiprotocol solution. Dynamic multiprotocol time-slices the radio and rapidly changes configura­tions to enable different wireless protocols to operate reliably at the same time.
KEY POINTS
• About the Radio Scheduler
• Radio Scheduler examples
• Interaction with Micrium OS
• Protocol-specific implementation notes
silabs.com | Building a more connected world. Rev. 1.0
UG305: Dynamic Multiprotocol User’s Guide
Introduction

1. Introduction

This document describes how Silicon Labs software is designed to be used by multiple protocols on a single wireless chip. Dynamic multiprotocol time-slices the radio and rapidly changes configurations to enable different wireless protocols to operate reliably at the same time.
Details on specific dynamic multiprotocol implementations are provided in the following application notes:
AN1133: Dynamic Multiprotocol Development with Bluetooth and Zigbee
AN1134: Dynamic Multiprotocol Development with Bluetooth and Proprietary Protocols on RAIL in GSDK v2.x
AN1269: Dynamic Multiprotocol Development with Bluetooth® and Proprietary Protocols on RAIL in GSDK v3.x
AN1209: Dynamic Multiprotocol Development with Bluetooth and Connect
AN1265: Dynamic Multiprotocol Development with Bluetooth® and OpenThread in GSDK v3.x

1.1 Terminology

The following lists some of the terminology specific to the dynamic multiprotocol implementation.
Radio Abstraction Interface Layer (RAIL): The common API through which higher level code gains access to the EFR32 radio.
Radio Operation: A specific action to be scheduled. A radio operation has both a radio configuration and a priority. Each stack can
request that the radio scheduler perform up to two radio operations (background receive and either Scheduled Receive or Scheduled transmit) at a time:
Background Receive: Persistent receive, intended to be interrupted by Scheduled operations, and returned to after their comple­tion.
Scheduled Receive: Receive packets or calculate RSSI at a specified time and duration. (Developers working on RAIL, note that in terms of the RAIL API, “Scheduled Receive” as used in this document refers to any receive operation, other than RAIL_StartRx, and is not just limited in scope to RAIL_ScheduleRx.)
Scheduled Transmit: Any one of various transmit operations including immediate transmit, scheduled (future) transmit, or CCA­dependent transmit. (Developers working on RAIL, note that in terms of the RAIL API, “Scheduled Transmit” as used in this docu­ment refers to any transmit operation, and is not limited in scope to RAIL_StartScheduledTx.)
Radio Config: Determines the state of the hardware that must be used to perform a radio operation.
Radio Scheduler: RAIL component that arbitrates between different protocols to determine which will have access to the radio.
Priority: Each operation from each stack has a default priority. An application can change default priorities.
Slip Time: The maximum time in the future when the operation can be started if it cannot begin at the requested start time.
Yield: A stack must voluntarily yield at the end of an operation or sequence of operations, unless it is performing a background receive.
Until the stack yields, the scheduler will not scheduler lower priority tasks.
RTOS (Real Time Operating System) Kernel: The part of the operating system that is responsible for task management, and inter­task communication and synchronization. This implementation uses the Micrium OS-5 kernel.
silabs.com | Building a more connected world. Rev. 1.0 | 2
UG305: Dynamic Multiprotocol User’s Guide
Introduction

1.2 Architecture

Dynamic Multiprotocol makes use of the EFR32 hardware and the RAIL software as its building blocks. Zigbee, Bluetooth, and/or any other standards-based or proprietary protocols can then be built on top of these foundational layers, using Micrium to manage execu­tion of code between different protocols. The following diagram illustrates the general structure of the software modules.
Figure 1.1. General Dynamic Multiprotocol Software Architecture
Beginning with version 2.0, RAIL requires the passing of a radio configuration handle to the RAIL API calls. This configuration describes various PHY parameters that are used by the stack.
Micrium OS is an RTOS that allows stacks and application logic to share CPU execution time.
The Radio scheduler is a software library that intelligently answers requests by the stacks to perform radio operations to maximize relia­bility and minimize latency. API’s provided by RAIL that do not engage the radio bypass the Radio scheduler.
The RAIL core configures the EFR32 hardware in response to instructions from the radio scheduler.

1.3 Single Firmware Image

Dynamic Multiprotocol allows a software developer to generate a single monolithic binary that is loaded onto an EFR32. Software up­dates are done by upgrading the entire binary. This is accomplished using the Gecko Bootloader, the details of which can be found in UG266: Silicon Labs Gecko Bootloader User’s Guide.

1.4 Independent Stack Operation

The Silicon Labs stacks still operate independently of one another in a Dynamic Multiprotocol situation. Certain long-lived radio opera­tions will have an impact on another protocol’s latency and compliant operation. It is up to the application to determine any special con­siderations for these events. See section 2. The Radio Scheduler for more information.
silabs.com | Building a more connected world. Rev. 1.0 | 3
UG305: Dynamic Multiprotocol User’s Guide
The Radio Scheduler

2. The Radio Scheduler

The Radio Scheduler is a component of RAIL (Radio Abstraction Interface Layer). RAIL provides an intuitive, easily-customizable radio interface layer and API, which supports proprietary or standards-based wireless protocols. The Radio Scheduler is designed to allow for radio operations that can be scheduled and prioritized. Different radio operations in each protocol may be more or less important, or more or less time sensitive, depending on the situation. The scheduler can take those into account when making decisions about con­flicts and how to adjudicate them.
Unless you are developing applications with a custom protocol on RAIL, most radio scheduler functions are handled automatically by underlying stack and RAIL code. You only need to use the stack through its normal API.
At a high level, the stack sends a radio operation (for example a Scheduled Receive or Scheduled Transmit). The radio operations are queued and then serviced at a future time based upon their parameters. When it is time to start the radio operation the scheduler exam­ines whether or not a competing event exists and whether or not the operation can be delayed. If the scheduler cannot run the event it returns the result to the higher layer, which may retry with new parameters.
Once the radio operation has started, the corresponding stack can send the scheduler additional operations based on the results of the previous operation (for example waiting for an ACK). At the end of each operation or sequence of operations the stack must yield use of the radio.

2.1 Radio Operations

Each event in the scheduler is broken up into elements called Radio Operations, which are associated with a radio config and a priority.
Every operation has a priority and is interrupted if the scheduler receives a higher priority operation that overlaps in time. Lower priority radio operations that cannot be run based on their schedule parameters will fail, and it is up to the respective stack to retry them. Once the scheduler actively runs a radio operation from the stack, the stack can continue to send additional radio operations until it voluntarily yields, or until the scheduler receives a higher priority radio operation and preempts it.
• Background Receive
• Scheduled Receive
• Scheduled Transmit
Each stack can ask the Radio Scheduler to perform up to two radio operations (background receive and either Scheduled Receive or Scheduled transmit) at a time:
Each operation has the following parameters:
Parameter Description
Start Time An indication at what point in the future this radio operation will run. This could be “run right now” or some
value in microseconds in the future.
Priority A number that indicates the relative priority of the operation. When using the default settings, Bluetooth
LE radio operations are almost always higher priority than Zigbee operations.
Slip Time An amount of time that the event can be delayed beyond its start time and still be acceptable to the stack.
This may be 0, in which case the event cannot be slipped.
Transaction Time The approximate amount of time that it takes to complete the transaction. Transmit events usually have a
much more well-defined transaction time, while receive events are often unknown. This is used to help the radio scheduler determine whether an event can be run.
The stack defines these various parameters appropriate to the operation being executed. For example, Bluetooth connection events are often scheduled in the future and have no allowed slip, whereas Zigbee transmit events can often be delayed a small amount and start later.
From the perspective of the RAIL Radio Scheduler, Scheduled transmit and Scheduled receive are identical. They are both simply op­erations that require use of the radio, and thus cannot be executed simultaneously. The difference is only apparent at RAIL API layer, where either a TX or RX API is called.

2.1.1 Background Receive

This is a continuous receive mode that is intended to be interrupted by other operations, and returned to after their completion. If Back­ground Receive is higher priority than other operations, those radio operations will not be scheduled and will not run. It is up to the stacks or application to change the priority or voluntarily yield. See section 6.1 Examples with Background Receive, Yield Radio and
State Transition for examples of how Background receive interacts with Scheduled operations.
silabs.com | Building a more connected world. Rev. 1.0 | 4
UG305: Dynamic Multiprotocol User’s Guide
The Radio Scheduler

2.1.2 Scheduled Receive

This is a receive at a future time with a specified duration. The radio scheduler will take into consideration the radio switching time in deciding whether or not the operation will be scheduled. If it cannot be scheduled then the scheduler sends a fail event to the calling stack. The radio operation is automatically extended until the stack voluntarily yields, or the scheduler receives a higher priority opera­tion and interrupts it. Extending the receive allows the stack to continue a radio operation based on the requirements of the higher level protocol, for example transmission of a response based on the received data.

2.1.3 Scheduled Transmit

This is a transmit at a future time with a minimum duration. This minimum duration can include expected follow-on events, for example an ACK to an IEEE 802.15.4 transmit. However, the minimum time for this operation does not have to include unexpected events that may extend the time beyond the minimum duration, for example backoffs due to CCA failures in IEEE 802.15.4. The radio scheduler takes into consideration the radio switching time in deciding whether or not the operation will be scheduled. If it cannot be scheduled then the scheduler sends a fail event to the calling stack.

2.2 Radio Config

Each radio operation is associated with a predefined radio config that determines the state of the hardware that must be used to per­form the operation. The Radio Configs keep track of the stack's current state so that future radio operations will use the same radio parameters. Radio Configs may be active or dormant. If the stack changes an active Radio Config then RAIL makes an immediate change to the hardware configuration as well, for example changing a channel. If the radio config is not currently active then the next scheduled radio operation will use the new radio config.

2.3 Priority

Each radio operation has a priority which indicates to the scheduler which operation should be executed if there is a timing overlap between multiple operations. The scheduler treats a priority of 0 as the highest priority and 255 as the lowest priority. The radio schedu­ler will allow the task with the highest priority to access the physical radio hardware. With most tasks control is returned to the radio scheduler only on completion, but tasks like background receive will be interrupted in case a task with higher priority becomes active.
The stacks each have a default set of priorities based on Silicon Labs’ analysis of how best to cooperate to maximize the duty cycle and avoid dropped connections for a generic use case. Specific use cases may have different needs. The priorities are as follows, from highest to lowest:
1. Bluetooth LE Scheduled Transmit
2. Bluetooth LE Scheduled Receive
3. Other protocol Scheduled Transmit
4. Other protocol Background Receive
These priorities may be overridden or changed by the application. It is up to the application to decide under what circumstances to change them. Section 5.2 802.15.4 RAIL Priority and section 7.1 Bluetooth Priorities contain more details on priorities for their specific instances.

2.4 Slip Time

Every radio operation must have a "slip time", or maximum start time, meaning the furthest time in the future when the operation can be started if it cannot begin at the requested start time. This allows for the scheduler to work around higher priority events that are occur­ring at the same time, or higher priority events that extend beyond their expected duration. The protocol generally dictates what the slip time can be, but the radio scheduler is capable of handling this on a per-operation basis, allowing a stack to slip some events but not others. In general, IEEE 802.15.4 has longer slip time and Bluetooth LE has a minimal slip time.

2.5 Yield

Once a sequence of radio operations is actively being run, the stack may continue to add operations extending the initial operation until the stack has nothing more to do for the particular message exchange. A stack must voluntarily yield unless it is performing a back­ground receive. If a stack does not yield then it will continue to extend its radio operation, and lower priority radio operations will then trigger a failure back to the corresponding stack that requested that radio operation. A higher priority operation cannot interrupt a cur­rently-running, lower priority radio operation that has not yielded. See section 6.1 Examples with Background Receive, Yield Radio and
State Transition for examples of situations where explicitly yielding the radio is necessary.
silabs.com | Building a more connected world. Rev. 1.0 | 5
UG305: Dynamic Multiprotocol User’s Guide
The Radio Scheduler

2.6 Interrupting a Radio Operation

A scheduled radio operation may be interrupted if a higher priority operation conflicts with it. This could occur in the following two cir­cumstances:
1. A scheduled radio operation takes longer than expected and the corresponding stack does not yield before the higher priority radio operation must start.
2. A higher priority radio operation has just been scheduled to occur in the future and conflicts with a lower priority operation already scheduled.

2.7 Long-Lived Radio Operations

Certain long-lived Radio Operations can have an outsized impact on the correct operation of the product. The application may need to coordinate these operations between the protocols. If the application does not then the radio scheduler priorities will take precedence. For example, an IEEE 802.15.4 energy scan can require that the radio stay on to gather sufficient energy readings. If the application does not properly coordinate the operations, the scan could be interrupted prematurely due to a higher priority Bluetooth operation.
silabs.com | Building a more connected world. Rev. 1.0 | 6
UG305: Dynamic Multiprotocol User’s Guide
Radio Scheduler Examples

3. Radio Scheduler Examples

All examples use Bluetooth LE and Zigbee, but the principles apply to other Bluetooth/802.15.4 combinations.
The scheduler starts out by having a low priority Zigbee background receive operation. This represents an always-on router that may need to receive IEEE 802.15.4 packets at unknown times. A Bluetooth LE connection is also active and requires the stack to be ready to receive every 30 ms. The Bluetooth LE stack may schedule this well in advance due to the connection’s predictable nature.

3.1 Priority Scheduling

This provides a basic example of adjudicating priorities of the different radio operations.
The Zigbee stack decides that it needs to send a packet. It may do this as an on-demand event, meaning the stack decides that it wants to send a packet now without informing the scheduler well in advance. This is in contrast to how Bluetooth LE operates, where the scheduled operations are known reasonably far in advance. The scheduler evaluates that it is possible to perform the Zigbee TX 1 radio operation and still service the higher priority Bluetooth LE reception event in the future. So the scheduler allows the transmit event to occur. The Zigbee stack performs all the pieces of this transmit operation (waiting for a MAC ack), and then voluntarily yields. The estimated transaction time of the Zigbee transmit radio operation does NOT include retries.
In this example, Bluetooth LE is already scheduled to receive in the future and the Zigbee stack wants to transmit. For the first Zigbee TX 1 radio operation there is enough time before the Bluetooth LE RX 1 radio operation so the scheduler allows the stack to perform the operation. Later, when the Zigbee stack tries to schedule Zigbee TX 2 the scheduler determines there is not enough time before the high priority Bluetooth LE RX 2 event. However, the Zigbee stack has indicated that this action may slip its start time. The radio schedu­ler determines that given the expected duration of the Bluetooth LE radio operation the Zigbee operation can start after that event and still be within the slip time indicated by the Zigbee stack.
If all goes as expected, the Zigbee transmit operation will have its first attempt occur without any failures due to scheduling.
silabs.com | Building a more connected world. Rev. 1.0 | 7

3.2 Priority Interruption Example

This example illustrates a higher priority operation interrupting a lower priority one.
UG305: Dynamic Multiprotocol User’s Guide
Radio Scheduler Examples
This example starts in the same way as the previous example. Zigbee and Bluetooth LE both have a radio operation that is scheduled without any collision.
Later, the Zigbee stack decides it wants to send another packet for the Zigbee TX 2 event. The scheduler determines that it should be possible to schedule this event and service the Bluetooth LE RX 2 event later, based on the minimum time that the Zigbee TX 2 event must take. However, the Zigbee TX 2 event takes longer than expected due to a long random backoff and does not yield in time. This causes the event to collide with a higher priority radio operation, and so the Radio Scheduler interrupts the Zigbee event and returns a failure to the higher level stack. The Bluetooth LE event occurs normally and when it is complete it voluntarily yields to any lower priority operations.
Upon receiving the failure from the radio scheduler the Zigbee stack immediately attempts to retry the MAC message. It schedules the operation and includes a slip time. At this point the Bluetooth LE stack has priority over the radio and thus the operation cannot be started yet, but the scheduler accepts the new radio operation. The Bluetooth LE stack completes its scheduled receive and yields the radio. The scheduler then triggers the Zigbee transmit operation to occur because it is still within the slip time of the initial start opera­tion. After the transmit completes the scheduler returns to the background receive operation.
silabs.com | Building a more connected world. Rev. 1.0 | 8
UG305: Dynamic Multiprotocol User’s Guide
Radio Scheduler Examples

3.3 Higher Priority Operation that is Extended

This example shows what happens when a higher priority operation takes longer than originally anticipated and causes a lower priority operation to miss its opportunity.
In this case, Bluetooth LE has a Scheduled receive that is currently taking place. Zigbee decides to send a packet but it cannot be run right now. The scheduler accepts the operation under the assumption that the Bluetooth LE event will complete before the end of the slip time of the Zigbee event. However, the Bluetooth LE event extends longer due to the fact that additional packets are sent between the devices. The Bluetooth LE operation has priority so the Zigbee operation eventually runs out of slip. An error is returned to the stack. Zigbee decides to re-transmit the packet. Again, the Zigbee stack indicates the operation should start now but may slip into the future. The scheduler is in the middle of changing the radio config so it cannot begin the operation immediately. Instead, it slips the radio operation start time a small amount and then executes the operation.
silabs.com | Building a more connected world. Rev. 1.0 | 9
UG305: Dynamic Multiprotocol User’s Guide
Radio Scheduler Examples

3.4 Higher Priority Operation Without Interruption

In this example the radio scheduler is running on a node acting as a Bluetooth LE slave and that node has a number of connections to different masters. It also has a periodic advertising beacon that is transmitted. The following figure shows a case where these events are occurring virtually back-to-back and do not allow for enough time to switch back to the Zigbee radio config. Therefore it will create a period where the Zigbee stack is unable to transmit even with the slip time.
Zigbee asks the scheduler to schedule a transmit radio operation. Even though the scheduler knows that the event will fail due to scheduled higher priority operations, it still accepts the scheduled event. This is done for two reasons. First, circumstances may change and the event can be executed. Second, the stack sitting on top of the radio scheduler may try to retry the action. If the result of the failed scheduling was returned immediately then the stack's attempt to retry would be unlikely to succeed since no time has passed. Instead, by queuing the event and returning the failure after the slip time has expired, a retry (with its own slip time) has a better chance of success as the set of upcoming radio operations will be different.
silabs.com | Building a more connected world. Rev. 1.0 | 10
UG305: Dynamic Multiprotocol User’s Guide
Radio Scheduler Examples

3.5 Receive When a Higher Priority Operation is Running

This example illustrates what happens when Bluetooth LE is active and a lower priority operation will be receiving data.
In the first case, when an IEEE 802.15.4 message is sent and the Bluetooth LE stack is utilizing the radio for an active receive the Zigbee stack will not be online to receive the message. However, the Zigbee sender of the message will retry in most cases and with backoffs and other timing alterations is not going to conflict with another higher priority scheduled Bluetooth receive events unlikely to collide. The Zigbee message is received successfully.
The second case shows that, in the case of an active receive, the Zigbee stack may still be interrupted and not receive (or ACK) the message. Successful communication relies on retries at the MAC or higher layer to send this message again and verify the Dynamic Multiprotocol device receives the message.
While there may be considerations for whether or not active receive should be interrupted, it is difficult for the scheduler to make that determination. In general the robustness of the protocols should allow for messages to be successfully received even with interruptions.
silabs.com | Building a more connected world. Rev. 1.0 | 11
UG305: Dynamic Multiprotocol User’s Guide
Micrium OS

4. Micrium OS

Each stack runs a separate RTOS task utilizing the Micrium OS-5 kernel to provide the task switching. A task is equivalent to a thread in other operating systems. The tasks coordinate using various IPC (interprocess communication) mechanisms (message queues and semaphores) to pass information back and forth. The tasks differ based on the protocol. Zigbee requires four tasks, while Connect re­quires five. The following sections describe task handling for Zigbee and Connect.
Note that in Gecko SDK Suite v3.0, the Bluetooth API structure was completely updated. Among other changes, all function calls were renamed. In the following sections, both the v2.x and the v3.x variants are provided.

4.1 Zigbee and Bluetooth

The following figure illustrates Micrium OS task switching for Zigbee and Bluetooth
Figure 4.1. Micrium OS Task Switching
A Zigbee/Bluetooth Dynamic Multiprotocol application requires several tasks in order to operate:
• Application/Zigbee Stack task
• Bluetooth link layer task
• Bluetooth host task
• Idle task
These have been implemented for the Micrium RTOS for you.
silabs.com | Building a more connected world. Rev. 1.0 | 12
Loading...
+ 25 hidden pages