bleIdealReceiver

Ideal receiver for BLE PHY waveform

Download Required: To use bleIdealReceiver, first download Communications Toolbox™ Library for the Bluetooth® Protocol. For more information, see Get and Manage Add-Ons (MATLAB). Alternatively, see Communications Toolbox Library for the Bluetooth Protocol File Exchange.

Description

example

[bits,accessAddr] = bleIdealReceiver(waveform) decodes the Bluetooth low energy (BLE) waveform, generated by bleWaveformGenerator , and returns the received bits, bits, and the access address information, accesAddr.

example

[bits,accessAddr] = bleIdealReceiver(waveform,Name,Value) also specifies options using one or more name-value pair arguments. For example, 'Mode','LE2M' specifies the physical (PHY) layer transmission mode of the desired BLE waveform.

Examples

collapse all

Create an input message column vector of length 1000 containing random binary values. Generate a BLE transmit waveform from the transmission bits by using the bleWaveformGenerator function.

txBits = randi([0 1],1000,1);
txWaveform = bleWaveformGenerator(txBits);

Pass the transmit waveform through a noisy channel and obtain the received waveform.

snr = 30; % specified in dB
rxWaveform = awgn(txWaveform,snr);

Recover data bits from the received BLE waveform using bleIdealReceiver. Check for the number of bit errors in the recovered bits. The returned value indicates that the BLE waveform was successfully decoded.

[rxBits,accessAddr] = bleIdealReceiver(rxWaveform);
numErr = biterr(txBits,rxBits)
numErr = 0

Specify the values of PHY generating mode, channel index and samples per symbol (sps).

phyMode = 'LE125K';
chanIndex = 2;
sps = 4;

Generate transmission bits containing random binary values. Obtain the BLE transmit waveform from the transmission bits and the specified name-value pairs using the bleWaveformGenerator function.

txBits = randi([0 1],100,1);
txWaveform = bleWaveformGenerator(txBits,'Mode',phyMode,...
    'SamplesPerSymbol',sps,'ChannelIndex',chanIndex);

Recover the data bits, and then compare them with the transmission bits. The recovered data bits match the transmission bits, indicating there are no errors in the decoded BLE waveform.

rxBits = bleIdealReceiver(txWaveform,'Mode',phyMode,...
    'SamplesPerSymbol',sps,'ChannelIndex',chanIndex);
isequal(txBits,rxBits)
ans = logical
   1

Input Arguments

collapse all

Received time-domain signal, specified as a complex-valued signal with size Ns-by-1, where Ns represents the number of received samples. The values of Ns depend on the 'Mode' and 'SamplesPerSymbol' (sps) name-value pairs, according to the constraints specified in this table. For example, if the value of 'Mode' is 'LE1M' and the value of 'SamplesPerSymbol' is 4 then the value of Ns must be greater than or equal to 160 and a multiple of 'SamplesPerSymbol'.

Value of 'Mode' Value of NsMultiple of
'LE1M'

40×sps

sps
'LE2M'

48×sps

sps
'LE500K'

376×sps

2×sps
'LE125K'

376×sps

8×sps

Data Types: double | single

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: bleIdealReceiver(waveform,'Mode','LE2M','ChannelIndex',36)

PHY transmission mode, specified as the comma-separated pair consisting of 'Mode' and 'LE1M', 'LE2M', 'LE500K', or 'LE125K'. This value indicates the type of PHY used to decode the received BLE waveform.

Data Types: string | char

Channel index, specified as the comma-separated pair consisting of 'ChannelIndex' and an integer in the range [0, 39]. For data channels, this value must be in the range [0, 36]. For advertising channels, this value must be in the range [37, 39]. This value is used by the data-dewhitening block.

Data Types: single | double

Samples per symbol, specified as the comma-separated pair consisting of 'SamplesPerSymbol' and a positive integer. This value is used for the Gaussian frequency shift keying (GFSK) modulation.

Data Types: single | double

Output Arguments

collapse all

Payload bits, returned as a column vector of maximum length 260 bytes. This output represents the recovered information bits.

Access address information, returned as a 32-bit column vector. This output is used by the higher layers for validating a packet.

References

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

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

Extended Capabilities

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

Introduced in R2019b