Main Content

Generate Bluetooth LE Waveform and Add RF Impairments

Using this example, you can:

  1. Generate a Bluetooth® low energy (LE) waveform.

  2. Configure the parameters of radio frequency (RF) impairments.

  3. Impair the generated Bluetooth LE waveform and plot the spectrum of the transmitted and impaired Bluetooth LE waveform.

Specify the data length. Create a message column vector of the specified data length containing random binary values.

dataLength = 2056;                           % In bits
message = randi([0 1],dataLength,1);
symbolRate = 1e6;

Specify the values of the physical layer (PHY) mode, channel index, samples per symbol, and access address.

phyMode = 'LE125K';
chanIdx = 2;
sps = 4;
accAdd = [1 1 1 1 0 1 0 0 1 1 0 1 0 0 1 0 0 1 1 0 1 1 1 0 1 ...
    0 1 0 1 1 0 0].';

Generate the Bluetooth LE waveform.

txWaveform = bleWaveformGenerator(message,'Mode',phyMode,'SamplesPerSymbol',sps,'ChannelIndex',chanIdx,'AccessAddress',accAdd);

Initialize the RF impairments for the specified PHY mode and samples per symbol by using the helperBLEImpairmentsInit function. The helper function returns a structure with phase frequency offset and variable fractional delay fields.

initRFImp = helperBLEImpairmentsInit(phyMode,sps)
initRFImp = struct with fields:
         pfo: [1x1 comm.PhaseFrequencyOffset]
    varDelay: [1x1 dsp.VariableFractionalDelay]

Specify the values of the frequency offset and phase offset.

initRFImp.pfo.FrequencyOffset = 150;         % In Hz
initRFImp.pfo.PhaseOffset = -1;              % In degrees

Specify the values of static timing offset, timing drift, variable timing offset, and DC offset.

staticTimingOff = 0.15*sps;                                                                                         
timingDrift = 10;                                                                      % In ppm
initRFImp.vdelay = (staticTimingOff:timingDrift:staticTimingOff + timingDrift * (length(txWaveform) - 1))';         
initRFImp.dc = 620;                                                                        

Add RF impairments to the generated Bluetooth LE waveform by using the helperBLEImpairmentsAddition function.

txImpairedWaveform = helperBLEImpairmentsAddition(txWaveform,initRFImp);

Create a default spectrum analyzer System object. Then, set the sample rate of the frequency spectrum. Visualize the generated and impaired Bluetooth LE waveform in the spectrum analyzer.

scope = dsp.SpectrumAnalyzer;
scope.SampleRate = sps*symbolRate;
scope.NumInputPorts = 2;
scope.Title = 'Spectrum of Generated and Impaired Bluetooth LE Waveform';
scope.ShowLegend = true;
scope.ChannelNames = {'Generated Bluetooth LE Waveform','Impaired Bluetooth LE Waveform'};
scope(txWaveform,txImpairedWaveform);

Figure Spectrum Analyzer contains an axes object and other objects of type uiflowcontainer, uimenu, uitoolbar. The axes object with title Spectrum of Generated and Impaired Bluetooth LE Waveform contains 2 objects of type line. These objects represent Generated Bluetooth LE Waveform, Impaired Bluetooth LE Waveform.

Visualize the generated and impaired Bluetooth LE waveform in time-domain.

timeScope = timescope('SampleRate',symbolRate*sps,'TimeSpanSource','Auto','ShowLegend',true);
timeScope.Title = 'Generated and Impaired Bluetooth LE Waveform in Time-Domain';
timeScope.ChannelNames = {'Generated Bluetooth LE Waveform','Impaired Bluetooth LE Waveform'};
timeScope(real(txWaveform),real(txImpairedWaveform));

References

[1] Bluetooth® Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed December 27, 2021. https://www.bluetooth.com/.

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

See Also

Functions

Related Topics