This example shows how to perform Bluetooth® low energy (BLE) radio frequency (RF) physical layer (PHY) transmitter tests specific to modulation characteristics, carrier frequency offset, and drift using Communications Toolbox™ Library for the Bluetooth Protocol. The test measurements compute frequency deviation, carrier frequency offset, and drift values. This example also verifies whether these test measurement values are within the limits specified by the Bluetooth RF-PHY Test Specifications [ 1 ].
The Bluetooth RF-PHY Test Specifications [ 1 ] defined by Bluetooth Special Interest Group (SIG) includes RF-PHY tests for both transmitter and receiver. The objectives of these RF-PHY tests are to:
Ensure interoperability between all Bluetooth devices.
Ensure a basic level of system performance for all Bluetooth products.
Each test case has a specified test procedure and an expected outcome, which must be met by the implementation under test (IUT).
The main aim of transmitter test measurements is to ensure that the transmitter characteristics are within the specified limits as specified in the test specifications [ 1 ]. This example includes transmitter tests relevant to modulation characteristics, carrier frequency offset, and drift. This table shows various RF-PHY transmitter tests performed in this example.
This block diagram summarizes the test procedure for transmitter tests relevant to modulation characteristics, carrier frequency offset, and drift.
Generate test packets and pass them through
bleWaveformGenerator to generate BLE test waveforms. The test waveforms required for different test IDs are:
Check if the 'Communications Toolbox Library for the Bluetooth Protocol' support package is installed.
Initialize variables such as transmitter test ID, number of samples per symbol, payload length, and maximum carrier frequency drift. The function,helperBLEModulationTestConfig.m, can be configured to generate test parameters.
txTestID = "RF-PHY/TRM/BV-09-C"; payloadLen = 240; % Payload length in bytes, must be in the range [37,255] sps = 32; % Number of samples per symbol, minimum of 32 samples per % symbol as per the test specifications % Frequency offset and drift for the tests: RF-PHY/TRM/BV-06-C, % RF-PHY/TRM/BV-12-C, RF-PHY/TRM/BV-14-C. maxFreqDrift = 0; % In Hz, must be in the range [-50e3,50e3] initFreqOffset = 23000; % In Hz, must be in the range [-100e3,100e3] testParams = helperBLEModulationTestConfig(txTestID,sps); % Generate test parameters
To simulate the transmitter tests, perform these steps:
Generate BLE test packet waveform using helperBLETestWaveform.
Add frequency offset, which includes initial frequency offset, and drift to the waveform using
Add thermal noise using
Perform filtering on the noisy waveform using helperModulationTestFilterDesign.
Perform FM demodulation on the filtered waveform.
Perform test measurement and display the pass verdict.
testWfmLen = (testParams.nonPDULen+testParams.codingFactor*payloadLen*testParams.bitsPerByte)*sps; driftRate = maxFreqDrift/length(testWfmLen);% Drift rate freqDrift = driftRate*(0:1:(length(testWfmLen)-1))';% Frequency drift freqOffset = freqDrift+initFreqOffset;% Frequency offset and frequency drift % Create a phase frequency offset System object pfo = comm.PhaseFrequencyOffset('FrequencyOffset',freqOffset,'SampleRate',testParams.sampleRate); % Create a thermal noise System object NF = 12; % Noise figure (dB) thNoise = comm.ThermalNoise('NoiseMethod','Noise figure',... 'SampleRate',testParams.sampleRate,... 'NoiseFigure',NF); filtDesign = helperModulationTestFilterDesign(testParams.phyMode,sps); filtTestWfm = zeros(testWfmLen,testParams.numOfTestSeqs); for wfmIdx = 1:testParams.numOfTestSeqs % Generate BLE test waveforms testWfm = helperBLETestWaveform(testParams.testSeqIds(wfmIdx),... payloadLen,sps,testParams.phyMode); wfmFreqOffset = pfo(testWfm); wfmChannel = thNoise(wfmFreqOffset); filtTestWfm(:,wfmIdx) = conv(wfmChannel,filtDesign.Coefficients.','same'); % Perform filtering end
The function, helperBLEModulationTestMeasurements.m, performs FM demodulation and computes either frequency deviation, or frequency drift and initial frequency offset based on the provided test case ID.
[waveformDiffFreq,fOut1,fOut2,fOut3] = helperBLEModulationTestMeasurements(filtTestWfm,txTestID,testParams);
The function, helperBLEModulationTestVerdict.m, verifies whether the measurements are within the specified limits, and displays the verdict on the command window.
Test sequence: 00001111 Measured average frequency deviation = 250 kHz Expected average frequency deviation = 247.5 kHz to 252.5 kHz Result: Pass Test sequence: 10101010 Expected 99.9% of all maximum frequency deviation > 185000 kHz Result: Pass Ratio of frequency deviations between two test sequences = 1.163 Expected Ratio > 0.8 Result: Pass
This example demonstrated the BLE transmitter test measurements specific to modulation characteristics, carrier frequency offset and, drift. The simulation results verify that these computed test measurement values are within the limits specified by Bluetooth RF-PHY Test Specifications [ 1 ].
The helpers used in this example are:
helperBLETestWaveform.m: Generates BLE test packet waveform
helperBLEModulationTestConfig.m: Configures BLE transmitter test parameters
helperBLEModulationTestMeasurements.m: Measures frequency deviation, carrier frequency offset and drift
helperBLEModulationTestVerdict.m: Validates test measurement values and displays the result
helperModulationCharacteristicsTest.m: Performs modulation characteristics test
helperModulationTestFilterDesign.m: Designs channel filter