Note: This KBA has been marked as deprecated. A more updated KBA can be found here:
For each Bluetooth connection, there is a set of parameters that can be changed changed on the fly, depending on the application requirements. These include: connection interval, slave latency and supervision timeout. For example, to minimize power consumption you can increase the connection interval and slave latency. This reduces the RF duty cycle and allows the peripheral to stay longer in sleep mode if there is no need to transmit any user data.
More details about Bluetooth connections can be found in document UG103.14: Application Development Fundamentals: Bluetooth® Smart Technology.
An important thing to note about connection parameters is that the master (typically a mobile device) controls what parameters are used. When master initiates a connection to a slave, it selects the default parameters that are used. The slave can request updating of the connection parameters. However, it is up to the master to either accept or reject this request.
Depending on the master, they may be different restrictions on which parameter combinations are accepted. This article focuses on the recommendations for iOS devices specified by Apple.
The rules for selecting connection parameters for BLE peripherals that are defined in the document Accessory Design Guidelines for Apple Devices, available for download at:
The BLE connection parameters are discussed in section 10.6 Connection Parameters. For example, the minimum connection interval is specified as 15 ms. Note that the minimum interval allowed by the Bluetooth core specification is 7.5 ms.
At the time of writing, the latest version of the guideline document is R5 (dated 2018-03-27).
There are several rules that need to be fulfilled to be compliant with the iOS guidelines. To help selecting a set of compatible parameters, an Excel sheet is provided as an attachment.
To use the checker, you can enter the connection parameters in the cells that are marked in grey color. The input parameters are in the same order and using the same units as in the BGAPI call cmd_le_gap_set_conn_parameters.
Below the parameters, there is one line for each rule (numbered #1 .. #7). Next to each rule, there is a column with text OK / NOT OK, depending if the rule is passed or not. By changing the parameters, you can easily see which rules are violated and tune the parameters accordingly.
An example set of parameters that complies with all the rules is shown below.
There is OK displayed next to each of the rules 1..7, indicating that there are no violations.
The next example shows a set of parameters that is not fully compliant with the iOS design guidelines.
In this latter example, it is easy to identify which of the rules are violated. The connection interval must be an integer multiple of 15 ms. Additionally, the supervision timeout is too short. To fix this, you can change the minimum interval (using e.g. 150ms) and increase the supervision timeout.
NOTE: there are many possible ways to fix the parameters. In the above case, it is possible to also decrese the slave latency to be compliant with the last rule #7.
The parameters used in these examples are randomly selected just for illustration purposes. The parameters used in real applications is something that the application developer needs to decide case by case. The purpose of this tool is simply to help check the compatibility of a set of parameters against the rules listed in the Apple guideline document.
The following BGAPI commands and events are related to connection parameter adjustments:
cmd_le_connection_set_parameters: Used to request a change of connection parameters after a connection has been opened.
evt_le_connection_parameters: Triggered when connection is opened and any time the connection parameters are changed.
When the slave calls cmd_le_connection_set_parameters and the function returns success, this does not mean that the parameters are changed. It only indicates that the request has been registered in the stack. The stack then tries to update the parameters and if they are successfully changed then event evt_le_connection_parameters is triggered. Therefore the slave application must monitor this event to see what are the actual parameters that are effective for the current connection.
NOTE: command cmd_le_gap_set_conn_parameters is used to set the default connection parameters. This only affects connections that the device is opening as a master. This command is not relevant for slave devices because the master selects the default parameters.
I just spent two weekends, and built a spreadsheet myself LOL
But now I can compare with this official one.
@ww let me know if you find any conflicts between your sheet and mine :)
And I would like to point out that this excel sheet is not to be considered as an "official reference", it is just an informal helper tool to make your life easier.