No single wireless protocol is ideal for every application of wireless sensor networks (WSN). For example, a lighting network can use Zigbee for communication among the light devices in the network while allowing configuration, software updates, and diagnostics via a Bluetooth smart phone or tablet. Or a home automation system can use IEEE 802.15.4-2015 to connect the devices in the system while supporting Bluetooth connectivity between one or more of the devices and a smart phone or tablet for configuration and monitoring.
Thus, there is a need for concurrent execution of more than one protocol on a wireless sensor device. Further, given the constrained power and memory resources in a wireless sensor device, it is important that the concurrent execution of multiple protocols avoids wasting CPU cycles and memory resources.
Embodiments of the present disclosure relate to methods and apparatus for concurrent use of multiple protocols on a single radio. In one aspect, a method for concurrent execution of multiple protocols using a single radio of a wireless communication device is provided that includes receiving, in a radio command scheduler, a first radio command from a first protocol stack of a plurality of protocol states executing on the wireless communication device, determining a scheduling policy for the first radio command based on a current state of each protocol stack of the plurality of protocol stacks, and scheduling the first radio command in a radio command queue for the radio based on the scheduling policy, wherein the radio command scheduler uses the radio command queue to schedule radio commands received from the plurality of protocol stacks.
In one aspect, a wireless communication device is provided that includes a radio, a radio command scheduler, a memory storing software instructions, wherein execution of the software instructions causes the wireless communication device to concurrently execute multiple protocols using the radio, the software instructions including software instructions to cause the radio command scheduler to receive a first radio command from a first protocol stack of a plurality of protocol stacks executing on the wireless communication device, determine a scheduling policy for the first radio command based on a current state of each protocol stack of the plurality of protocol stacks, and schedule the first radio command in a radio command queue for the radio based on the scheduling policy, wherein the radio command scheduler uses the radio command queue to schedule radio commands received from the plurality of protocol stacks, and a processor coupled to the memory to execute the software instructions.
Specific embodiments of the disclosure will now be described in detail with reference to the accompanying figures. Like elements in the various figures are denoted by like reference numerals for consistency.
Embodiments of the disclosure provide for concurrent execution of multiple protocols, e.g., Bluetooth Low Energy (BLE), Zigbee, Thread, IEEE 802.15.4-2015, and/or a proprietary protocol, using a shared single radio resource in a wireless communication device, e.g., a wireless sensor device or a gateway device.
The MCU 200 incorporates a main CPU 202 for executing applications and protocol software that is implemented as a 32-bit ARM® Cortex®-M4F processor. The protocol software includes protocol stacks for the supported protocols, e.g., Thread, Zigbee, 6LoWPAN, Bluetooth 5, and/or proprietary protocols. General peripherals/modules 208 on the MCU 200 include a 12-bit A/D converter, interfaces for SPI, Microwire, and UART protocols, internal direct memory access (DMA), a real-time clock, multiple 16/32-bit timers, and more. The sensor interface 206 incorporates a programmable sensor controller and peripherals for interfacing with analog or digital sensors.
The MCU 200 also incorporates a radio frequency (RF) core 204 that implements a dual-band sub-1 GHz and 2.4 GHz RF transceiver compatible with multiple protocols including the Bluetooth 5 low energy protocol and the IEEE 802.15.4 protocol. The RF core 204 is designed to autonomously handle time critical aspects of transmitting and receiving various radio protocols. The RF core 204 includes a processor implemented as an ARM® Cortex®-MO processor for executing software that, e.g., interfaces the analog RF and base-band circuitry, handles data transmission to and from the main CPU 202, and assembles packets for transmission based on the particular protocol corresponding to the packets. The software includes a command-based application program interface (API) used by applications executing on the main CPU 202 to communicate with the RF core 204.
The MCU 200 also incorporates flash memory that provides nonvolatile storage for code and data, static random access memory (SRAM) that can be used for both storage of data and execution of code, and a read-only memory (ROM) storing a real-time operating system kernel. Software instructions implementing methods as described herein can be stored in a computer readable medium on the MCU 200 such as the flash memory, the static random access memory (SRAM), or the read-only memory (ROM) on the MCU 200 and executed by the main processor 202.
A dynamic multi-protocol manager (DMM) executing on the main CPU 202 provides time shared access to the radio for radio commands issued by multiple protocol stacks. The DMM handles dynamic switching of the radio between radio commands issued by the protocol stacks based on scheduling policies and run-time stack states. In general, the DMM receives radio commands from the protocol stacks and inserts the commands into a command queue based on scheduling policies associated with the current states of the stacks and timing information specified in command parameters. The DMM also dispatches commands from the command queue to the radio driver for the radio.
The radio command scheduler 314 manages the radio command queue 320, both adding radio commands to the queue 320 and dispatching radio commands from the queue 320 to the radio driver 310. The radio command scheduler 314 inspects the parameters of each intercepted radio command that needs to be scheduled to determine the start and end times specified for the radio command. The radio command scheduler 314 then attempts to add the radio command to the radio command queue 320 based on the specified start and end times and on a scheduling policy corresponding to the current states of the protocol stacks 306, 308. Each application 302, 304 notifies the radio command scheduler 314 via the DMM interface 312 each time the state of the associated protocol stack 306, 308 changes so that the scheduler 314 knows the current state of each stack when a new radio command needs to be scheduled.
In general, the radio command scheduler 314 scans the radio command queue 320 to attempt to schedule the new radio command in view of the scheduling policies and time parameters of commands in the radio command queue 320 and the time parameters and scheduling policy of the new radio command. The radio command scheduler 314 can, for example, insert the new radio command between radio commands in the radio command queue 320, preempt a currently executing radio command and place the new radio command at the head of the radio command queue 320 to be executed immediately, append the new radio command to the end of the radio command queue 320, or reject the new radio command if the new radio command cannot be added to the queue 320 given the time parameters and the scheduling policy, or, under some circumstances, change the timing of the new radio command so that the new radio command can be added to the radio command queue 320. The scheduling of commands by the radio command scheduler 314 is described in more detail herein in reference to the method of
A policies data structure 318, e.g., a table or other suitable data structure, stores the scheduling policies used by the scheduler 314. The policy manager 316 initializes the policies data structure 318 when the MCU 200 is powered up from scheduling policy definitions submitted via the DMM interface 312. In some embodiments, the scheduling policies are user-specified. In some embodiments, there are default scheduling policies that can be changed by the user. In some embodiments, a scheduling policy can be changed dynamically by submitting changes to the policy manager 318 via the DMM interface 312.
A scheduling policy corresponding to the current states of the protocol stacks informs the radio command scheduler 314 how any scheduling conflicts for a new radio command are to be resolved. For example, a scheduling policy corresponding to the current protocol stack states can specify the priority of radio commands from each protocol stack 306, 308 and a timing constraint indicating whether or not radio commands from each protocol stack are time critical. If a new radio command is not time critical, the scheduler 314 can potentially modify the time parameters of the new radio command and/or modify the time parameters of an already scheduled radio command that is not time critical in order to schedule the new radio command. The policies data structure 318 includes a scheduling policy for expected combinations of protocol stack states. Further, in some embodiments, multiple stack states of one or both protocol stacks 306, 308 can be mapped to a single scheduling policy.
For example, assume Application A 304 is acting as a BLE peripheral and protocol stack A 308 is a BLE stack and Application B 302 is a sensor application and protocol stack B 306 is for a proprietary protocol. Table 1, Table 2, Table 3, and Table 4 are example scheduling policies for the expected combinations of stack states. Table 4 illustrates a default scheduling policy that is used if the combination of stack states when a radio command is received does not match one of the stack state combinations shown in Tables 1-3.
The radio command scheduler 314 then schedules 404 the new radio command based on the scheduling policy and the time parameters specified in the radio command. More specifically, the radio command scheduler 314 attempts to schedule the radio command based on one or more of the following criteria: 1) the priority of the radio command as specified in the scheduling policy for the protocol stack that issued the radio command; 2) the timing constraint of the radio command as specified in the scheduling policy for the protocol stack that issued the radio command; 3) the start time of the radio command; and 4) the end time of the radio command.
If the new radio command is a high priority command as per the scheduling policy, the currently executing radio command is a low priority command, and the start and end time parameters of the new radio command overlap the time slot of the low priority command, the scheduler 314 aborts execution of the low priority radio command and places the new radio command at the head of the radio command queue 320 to be immediately executed. The scheduler 314 appends the aborted low priority radio command to the radio command queue 320 if the low priority command is not time critical; otherwise, the radio command scheduler 314 notifies the protocol stack that issued the low priority radio command that the radio command was aborted. If the low priority radio command is pre-empted and appended to the radio command queue 320, the low priority radio command will be executed from the beginning, not resumed at the point where execution was aborted.
If the currently executing radio command is also high priority or the new radio command is low priority, the radio command scheduler 314 attempts to add the new radio command to the radio command queue 320. The radio command scheduler 314 scans the radio commands in the radio command queue 320 looking at the priorities, timing constraints, and time parameters of the queued commands as compared to the same for the new radio command to decide if and where the new radio command can be placed in the radio command queue 320. If the time slot specified by the start time and end time parameters of the new radio command is available between two queued radio commands (as determined by the start and end times of the new radio command and the queued radio commands), the radio command scheduler 314 inserts the new radio command in the radio command queue 320 between the two queued radio commands regardless of the priority of the new radio command and the priorities of the queued radio commands. Note that insertion based on start and end times can result in a low priority command being inserted in the radio command queue 320 before a high priority command. In determining if the specified time slot is available between two queued radio commands, the radio command scheduler 314 can consider modifying the time parameters of queued radio commands that are not time critical to defer execution to free up the specified time slot for the new radio command.
If the radio command scheduler 314 cannot insert the new radio command in the radio command queue 320 at the specified time slot because the time slot is occupied, completely or partially, by a queued radio command, the radio command scheduler 314 then determines whether the new radio command can pre-empt the queued radio command. If the new radio command is low priority, the radio command scheduler 314 cannot pre-empt the queued radio command occupying the specified time slot in favor of the new radio command as a low priority radio command cannot pre-empt either a high priority radio command or another low priority radio command. In this instance, the radio command scheduler 314 appends the new radio command to the end of the radio command queue 320 if the scheduling policy indicates that the new radio command is not time critical; otherwise, the new radio command cannot be scheduled and the radio command scheduler 314 rejects the new radio command.
If the new radio command is high priority and the queued radio command occupying the specified time slot is also high priority, the radio command scheduler 314 cannot pre-empt the queued radio command in the specified time slot in favor of the new radio command as a high priority radio command cannot pre-empt another high priority radio command. In this instance, the radio command scheduler 314 appends the new radio command to the end of the radio command queue 320 if the scheduling policy indicates that the new radio command is not time critical; otherwise, the new radio command cannot be scheduled and the radio command scheduler 314 rejects the new radio command.
If the new radio command is high priority and the queued radio command occupying the specified time slot is low priority, the radio command scheduler 314 pre-empts the queued low priority radio command to free up the specified time slot for the new radio command in the radio command queue 320 and inserts the new radio command in the radio command queue 314. The radio command scheduler 314 appends the pre-empted low priority radio command to the end of the radio command queue 320 if the pre-empted radio command is not time critical; otherwise, the radio command scheduler 314 aborts the pre-empted radio command and notifies the protocol stack that issued the low priority radio command that the radio command has been pre-empted. In each of the above instances in which the radio command scheduler 314 appends a radio command to the radio command queue 320, the radio command scheduler 314 modifies the time parameters of the appended radio command as needed to accommodate the start time and end time deferral.
While the disclosure has been described with respect to a limited number of embodiments, those having benefit of this disclosure will appreciate that other embodiments can be devised which do not depart from the scope of the disclosure as disclosed herein.
Embodiments have been described herein assuming a dual-band radio. In some embodiments, the radio is single band and all protocols stacks share the same band. In some embodiments, the radio has more than two bands.
Embodiments have been described herein in reference to example scheduling policies that specify the priority and timing constraint of a new radio command. In some embodiments, scheduling policies can include more and/or different information that the scheduler considers when scheduling new radio commands.
For simplicity of explanation, embodiments have been described herein assuming concurrent execution of two protocols using a single radio resource. Other embodiments provide concurrent execution of more than two protocols using a single radio resource. For example, protocol stacks for ZigBee (2.4 GHz), Thread (2.4 GHz) and BLE (2.4 GHz) or protocol stacks for a proprietary protocol (sub-1 GHz), Thread (2.4 GHz) and BLE (2.4 GHz) can be concurrently executed. An example application that can benefit from concurrent execution of more than two protocols is a home automation gateway that controls devices that communicate using different protocols, e.g., a BLE door bell, ZigBee lights, and a Thread thermostat.
It is therefore contemplated that the appended claims will cover any such modifications of the embodiments as fall within the true scope of the disclosure.
This application is a continuation of U.S. patent application Ser. No. 17/567,975, filed Jan. 4, 2022, which is a continuation of U.S. patent application Ser. No. 16/101,121, filed Aug. 10, 2018, now U.S. Pat. No. 11,219,039, issued Jan. 4, 2022, which claims the benefit of U.S. Provisional Patent Application No. 62/544,439, filed Aug. 11, 2017, each of which is incorporated by reference herein in its entirety.
Number | Date | Country | |
---|---|---|---|
62544439 | Aug 2017 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 17567975 | Jan 2022 | US |
Child | 18182530 | US | |
Parent | 16101121 | Aug 2018 | US |
Child | 17567975 | US |