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 connection event, specified as a scalar in the range [0, ConnectionInterval]. Specify this value 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.
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 transmitted on a different channel index. 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
Check if the Communications Toolbox™ Wireless Network Simulation Library support package is installed. If the support package is not installed, MATLAB® returns an error with a link to download and install the support package.
wirelessnetworkSupportPackageCheck;
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);
References
[1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed September 16, 2024. https://www.bluetooth.com/.
[2] Bluetooth Core Specifications Working Group. "Bluetooth Core Specification" v6.0. https://www.bluetooth.com/specifications/specs/core-specification-6-0/.
Version History
Introduced in R2022aYou can now specify the maximum number of octets that a PDU can carry by configuring the
new MaxPDU
property.
See Also
Objects
bluetoothLENode
|bluetoothLEBIGConfig
|bluetoothMeshProfileConfig
|bluetoothMeshFriendshipConfig
|bleChannelSelection
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)