Main Content

bluetoothTestWaveformValidate

Validate Bluetooth LE RF-PHY test waveform

Since R2024a

    Description

    varargout = bluetoothTestWaveformValidate(waveform,cfgRFPHYTest) validates a Bluetooth® low energy (LE) radio frequency (RF) physical layer (PHY) test waveform, waveform, against the test procedure corresponding to these tests.

    • Blocking performance

    • Carrier to interference ratio (C/I) performance

    • Carrier frequency offset and drift

    • Intermodulation performance

    • In-phase quadrature (IQ) samples coherency

    • IQ samples dynamic range

    • Modulation characteristics

    • Packet error rate (PER) report integrity test

    The function uses the Bluetooth RF-PHY test configuration object cfgRFPHYTest to configure the parameters of the tests.

    crcError = bluetoothTestWaveformValidate(___) validates the waveform against the blocking performance, C/I performance, intermodulation performance, and PER report integrity tests using the combination of input arguments from the previous syntax. The function returns a decision of whether the cyclic redundancy check (CRC) has passed or failed during validation.

    example

    [waveformOut,avgFreqDev,avgCenterFreq,maxFreqDev] = bluetoothTestWaveformValidate(___) validates the waveform against the modulation characteristics test and returns these values:

    • waveformOut — Frequency-demodulated waveform

    • avgFreqDev — Average frequency deviation

    • avgCenterFreq — Average center frequency

    • maxFreqDev — Maximum frequency deviation

    [waveformOut,initFreqOffset,carrierFreqDrift] = bluetoothTestWaveformValidate(___) validates the waveform against the carrier frequency offset and drift test for Bluetooth LE test packets without the constant tone extension (CTE) and returns these values:

    • waveformOut — Frequency-demodulated waveform

    • initFreqOffset — Initial frequency offset

    • carrierFreqDrift — Carrier frequency drift

    [waveformOut,initFreqOffset,avgCenterFreq,carrierFreqDrift] = bluetoothTestWaveformValidate(___) validates the waveform against the carrier frequency offset and drift test for Bluetooth LE test packets with the CTE and additionally returns the average center frequency avgCenterFreq.

    [relativePhase,sumRelativePhase,angleRelativePhase,referencePhaseDev,sumReferencePhaseDev,angleReferencePhaseDev] = bluetoothTestWaveformValidate(___) validates the waveform against the IQ samples coherency test and returns these values:

    • relativePhase — Relative phase

    • sumRelativePhase — Sum of the mean of the relative phase values

    • angleRelativePhase — Mean of the relative phase

    • referencePhaseDev — Reference phase deviation

    • sumReferencePhaseDev — Sum of the mean of the reference phase deviation values

    • angleReferencePhaseDev — Mean of the reference phase deviation

    [meanAmpRefAntennas,meanAmpNonRefAntennas] = bluetoothTestWaveformValidate(___) validates the waveform against the IQ samples dynamic range test and returns these values:

    • meanAmpRefAntennas — Mean of amplitudes for reference antennas

    • meanAmpNonRefAntennas — Mean of amplitudes for nonreference antennas

    Examples

    collapse all

    Generate a Bluetooth LE RF-PHY test waveform with corrupt CRC at random locations, and validate it against the PER report integrity test. Validate the waveform on an average packet error of 10 packets.

    Specify the Bluetooth LE RF-PHY test as "PER report integrity".

    testValue = "PER report integrity";

    Specify the number of samples per symbol, sampling rate, and payload length.

    sps = 20;
    sampleRate = 1e6*sps; % In Hz
    payloadLength = 37;   % In bytes

    Create a Bluetooth RF-PHY test configuration object, specifying the RF-PHY test, samples per symbol, and payload length.

    cfgRFPHYTest = bluetoothRFPHYTestConfig(Test=testValue, ...
        SamplesPerSymbol=sps, ...
        PayloadLength=payloadLength);

    Create a CRC configuration object.

    cfgCRC = crcConfig(Polynomial="x^24 + x^10 + x^9 + x^6 + x^4 + x^3 + x + 1", ...
        InitialConditions=int2bit(hex2dec("555555"),24)', ...
        DirectMethod=true);

    Generate a PRBS9 sequence for the specified payload.

    pnSeq = comm.PNSequence(Polynomial="z^9 + z^5 + 1", ...
    InitialConditions=ones(1,9),SamplesPerFrame=payloadLength*8);
    payload = pnSeq();

    Generate a test packet protocol data unit (PDU) by prepending a PDU header and length bits field to the payload.

    pduHeader = zeros(8,1);
    pduLengthBits = int2bit(payloadLength,8,false);
    testPacketPDU = [pduHeader; pduLengthBits; payload];

    Generate a synchronization word to use as an access address for the test packet PDU.

    syncWord = flip([1 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 0 1 1 0 1 1 1 0 1 ...
        0 0 0 1 1 1 0].');

    Initialize the packet counter and total number of packets.

    packetsInError = 0;
    numPackets = 10;

    For the total number of packets, generate a Bluetooth LE test waveform with a corrupt CRC at random locations, and validate on an average packet error of 10 packets.

    for countPacket = 1:numPackets
        % Specify positions for corrupting CRC
        crcErrPosition = randi([1 24],3,~rem(countPacket,2));
    
        % Generate CRC and append it to test packet PDU
        pduCRC = crcGenerate(testPacketPDU,cfgCRC);
    
        % Flip the specified CRC bits to corrupt CRC PDU
        pduCRC(crcErrPosition) = ~pduCRC(crcErrPosition);
    
        % Generate a Bluetooth test waveform from the corrupted CRC PDU
        testWaveform = bleWaveformGenerator(pduCRC,AccessAddress=syncWord, ...
            SamplesPerSymbol=sps,WhitenStatus="Off");
    
        % Validate test waveform
        crcError = bluetoothTestWaveformValidate(testWaveform,cfgRFPHYTest);
    
        % Increment the lost packet by adding CRC
        packetsInError = packetsInError + crcError;
    end

    Compute the PER and display the PER report integrity test verdict.

    per = packetsInError/numPackets;
    fprintf("Measured PER is %1.4f. For a payload length of %d bytes, this value must be in the range [%1.4f, %1.4f].\n",per,payloadLength,0.5,(0.645))
    Measured PER is 0.5000. For a payload length of 37 bytes, this value must be in the range [0.5000, 0.6450].
    
    if per >= 0.5 && per < 0.645
        fprintf("PER report integrity test passed.\n")
    else
        fprintf("PER report integrity test failed.\n")
    end
    PER report integrity test passed.
    

    Input Arguments

    collapse all

    Bluetooth LE RF-PHY test waveform, specified as a complex-valued time-domain signal of size Ns-by-Np. Ns is the number of received samples, and Np is the waveform column for different payload sequences.

    The value of Ns depends on the PHY transmission mode and samples per symbol (sps), according to the constraints specified in this table.

    PHY Transmission ModeValue of NsMultiplicand

    LE1M

    248×sps

    sps

    LE2M

    256×sps

    sps

    LE500K

    1054×sps

    2×sps

    LE125K

    3088×sps

    8×sps

    The value of Np depends on the RF-PHY test and PHY transmission mode, according to the constraints specified in this table.

    RF-PHY TestPHY Transmission ModeValue of Np

    Blocking

    LE1M and LE2M

    1

    C/I

    LE1M, LE2M, LE500K, and LE125K

    1

    Carrier frequency offset and drift

    LE1M and LE2M

    1

    Intermodulation

    LE1M and LE2M

    1

    IQ samples coherency

    LE1M and LE2M

    1
    IQ samples dynamic range

    LE1M and LE2M

    1

    Modulation characteristics

    LE1M and LE2M

    2

    LE125K

    1
    PER report integrity test

    LE1M, LE2M, LE500K, and LE125K

    1

    Data Types: single | double
    Complex Number Support: Yes

    Bluetooth LE RF-PHY test configuration object, specified as a bluetoothRFPHYTestConfig object.

    Output Arguments

    collapse all

    Measured values of the Bluetooth LE RF-PHY tests, returned as a vector, a scalar, or a logical value.

    Data Types: single | double | logical

    CRC failure indicator, returned as a logical 1 (true) or 0 (false). If this value is 0 (false), then the waveform passes the CRC. If this value is 1 (true), then the waveform fails the CRC.

    Data Types: logical

    Frequency demodulated Bluetooth LE waveform, returned as a column vector.

    Data Types: double

    Measured average frequency deviation of the test sequences, returned as a column vector.

    Data Types: double

    Measured average center frequency of the test sequences, returned as a column vector.

    Data Types: double

    Measured maximum frequency deviation of the test sequences, returned as a scalar.

    Data Types: double

    Measured initial frequency offset of the test sequences, returned as a scalar.

    Data Types: double

    Measured carrier frequency drift of the test sequences, returned as a column vector.

    Data Types: double

    Measured average center frequency of the test sequences, returned as a scalar.

    Data Types: double

    Measured relative phase for each nonreference antenna, returned as a vector.

    Data Types: double

    Sum of the mean of the relative phase values, returned as a vector.

    Data Types: double

    Measured mean of the relative phase values, returned as a vector.

    Data Types: double

    Measured reference phase deviation for each nonreference antenna, returned as a vector.

    Data Types: double

    Sum of the mean for the reference phase deviation values, returned as a vector.

    Data Types: double

    Measured mean for the reference phase deviation values, returned as a vector.

    Data Types: double

    Measured mean of amplitudes for the reference antenna, returned as a scalar.

    Data Types: double

    Measured mean of amplitudes for each nonreference antenna, returned as a scalar.

    Data Types: double

    References

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

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

    [3] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.3. Bluetooth Test Suite, RFPHY.TS.p20 edition 2. Revision date July 28, 2024https://www.bluetooth.com/.

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Version History

    Introduced in R2024a