Main Content

bluetoothLEConnectionConfig

Bluetooth LE LL connection configuration parameters

    Description

    Use bluetoothLEConnectionConfig object to set the link layer (LL) connection configuration parameters at a Bluetooth® low energy (LE) with Central or Peripheral nodes.

    Creation

    Description

    example

    cfgConnection = bluetoothLEConnectionConfig 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(Name=Value) sets properties by using one or more name-value arguments. For example, ConnectionInterval=0.04 sets the connection interval to 0.04 seconds.

    Properties

    expand all

    LL connection interval, specified as a scalar in the range [0.0075, 4]. Specify this value in seconds. This property indicates the interval between the start of two consecutive LL connection events. Set this value as an integer multiple of 1.25 milliseconds. For more information about 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 nodes.

    Data Types: double

    Active communication period in each connection event, specified as a scalar in the range [0, ConnectionInterval]. Specify this value in seconds. Within a connection interval, this property specifies when communication begins between the Central and Peripheral nodes.

    Data Types: double

    Object Functions

    expand all

    configureConnectionConfigure LL connection between Bluetooth LE Central and Peripheral nodes

    Examples

    collapse all

    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 ... ]
                 Algorithm: 1
              HopIncrement: 5
         CRCInitialization: '012345'
        SupervisionTimeout: 1
                   PHYMode: 'LE1M'
             InstantOffset: 6
          ConnectionOffset: 0
              ActivePeriod: 0.0200
    
    

    Specify the connection interval, connection offset, and active period for the LL connection.

    connectionConfig.ConnectionInterval = 0.04; % In seconds
    connectionConfig.ConnectionOffset = 0;      % In seconds
    connectionConfig.ActivePeriod = 0.02;       % In seconds

    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 ... ]
                 Algorithm: 1
              HopIncrement: 5
         CRCInitialization: '012345'
        SupervisionTimeout: 1
                   PHYMode: 'LE1M'
             InstantOffset: 6
          ConnectionOffset: 0
              ActivePeriod: 0.0200
    
    

    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 ... ]
                 Algorithm: 1
              HopIncrement: 5
         CRCInitialization: '012345'
        SupervisionTimeout: 1
                   PHYMode: 'LE1M'
             InstantOffset: 6
          ConnectionOffset: 0.0200
              ActivePeriod: 0.0200
    
    

    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 November 16, 2021. https://www.bluetooth.com/.

    [2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.3. https://www.bluetooth.com/.

    Version History

    Introduced in R2022a