Bluetooth Stack Comparison
We compare five operating systems and their Bluetooth stacks on eleven characteristics. The intention is to enable a feeling of what the different operating systems are capable of. Afterward, we give a short summary of the different stacks used.
Embassy | Drogue OS | tock | RIOT | Zephyr | |
---|---|---|---|---|---|
Bluetooth Stack | SoftDevice | SoftDevice | tock Stack | NimBLE | Zephyr Stack |
Number of concurrent links | 20 | 20 | 32 | unlimited | |
Advertising (Broadcaster) | |||||
Connecting (central) | |||||
Scanning (observer) | |||||
Connectable (peripheral) | |||||
Over-air device firmware updates | |||||
Asynchronous, event-driven behaviour | |||||
Implemented in Rust | |||||
Implemented in C | |||||
Bluetooth Mesh | Maybe | Maybe | |||
L2CAP Connections |
Some of the operating systems use the same underlying Bluetooth stack. Thus we only have four different Bluetooth stacks:
- SoftDevice
- NimBLE
- Zephyr Stack
- tock Stack
SoftDevice
The SoftDevice includes a BLE protocol stack that is compliant with Bluetooth 5.1 (Host & Controller). It is built and provided by Nordic Semiconductor, the producer of the nRF52840 DK board we targeted. Thus, it provides the full support those boards are capable of. Sadly, it is not Open Source and written in C. So the usage of this stack makes it impossible to build an application purely based on Rust. But, it clearly enables the best usage of the hardware.
NimBLE
Apache NimBLE is a Bluetooth 5.4 compliant Bluetooth stack. It is part of the Apache Mynewt project which "is an open source operating system for tiny embedded devices" (Apache Mynewt). NimBLE approaches to replace the SoftDevice and thus supports multiple Nordics chipsets. It is also written in C but it is open source which might make it favorable over Nordics SoftDevice.
Zephyr Stack
The Zephyrs Bluetooth Stack is Bluetooth 5.3 compliant. It is part of the zephyrproject or the Zephyr RTOS which is open source and programmed in C. While the stack overall is fine, bringing it together with Rust is a hassle as described later in Zephyr.
tock Stack
The tock Bluetooth Stack is part of tock, a secure open source operating system for embedded devices which is completely written in Rust. Sadly, the tock Bluetooth Stack is still quite minimal, which results in not being able to connect. This limits the capability of this stack to advertising and scanning.