Recover and Analyze Packets in 802.11 Waveform
R2026bThis example blindly detects, decodes, and analyzes multiple IEEE 802.11bn™ (Wi-Fi 8), IEEE 802.11be™ (Wi-Fi 7), IEEE 802.11ax™ (Wi-Fi 6), IEEE 802.11ac™ (Wi-Fi 5), IEEE 802.11n™ (Wi-Fi 4) and IEEE 802.11a™ packets in a waveform. The example provides a summary of the detected packets and displays the MAC contents, error vector magnitude (EVM), power, and signaling information for a selected packet.
Introduction
In this example, you detect, decode, and analyze multiple packets within a waveform. The example supports decoding OFDM non-HT, non-HT duplicate, HT, VHT [ 1 ], and HE MU, HE SU, HE ER SU [ 2 ] packet formats, as well as EHT MU [ 3 ] and UHR MU [ 4 ] packet formats (excluding non-HT duplicate transmissions). The example does not support recovering a UHR MU waveform with coordinated beamforming (Co-BF). The receiver does not know any transmission parameters, except for the channel bandwidth. It retrieves these parameters by decoding the preamble fields of the packet.
The spectrum and time domain samples.
The signaling field contents.
The resource unit and user information for a UHR, EHT or HE waveform.
The constellation of the equalized data symbols.
The EVM of the signaling fields.
The EVM per data subcarrier averaged over spatial streams and symbols.
The EVM per data symbol averaged over spatial streams and subcarriers.
The EVM per user per spatial stream averaged over subcarriers and symbols.
The spectral flatness for all packet formats.
The MAC frame contents: A-MPDU deaggregation status, Address1, Address2, Frame Check Sequence (FCS) and Frame Type.
Setup Waveform Recovery Parameters
This example analyzes I/Q data containing non-HT, HT-MF, VHT, HE, EHT, and UHR packets. The useSDR variable controls the data source for this example:
When you select
useSDR, an SDR captures an off-the-air waveform.When you clear
useSDR,comm.BasebandFileReaderreads a synthetic waveform stored in a binary file format.
useSDR =
false;Reception with an SDR Device
This example uses SDRs supported by Wireless Testbench™, Communications Toolbox™, and SoC Blockset™ support packages. This list provides information on which radios can be used by this example along with the required products.
USRP E320, N3xx, X3xx, or X4xx series radio (requires Wireless Testbench™ and Wireless Testbench Support Package for NI™ USRP Radios). For more information, see Supported Radio Devices (Wireless Testbench).
ADALM-PLUTO (requires Communications Toolbox Support Package for Analog Devices® ADALM-Pluto Radio). For more information, see ADALM-Pluto Radio.
AD936x or FMCOMMS5 radio (requires SoC Blockset™ Support Package for AMD® FPGA and SoC Devices). For more information, see Target Zynq-Based Radios (SoC Blockset).
USRP N2xx or B2xx series radio (requires Communications Toolbox Support Package for USRP™ Radio). For more information, see USRP Radio and Supported Hardware and Required Software.
See the relevant documentation for the chosen product and SDR on set up and installation.
Select SDR Device and Capture Antenna(s)
When you select an SDR as the data source, specify the device name from the dropdown along with the capture antenna configuration.
If using an NI USRP hardware with Wireless Testbench, click Update to see your saved radio setup configuration name appear at the top of the dropdown list.
if useSDR %#ok<*UNRCH> deviceOptions = hSDRBase.getDeviceNameOptions; deviceName =deviceOptions(1);
rx = hSDRReceiver(deviceName); antennaOptions = rx.getAntennaOptions; antennaSelection =
antennaOptions(1); end
Specify Capture Parameters and Initiate Capture
After configuring deviceName and antennaSelection, specify the frequency band, channel number, capture duration, expected channel bandwidth of packets, radio sample rate, and radio gain.
To determine which channels in the 5 GHz band contain traffic from commercial 802.11 hardware, use the WLAN Beacon Receiver Using Software-Defined Radio example for Communications Toolbox Support Package radios or the OFDM Wi-Fi Scanner Using SDR Preamble Detection example for Wireless Testbench radios.
if useSDR frequencyBand =5; % Frequency band channelNumber =
36; % WLAN channel number captureTime =
milliseconds(100); % Signal capture duration, to be specified as a duration type (e.g. seconds(1)) chanBW =
'CBW20'; % Channel bandwidth of all packets within the waveform sr =
20000000; % Radio sample rate gain =
50; % Radio gain % Set the center frequency to the corresponding channel number. The % center frequency should be centered on the channel bandwidth. fc = wlanChannelFrequency(channelNumber,frequencyBand); rx.CenterFrequency = fc; rx.SampleRate = sr; rx.Gain = gain; rx.OutputDataType = 'double'; rx.ChannelMapping = eval(antennaSelection); rxWaveform = capture(rx,captureTime); end
Import a Captured Waveform from a File
If using a precaptured waveform as the data source, this section shows how to load I/Q data from an existing binary file using comm.BasebandFileReader. The baseband file format includes the sample rate and the number of channels in the captured waveform. Alternatively, you can load the waveform from a MAT file.
% Configure the analysis source if ~useSDR BBR = comm.BasebandFileReader('wlanWaveform.bb'); % Create a baseband file reader object chanBW = 'CBW20'; % Channel bandwidth of all packets within the waveform bbrInfo = info(BBR); BBR.SamplesPerFrame = bbrInfo.NumSamplesInData; % Number of samples in the waveform rxWaveform = BBR(); % Load the I&Q sample from a binary file sr = BBR.SampleRate; % Sampling rate of the input signal release(BBR); end
To recover beacon packets from a MAT-file, see the WLAN Beacon Receiver Using Software-Defined Radio example.
Signal Recovery and Analysis
This section detects, analyzes, and displays a summary of the detected packets. All packets in the waveform must have the specified channel bandwidth. Parse and analyze the packets within a waveform by using the WaveformAnalyzer object.
analyzer = WaveformAnalyzer; process(analyzer,rxWaveform,chanBW,sr);
Display a summary of the detected packets.
detectionSummary(analyzer);
Summary of the Detected Packets
detSummary = 17×9 table
Number Format PHY Status Power (dBm) CFO (Hz) Offset (samples) MAC Contents RMS EVM (dB) Max EVM (dB)
______ ________ __________ ___________ ________ ________________ ____________ ____________ ____________
1 "Non-HT" "Success" 12.7 61431 97 "Beacon" -25.824 -17.272
2 "Non-HT" "Success" 13.08 -39757 2577 "RTS" -24.937 -17.737
3 "Non-HT" "Success" 13.01 62250 4017 "CTS" -26.181 -18.982
4 "UHR-MU" "Success" 19.92 61970 5200 "A-MPDU" -26.993 -16.774
5 "Non-HT" "Success" 13.08 -39757 13444 "RTS" -24.937 -17.737
6 "Non-HT" "Success" 13.01 62250 14884 "CTS" -26.181 -18.982
7 "EHT-MU" "Success" 12.38 61932 16066 "A-MPDU" -28.127 -18.167
8 "Non-HT" "Success" 12.84 62015 25066 "RTS" -29.565 -21.111
9 "Non-HT" "Success" 12.82 61806 26506 "CTS" -29.417 -21.095
10 "HE-MU" "Success" 14.98 -39660 27985 "A-MPDU" -25.281 -11.914
11 "Non-HT" "Success" 13.04 -39437 41345 "Block Ack" -25.564 -17.118
12 "Non-HT" "Success" 13.07 -29899 43105 "RTS" -25.082 -16.625
13 "Non-HT" "Success" 13.01 52489 44545 "CTS" -26.118 -18.372
14 "VHT" "Success" 17.43 62290 45825 "A-MPDU" -20.895 -10.482
15 "Non-HT" "Success" 14.99 -38861 51025 "RTS" -27.842 -20.114
16 "Non-HT" "Success" 14.94 42363 52465 "CTS" -27.409 -19.042
⋮
Use the pktNum variable to display the MAC and PHY analysis for a selected packet.
pktNum =4
;
Display the MAC information of the selected packet.
macSummary(analyzer,pktNum);
Recovered MPDU Summary of Packet 4
AMPDU/MPDU Number STAID Address1 Address2 AMPDU/MPDU Decode Status MAC Frame Type
_________________ _____ ______________ ______________ ________________________ ______________
"AMPDU1_MPDU1" 0 "23AFABC2FA1F" "1432ABC2BD1C" "Success" "QoS Data"
"AMPDU1_MPDU2" 0 "23AFABC2FA1F" "1432ABC2BD1C" "Success" "QoS Data"
"AMPDU1_MPDU3" 0 "23AFABC2FA1F" "1432ABC2BD1C" "Success" "QoS Data"
Display the time samples and spectrum of the detected packet.
plotWaveform(analyzer,pktNum)


Display the packet field information of the selected packet.
fieldSummary(analyzer,pktNum);
Field Summary of Packet 4 (UHR-MU)
Field Name Modulation Num Symbols Parity Check/CRC Power (dBm) RMS EVM (dB) Max EVM (dB)
__________ __________ ___________ ________________ ___________ ____________ ____________
L-STF BPSK 2 18.57
L-LTF BPSK 2 19.74
L-SIG BPSK 1 Pass 20.19 -29.84 -21.89
RL-SIG BPSK 1 Pass 20.13 -30.59 -25.96
U-SIG BPSK 2 Pass 20.22 -30.97 -25.06
UHR-SIG BPSK 2 Pass 20.12 -30.55 -23.57
UHR-STF BPSK 1 20.36
UHR-LTF BPSK 2 19.94
Data 21 19.93 -26.99 -16.77
Display the signaling field information of the selected packet.
signalingSummary(analyzer,pktNum);
Signaling Field Summary of Packet 4 (UHR-MU)
Property Value Property Value Property Value
________________ ___________ _______________________ _____ _____________________________ ______
L-SIG Length 291 Interference Mitigation False Pre-FEC Padding Factor 3
L-SIG Rate 0xB UHR-SIG MCS 0 PE Disambiguity False
Bandwidth CBW20 Num UHR-SIG Symbols 2 PPDU Type UHR SU
UL/DL Indication DL Spatial Reuse 0 Punctured Channel Field Value 0
BSS Color 0 Guard Interval 3.2
Co-SR False UHR-LTF Type 4
TXOP Unspecified Num UHR-LTF Symbols 2
Compression Mode 1 LDPC Extra Symbol False
Display the RU information.
ruSummary(analyzer,pktNum);
Resource Unit (RU) Information of Packet 4 (UHR-MU)
RU Number RU/MRU Size Subcarrier Index (Start) Subcarrier Index (End) Num Users Num STS Power (dBm)
_________ ___________ ________________________ ______________________ _________ _______ ___________
"RU1" 242 -122 122 1 2 20.83
Display the user information.
userSummary(analyzer,pktNum);
User Information of Packet 4 (UHR-MU)
STAID RU Number MCS UEQM UEQM Pattern Modulation Num STS Code Rate Channel Coding Beamforming
_____ _________ ___ ____ ____________ ____________ _______ _________ ______________ ___________
0 RU1 7 1 0 64QAM, 16QAM 2 5/6 2xLDPC N/A
Display EVM per spatial streams for all users.
userEVM(analyzer,pktNum);
User EVM per Spatial Stream of Packet 4 (UHR-MU)
STAID Spatial Stream Index RMS EVM (dB) Max EVM (dB)
_____ ____________________ ____________ ____________
0 1 -26.918 -16.829
0 2 -27.069 -16.774
Plot the constellation for all users.
plotConstellation(analyzer,pktNum);

Plot the EVM.
plotEVM(analyzer,pktNum);


Plot the spectral flatness.
plotSpectralFlatness(analyzer,chanBW,pktNum);
Spectral flatness passed

Further Exploration
The WaveformAnalyzer provides properties to control the pilot tracking, equalization, DC blocking, and packet detection algorithms that can be tweaked to improve packet detection and analysis performance. It also provides properties for IQ gain and phase imbalance compensation in UHR-MU and EHT-MU waveforms.
False packet detections
False packet detections are detected packets that you do not believe are actual packets. Evaluating the time domain waveform of the packet is one way to determine if the detected packet is legitimate. If there is a significant number of false detections present these techniques may help reduce them:
Enable the
EnergyDetectionproperty and set theEnergyDetectionThresholdproperty to a suitable value given the noise floor of the capture device. When enabled,EnergyDetectiononly detects packets with a power exceedingEnergyDetectionThresholdduring the preamble.Increase the
LLTFSNRDetectionThresholdandPacketDetectionThresholdproperties to discard packets with a low measured SNR during detection.
Missed packet detections
Missed packet detections are packets that you believe are in the waveform but have not been detected.
One possible reason a packet detection may have been missed is if a false detection occurred earlier in the waveform, but the L-SIG check passed, causing samples to be skipped. To search for possible false detections, enable the
SearchWithinUnsupportedPacketproperty.Alternatively try decreasing the
PacketDetectionThresholdproperty to detect packet with low SNR during detection.
For detail on 802.11be, 802.11ax, 802.11ac signal recovery and processing, see the Recovery Procedure for an 802.11be Packet, Recovery Procedure for an 802.11ax Packet and Recovery Procedure for an 802.11ac Packet examples.
References
IEEE Std 802.11™ - 2020 IEEE Standard for Information technology - Telecommunications and information exchange between systems - Local and metropolitan area networks - Specific requirements - Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications.
IEEE Std 802.11ax™ - 2021 IEEE Standard for Information technology - Telecommunications and information exchange between systems - Local and metropolitan area networks - Specific requirements - Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications - Amendment 1: Enhancements for High Efficiency WLAN.
IEEE Std 802.11be™ - 2024 IEEE Standard for Information technology - Telecommunications and information exchange between systems - Local and metropolitan area networks - Specific requirements - Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications Amendment 2: Enhancements for Extremely High Throughput (EHT).
IEEE P802.11bn™/D1.4 Draft Standard for Information technology - Telecommunications and information exchange between systems Local and metropolitan area networks - Specific requirements - Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications - Amendment 6: Enhancements for Ultra-High Reliability (UHR).










