1. Connection Subrating feature
It can sometimes be necessary for a device to use a low duty cycle connection for some use cases but be able to switch up to a high duty cycle when required to support other use cases.
Link Layer procedures that use "instants" such as the connection update procedure generally involve connection property changes that if not executed successfully by both devices can result in loss of connection.
To start the connection update procedure, the Host must send the controller a LE Connection Update command. The controller must respond by initiating the link layer Connection Update procedure, sending a LL_CONNECTION_UPDATE_IND PDU to the Peripheral with the
Instant field specifying a connection event which is at least six events in the future at which point the connection parameter changes must be applied by both the Peripheral and Central.
Bluetooth® Connection update |
---|
Use cases which are expected to benefit from subrated connections include Bluetooth LE Audio products such as hearing aids and monitoring systems which use sensors.
An audio device like a hearing aid can maintain a subrated connection to a smartphone, making the connection available for immediate use when it becomes necessary to handle audio communication.
Subrating saves power but also allows the connected isochronous stream to be established very quickly.
Using subrated connections, a sensor can efficiently maintain a persistent, low duty cycle subrated connection to another device which collects sensor data.
When required it can then switch the connection up to a high duty cycle quickly so that accumulated sensor data can be uploaded over a higher bandwidth connection.
Bluetooth LE connections offer a highly flexible way to adapt to dynamic changes of requirements in terms of data throughput and power.
A high duty cycle connection achieves higher data throughput on the expense of increased power consumption, while a low duty cycle connection saves power on the expense of data throughput.
1.1. Connection subrating capabilities and benefits
The LE Enhanced Connection Update change introduces the concept of subrated connections.
A subrated connection achieves a power saving low duty cycle in a different way to non-subrated connections and is able to switch up to a high duty cycle more quickly.
Subrated connections are also able to handle variable packet rates or bursty traffic in an efficient way.
The ability to switch quickly from a low duty cycle connection to a high duty cycle connection when required and in a short time, will provide an improved user experience for some important product types and is the main benefit of the new subrated connections feature.
1.2. how to implement on STM32WBA applications
Feature available in "full Link Layer" (use of "full ble stack") for STM32WBA.
1.2.1. Server and Client
It is necessary to set connection subrating feature.
hci_le_set_host_feature(0x26, 0x01);
After LE link establishment, the central requires subrating.
hci_le_subrate_request |
---|
Description
|
2. Example of GATT Caching feature use on STM32WBA
2.1. Advertising data
At startup, Gatt caching Server application starts Advertising.
Data advertised are composed as follows:
Gatt caching Server Advertising packet | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Manufacturer data are encoded following STMicroelectronics BlueST SDK v2 as described below:
STMicroelectronics Manufacturer Advertising data | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2.2. On-board buttons configuration
Button configuration for Bluetooth® Low Energy Gatt caching application on Nucleo-WBA55CG boards | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2.3. Database Hash characteristic
If the client and the server are not bonded, then the server assumes, that the client checks the Database Hash and/or discovers the GATT database upon each connection before initiating any GATT operation.
Bluetooth® Database Hash characteristic |
---|
2.4. Client Supported Features characteristic
If the client enables Robust Caching, by setting the Robust Caching bit to 1 in the Client Supported Features characteristic, then the server can send a database out-of-sync error code (0x12) as a response to a GATT operation whenever it assumes, that the client has an out-of-date database.
Bluetooth® Robust caching feature in Client Supported Features characteristic |
---|
If the client and the server are bonded, then the server checks if the database has changed since the last connection and notifies the client about the change via Service Change Indication - just like before introducing GATT caching.
The only difference is, that if the client initiates a GATT operation before the indication is received and confirmed, the server can send a database out-of-sync error code. This helps to avoid race condition if the client would like to initiate a GATT operation too quickly after connection establishment.