bluetoothLEConnectionConfig
Description
Use bluetoothLEConnectionConfig object to set the link layer
(LL) connection configuration parameters at a Bluetooth® low energy (LE) Central or Peripheral node.
Creation
Syntax
Description
creates a default Bluetooth LE connection configuration object that shares the LL
connection configuration parameters between a Central node and a Peripheral node.cfgConnection = bluetoothLEConnectionConfig
sets properties by
using one or more name-value arguments. For example,
cfgConnection = bluetoothLEConnectionConfig(Name=Value)ConnectionInterval=0.04 sets the connection interval to 0.04
seconds.
Properties
LL connection interval, specified as a scalar in the range [0.0075, 4]. Specify this
value in seconds. This property specifies the interval between the start of two
consecutive LL connection events. Set this value as an integer multiple of 1.25
milliseconds. If the LL connection includes connected isochronous stream (CIS) events,
set this property as a multiple of (NumPeripherals × 1.25), where
NumPeripherals specifies the total number of Peripheral nodes
simulated in the network. For more information about the connection interval, see Volume
6, Part B, Section 4.5.1 of Bluetooth Core Specification v5.3 [2].
Data Types: double
Unique connection address, specified as an 8-element character vector or a string scalar denoting a 4-octet hexadecimal value. This property specifies a unique 32-bit access address for the LL connection between a Central node and a Peripheral node.
Data Types: char | string
List of used data channels, specified as an integer vector with element values in the range [0, 36]. This value specifies the indices of the assigned data channels. This property indicates the set of good channels used by the connection. To ensure that at least two channels are set as used (good) channels, specify a vector length greater than 1.
Data Types: double
Algorithm, specified as 1 or 2 representing
"Algorithm #1" or "Algorithm #2", respectively. This property specifies the channel
selection algorithm for LL connection events.
Data Types: double
Hop increment count, specified as an integer in the range [5, 16]. This property specifies the number of hops between data channels. If you set the Algorithm property to 1, the object uses this value as an input.
Data Types: double
CRC initialization, specified as a 6-element character vector or a string scalar denoting a 3-octet hexadecimal value.
Data Types: char | string
LL connection supervision timeout, specified as a scalar in the range [0.1, 32]. Specify this value in seconds. This property specifies the timeout for a LL connection if no valid packet is received within this time. Set this value as a multiple of 10 milliseconds.
Data Types: double
PHY mode for generating or decoding, specified as "LE1M",
"LE2M", "LE125K", or
"LE500K".
Data Types: char | string
Offset added to the connection event counter, specified as an integer in the range
[6, 65535]. Specify this value in seconds. The object updates the channel map after
InstantOffset connection events from the current connection
event.
Data Types: double
Offset for starting the connection event, specified as a scalar in the range [0,
ConnectionInterval]. Units are in seconds. Within a connection interval,
after the connection offset, communication begins between the Central and Peripheral
node.
If the connection between a Central and a Peripheral node includes CIS events,
specify this property as . For the first connection, the ConnectionOffsetOld
value is 0. For the subsequent connections, the
ConnectionOffsetOld value specifies the previous connection. The
NumPeripherals value specifies the total number of Peripheral nodes
simulated in the network.
In R2026a: This property is not applicable when the GAPConfig property of the bluetoothLENode object enables connection establishment at the node.
Data Types: double
Active communication period in each connection event, specified as a scalar in the range [0, ConnectionInterval]. Specify this value in seconds. This value specifies the start of communication between the Central and Peripheral nodes within a connection interval. The value must be sufficient to accommodate at least one data or control protocol data unit (PDU) transmission from the Central to the Peripheral and a corresponding response from the Peripheral to the Central within a single connection event. Additionally, set this value to include the entire data communication time between the Central and the Peripheral within the same connection event. Otherwise, the data communication occurs in the subsequent connection event.
Data Types: double
Since R2025a
Maximum number of data octets that a data protocol data unit (PDU) can carry, specified as a scalar in the range [27, 251] or a 1-by-2 vector. The maximum number of data octets that this property specifies excludes the message integrity check, if present. To comply with the specifications in Vol 6, Part B, Section 4.5.10 of [2], the object accepts a minimum value of 27 bytes for this property. If you specify this value as a vector, the first element denotes the maximum PDU size from the Central node to the Peripheral node, while the second element denotes the maximum PDU size from the Peripheral node to the Central node. If you specify this value as a scalar, the object applies the same maximum PDU value for both directions.
Data Types: double
Since R2025a
Interframe space in asynchronous connection-oriented logical (ACL) transport, specified as a nonnegative scalar less than 10,000 microseconds or a 1-by-2 vector. Specifying this value sets the time interval between two consecutive packets on the same channel index. Units are in seconds.
If you specify this property as a nonnegative scalar less than 10,000 microseconds, the TIFS value for the Central to the Peripheral node equals the TIFS value for the Peripheral to the Central node.
If you specify this property as a vector, the first element represents the time between the end of a transmission by the Central node and the subsequent transmission by the Peripheral node, while the second element denotes the time between the end of a transmission by the Peripheral node and the subsequent transmission by the Central node on an ACL. Note that each element of the vector must be a nonnegative scalar less than 10,000 microseconds.
For more information about interframe space in ACL transport, see Vol 6, Part B, Section 4.1.1 of [2].
Data Types: double
Since R2025a
Minimum spacing in connection events, specified as a nonnegative scalar less than 10,000 microseconds. Specifying this value enables you to set the minimum time interval between the last PDU that the Peripheral node transmits and the anchor point of the next connection event. For more information about minimum connection event spacing, see Vol 6, Part B, Section 4.1.5 of [2].
Data Types: double
Object Functions
configureConnection | Configure LL connection between Bluetooth LE Central and Peripheral nodes |
Examples
Create a Bluetooth LE node, specifying the role as "central".
centralNode = bluetoothLENode("central");Create two Bluetooth LE nodes, specifying the role as "peripheral".
peripheralNode1 = bluetoothLENode("peripheral"); peripheralNode2 = bluetoothLENode("peripheral");
Create a default Bluetooth LE configuration object to share connection between the Central and Peripheral nodes.
connectionConfig = bluetoothLEConnectionConfig
connectionConfig =
bluetoothLEConnectionConfig with properties:
ConnectionInterval: 0.0200
AccessAddress: "5DA44270"
UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36]
Algorithm: 1
HopIncrement: 5
CRCInitialization: "012345"
SupervisionTimeout: 1
PHYMode: "LE1M"
InstantOffset: 6
ConnectionOffset: 0
ActivePeriod: 0.0200
MaxPDU: 251
TIFS: 1.5000e-04
TMCES: 1.5000e-04
Specify the connection interval, connection offset, and active period for the LL connection, in seconds.
connectionConfig.ConnectionInterval = 0.04; connectionConfig.ConnectionOffset = 0; connectionConfig.ActivePeriod = 0.02;
Specify the unique connection address for the LL connection.
connectionConfig.AccessAddress = "5DA44271"connectionConfig =
bluetoothLEConnectionConfig with properties:
ConnectionInterval: 0.0400
AccessAddress: "5DA44271"
UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36]
Algorithm: 1
HopIncrement: 5
CRCInitialization: "012345"
SupervisionTimeout: 1
PHYMode: "LE1M"
InstantOffset: 6
ConnectionOffset: 0
ActivePeriod: 0.0200
MaxPDU: 251
TIFS: 1.5000e-04
TMCES: 1.5000e-04
Configure the LL connection between the Central node and Peripheral node 1.
configureConnection(connectionConfig,centralNode,peripheralNode1);
Update the LL connection configuration object to share connection parameters between the Central node and Peripheral node 2.
connectionConfig.ConnectionOffset = 0.02; % In seconds connectionConfig.ActivePeriod = 0.02; % In seconds connectionConfig.AccessAddress = "5DA44272"
connectionConfig =
bluetoothLEConnectionConfig with properties:
ConnectionInterval: 0.0400
AccessAddress: "5DA44272"
UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36]
Algorithm: 1
HopIncrement: 5
CRCInitialization: "012345"
SupervisionTimeout: 1
PHYMode: "LE1M"
InstantOffset: 6
ConnectionOffset: 0.0200
ActivePeriod: 0.0200
MaxPDU: 251
TIFS: 1.5000e-04
TMCES: 1.5000e-04
Configure the LL connection between the Central node and Peripheral node 2.
configureConnection(connectionConfig,centralNode,peripheralNode2);
More About
The bluetoothLEConnectionConfig object specifies several timing
parameters that work together to coordinate when and how long nodes communicate within each
connection event. This figure shows the timing relationships when a Central node maintains
simultaneous connections with two Peripheral nodes.
In the figure, each horizontal span labeled "Connection Event 1" and "Connection Event
2" represents the ConnectionInterval interval. The Central node uses
this periodic timing structure to schedule communication with each Peripheral node.
The time delay from t=0 (or from the anchor point) to when
communication begins with a specific Peripheral node is the
ConnectionOffset value. The figure shows this value for the "Central
to Peripheral 1" row, where the connection event starts at t=0,
indicating a ConnectionOffset of 0 seconds. When you connect multiple
Peripheral nodes to a single Central node, you configure the
ConnectionOffset values to prevent timing collisions. You can observe
in the figure that the "Central to Peripheral 2" row shows its "Connection Event 1" starting
after the "Central to Peripheral 1" row completes its active communication period. This
structured arrangement ensures that the Central node finishes communicating with Peripheral
1 before it begins communicating with Peripheral 2 within the same connection
interval.
Set the ActivePeriod value large enough to accommodate at least one
complete exchange: a data or control PDU transmission from the Central to the Peripheral,
followed by a response from the Peripheral to the Central. If the data exchange exceeds the
ActivePeriod value, the remaining communication defers to the next
connection event.
In the figure, "TIFS C to P" indicates the TIFS time interval
between the end of a Central node transmission and the start of the subsequent Peripheral
node transmission. "TIFS P to C" indicates the TIFS time interval
between the end of a Peripheral node transmission and the start of the subsequent Central
node transmission.
In the figure, the light blue segments at the end of each active period represent the
TMCES value. This value ensures that the Peripheral node has
sufficient time to complete its transmission and prepare for the next connection
event.
When a Central node connects to multiple Peripheral nodes, follow these guidelines to coordinate the timing parameters and prevent overlapping communication windows.
Set the
ConnectionIntervalvalue to the same value for all connections. Using the same interval allows the Central node to schedule communication with different Peripheral nodes without overlap.Calculate each Peripheral node's
ConnectionOffsetvalue to ensure its active period does not overlap with other Peripheral nodes. The offset increment equals (ConnectionInterval/NumPeripherals).Ensure the
ActivePeriodvalue for each connection fits within its allocated time slot.Include
TIFSandTMCESvalues when calculating the total time required for each connection event.
For example, this code snippet shows you a scenario where you connect two Peripheral
nodes to a single Central node with a ConnectionInterval of 40
ms.
% Create connection configuration for Peripheral node 1 cfgConnection1 = bluetoothLEConnectionConfig; cfgConnection1.ConnectionInterval = 0.04; cfgConnection1.ConnectionOffset = 0; % Starts at t=0 cfgConnection1.ActivePeriod = 0.018; % 18 ms active window % Create connection configuration for Peripheral node 2 cfgConnection2 = bluetoothLEConnectionConfig; cfgConnection2.ConnectionInterval = 0.04; % Same interval as Peripheral 1 cfgConnection2.ConnectionOffset = 0.02; % Starts at t=20 ms (40/2) cfgConnection2.ActivePeriod = 0.018; % 18 ms active window
In this configuration, Peripheral node 1 communicates with the Central node from 0 to
18 ms, then the Central node has a 2 ms buffer period before Peripheral node 2 begins its
communication window from 20 to 38 ms. This configuration leaves adequate spacing for
TMCES at the end of each active period.
References
[1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed January 10, 2026. https://www.bluetooth.com/.
[2] Bluetooth Core Specifications Working Group. "Bluetooth Core Specification" v6.1. https://www.bluetooth.com/specifications/specs/core-specification-6-1/.
Version History
Introduced in R2022aSee Also
Objects
bluetoothLENode|bluetoothLEBIGConfig|bluetoothLEGAPConfig|bluetoothMeshProfileConfig|bluetoothMeshFriendshipConfig|bleChannelSelection|bluetoothLECISConfig
Topics
- Create, Configure, and Simulate Bluetooth LE Network with Custom Channel
- Create, Configure, and Simulate Bluetooth LE Broadcast Audio Network
- Create, Configure and Simulate Bluetooth Mesh Network
- Establish Friendship Between Friend Node and LPN in Bluetooth Mesh Network
- Simulate Multistream Audio in Hearing Aid Scenario
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)