Main Content

bleCSConfig

Bluetooth LE channel sounding PHY waveform configuration parameters

Since R2024b

    Description

    The bleCSConfig object parameterizes the bleCSWaveform function to generate a Bluetooth® low energy (LE) channel sounding (CS) physical layer (PHY) waveform.

    Creation

    Description

    cfgChannelSounding = bleCSConfig creates a default Bluetooth LE CS PHY waveform configuration object, cfgChannelSounding.

    cfgChannelSounding = bleCSConfig(Name=Value) sets properties of the Bluetooth LE CS PHY waveform configuration object by using one or more optional name-value arguments. For example, bleCSConfig(DeviceRole="Reflector") sets the role of the Bluetooth LE device to "Reflector".

    example

    Properties

    expand all

    Role of the Bluetooth LE device, specified as "Initiator" or "Reflector".

    Data Types: char | string

    Operating step mode for CS waveform generation, specified as one of these values.

    Value of StepMode Description
    0

    Measure frequency offset and timing synchronization between the Initiator and Reflector.

    • If you specify this value at the Initiator, the object does not use the SequenceLength, SequenceType, and ToneDuration properties.

    • If you specify this value at the Reflector, the object does not use the SequenceLength and SequenceType properties. The object internally sets the ToneDuration property to 80.

    1

    Measure round-trip time (RTT) between the Initiator and Reflector. For information about how you can compute the distance between two Bluetooth LE devices using RTT, see the Estimate Distance Between Bluetooth LE Devices by Using Channel Sounding and Round-Trip Timing example.

    • If you specify this value at the Initiator or Reflector, the object does not use the ToneDuration property.

    • If you specify this value and set the SequenceType property to "Sounding Sequence" at the Initiator or Reflector, the valid values of the SequenceLength property are 32 and 96.

    • If you specify this value and set the SequenceType property to "Random Sequence" at the Initiator or Reflector, the valid values of the SequenceLength property are 32, 64, 96, and 128.

    2

    Measure phase rotations of the radio frequency (RF) signal between the Initiator and Reflector.

    • If you specify this value at the Initiator or Reflector, the object does not use the SequenceLength and SequenceType properties.

    • If you specify this value at the Initiator or Reflector, the valid values of the ToneDuration property are 10, 20, and 40.

    3

    Measure phase rotations of the RF signal and RTT between the Initiator and Reflector.

    • If you specify this value and set the SequenceType property to "Sounding Sequence" at the Initiator or Reflector, the valid values of the SequenceLength property are 32 and 96.

    • If you specify this value and set the SequenceType property to "Random Sequence" at the Initiator or Reflector, the valid values of the SequenceLength property are 32, 64, 96, and 128.

    • If you specify this value at the Initiator or Reflector, the valid values of the ToneDuration property are 10, 20, and 40.

    For more information about the step mode, see [2].

    Data Types: double

    Length of the sequence in the optional field, specified as 32, 64, 96, or 128. Units are in bits.

    This table shows how the value of this property depends on the value of the SequenceType property.

    Value of SequenceType Value of SequenceLength
    "Sounding Sequence"

    32 or 96

    "Random Sequence"

    32, 64, 96, or 128

    Dependencies

    To enable this property, set the StepMode property to 1 or 3.

    Data Types: double

    Type of sequence in the optional field, specified as one of these values.

    Value of SequenceType Description
    "Sounding Sequence"

    Sequence of modulated bits alternating between 0 and 1

    "Random Sequence"

    Randomly generated bit sequence of 0 and 1 generated from the CS deterministic random bit generator (DRBG) function

    Dependencies

    To enable this property, set the StepMode property to 1 or 3.

    Data Types: char | string

    Duration of CS tone, specified as 10, 20, 40, or 80. Units are in microseconds.

    Dependencies

    To enable this property, set the StepMode property to 0, 2, 3. If you specify the StepMode property as 2 or 3, the valid values of this property are 10, 20, or 40. If you specify the StepMode property as 0, the object internally sets this property to 80.

    Data Types: double

    PHY transmission mode, specified as "LE1M" or "LE2M".

    Data Types: char | string

    Samples per symbol, specified as an integer greater than or equal to 2.

    Data Types: double

    Examples

    collapse all

    Generate and visualize a Bluetooth LE CS PHY waveform by using this CS procedure.

    Channel Sounding Tutorial Workflow.png

    Using this example, you can:

    1. Generate a CS PHY waveform at the Initiator.

    2. Add propagation delay and additive white Gaussian noise (AWGN) to the generated CS PHY waveform.

    3. Receive the noisy waveform at the Reflector, and generate a response waveform.

    4. Add propagation delay and AWGN to the generated response waveform.

    5. Receive the noisy response waveform at the Initiator.

    6. Visualize the time-domain CS PHY waveforms at the Initiator and Reflector.

    Configure CS PHY and Simulation Parameters

    Specify the noise power spectral density (Eb/No), samples per symbol, and the speed of light.

    EbNo = 30;                                     % In dB
    sps = 8;                                   
    lightSpeedConst = physconst("LightSpeed");     % In m/s

    Specify the PHY transmission mode.

    phyMode = "LE1M";

    Specify the operating mode for CS PHY waveform generation.

    stepMode = 0;

    Specify the type of optional sequence in the CS SYNC packet format.

    sequenceType = "Sounding Sequence";

    Specify the optional sounding sequence length.

    sequenceLength = 32;       % In bits

    Specify the duration of the CS tone.

    toneDuration = 20;         % In microseconds

    Specify the distance between the Initiator and the Reflector devices.

    distance = randi([2 80],1,1);                 % In meters

    Compute the waveform propagation time between the Initiator and Reflector devices.

    propagationTime = distance/lightSpeedConst;   % In seconds

    Calculate the sampling frequency (in Hz) of the generated waveform.

    sampleRate = sps*1e6*(1 + 1*(phyMode=="LE2M")); % In Hz

    Set the signal-to-noise ratio (SNR).

    snr = EbNo - 10*log10(sps);

    Create and configure a Bluetooth LE CS configuration object for the Initiator.

    cfgObjectI = bleCSConfig(Mode=phyMode, ...
        SamplesPerSymbol=sps, ...
        DeviceRole="Initiator", ...
        SequenceLength=sequenceLength, ...
        SequenceType=sequenceType, ...
        StepMode=stepMode, ...
        ToneDuration=toneDuration);

    Create and configure a Bluetooth LE CS configuration object for the Reflector.

    cfgObjectR = bleCSConfig(Mode=phyMode, ...
        SamplesPerSymbol=sps, ...
        DeviceRole="Reflector", ...
        SequenceLength=sequenceLength, ...
        SequenceType=sequenceType, ...
        StepMode=stepMode, ...
        ToneDuration=toneDuration);

    Create a variable fractional delay object by using the dsp.VariableFractionalDelay (DSP System Toolbox) System object™.

    timeDelay = dsp.VariableFractionalDelay;

    Specify the number of samples to delay, based on the distance between the Initiator and Reflector devices.

    samplesToDelay = propagationTime*sampleRate;

    Set the configuration to display the time-domain CS PHY waveform.

    timeDomainScope = timescope(SampleRate=sampleRate, ...
        ChannelNames={'Initiator','Reflector'}, ...
        LayoutDimensions=[2 1]);
    timeDomainScope.YLimits=[-1.25 1.25];
    timeDomainScope.Title = "Initiator View";
    timeDomainScope.ActiveDisplay = 2;
    timeDomainScope.YLimits=[-1.25 1.25];
    timeDomainScope.Title = "Reflector View";

    Set the configuration to display the frequency spectrum of the generated CS PHY waveform.

    frequencyScope = spectrumAnalyzer(SampleRate=sampleRate);

    Simulate and Visualize CS PHY Waveforms

    Generate the Bluetooth LE CS PHY waveform at the Initiator.

    waveformInitI = bleCSWaveform(cfgObjectI);

    Compute the length of the generated Bluetooth LE CS waveform.

    packetLength = length(waveformInitI)
    packetLength = 
    352
    

    Plot the Bluetooth LE CS waveform at the Initiator.

    frequencyScope(waveformInitI)
    release(frequencyScope)

    Add propagation delay to the generated waveform.

    delayWaveformI = timeDelay([waveformInitI; zeros(ceil(samplesToDelay),1)],samplesToDelay);

    Specify the time-domain waveform at the Initiator.

    initiatorView = [waveformInitI; zeros(ceil(samplesToDelay),1)];

    Add AWGN to the delayed waveform.

    noisyWaveformI = awgn(delayWaveformI,snr,"measured");

    Specify the time-domain waveform at the Reflector.

    reflectorView = noisyWaveformI;

    Display the time-domain view of the CS PHY waveform at the Initiator and the Reflector.

    timeDomainScope(initiatorView,reflectorView)
    release(timeDomainScope)

    The Reflector, upon receiving the CS waveform, completes the current task and then begins transmitting a response waveform (which might involve calculating processing delay).

    Specify the idle wait time the Reflector must observe before initiating its response. Set the idle wait time of the Reflector by determining the number of frames it should wait.

    idleFrames = randsrc(1,1,1:4);

    Specify the number of idle samples of the Reflector in integer multiples of the received waveform.

    idleSamples = idleFrames*packetLength;

    Generate and plot the Bluetooth LE CS response waveform at the Reflector.

    waveformInitR = bleCSWaveform(cfgObjectR);
    frequencyScope(waveformInitR)
    release(frequencyScope)

    Specify the time-domain waveform at the Reflector.

    reflectorView = [reflectorView; zeros(idleSamples,1); waveformInitR; zeros(ceil(samplesToDelay),1)];

    Add propagation delay to the generated response waveform.

    delayWaveformR = timeDelay([waveformInitR; zeros(ceil(samplesToDelay),1)],samplesToDelay);

    Add AWGN to the delayed waveform.

    noisyWaveformR = awgn(delayWaveformR,snr,"measured");

    Specify the time-domain waveform at the Initiator.

    initiatorView = [initiatorView; zeros(idleSamples,1); noisyWaveformR];

    Display the time-domain view of the CS PHY waveform at the Initiator and the Reflector.

    timeDomainScope(initiatorView,reflectorView)
    release(timeDomainScope)

    Specify the operating step mode for CS waveform generation.

    stepMode = 0;

    Specify the duration of the CS tone.

    toneDuration = 40;   % In microseconds

    Specify the sequence type and sequence length of the optional field.

    sequenceType = "Random Sequence";
    sequenceLength = 128; % In bits

    Specify the samples per symbol and PHY transmission mode.

    sps = 8;
    phyMode = "LE1M";

    Specify the role of the Bluetooth LE device as "Reflector" or "Initiator".

    deviceRole = "Reflector";

    Calculate the length of the Bluetooth LE CS PHY waveform from the specified configuration.

    multiFactor = 1 + 1*(phyMode=="LE2M");
    lengthPreamble = 8*multiFactor;
    lengthAccessAddress = 32;
    lengthTrailer = 4;
    lengthGaurdDuration = 10*multiFactor;
    lengthTone = toneDuration*2*multiFactor; % One duration each for CS tone and extension slot
    
    switch stepMode
        case 0
            lengthOfWaveform = sps*(lengthPreamble + lengthAccessAddress + lengthTrailer) + sps*(lengthGaurdDuration + 80)*(deviceRole=="Reflector");
    
        case 1
            lengthOfWaveform = sps*(lengthPreamble + lengthAccessAddress + lengthTrailer + sequenceLength*multiFactor);
    
        case 2
            lengthOfWaveform = sps*lengthTone;
    
        case 3
            lengthOfWaveform = sps*(lengthPreamble + lengthAccessAddress + lengthTrailer + sequenceLength*multiFactor + lengthGaurdDuration + lengthTone);
    end

    Create and configure a Bluetooth LE CS configuration object for the Reflector.

    cfgChannelSounding = bleCSConfig(DeviceRole=deviceRole, ...
        Mode=phyMode, ...
        SamplesPerSymbol=sps, ...
        SequenceLength=sequenceLength, ...
        SequenceType=sequenceType, ...
        StepMode=stepMode, ...
        ToneDuration=toneDuration);

    Generate the Bluetooth LE CS PHY waveform at the Reflector.

    csPHYWaveform = bleCSWaveform(cfgChannelSounding);

    Display the size and length of the generated waveform and note that both values are same.

    numel(csPHYWaveform)
    ans = 
    1072
    
    lengthOfWaveform
    lengthOfWaveform = 
    1072
    

    References

    [1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed June 29, 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 R2024b