Main Content

802.11 OFDM Beacon Frame Generation and Transmission with Test and Measurement Equipment

This example shows how to generate packets containing MAC beacon frames suitable for baseband simulation or over-the-air transmission using WLAN Toolbox™, Instrument Control Toolbox™ and Keysight Technologies® RF signal generator.


In this example WLAN Toolbox is used to create an IEEE® 802.11™ beacon frame. Using Instrument Control Toolbox, the generated beacon frame is downloaded to Keysight Technologies N517B signal generator for over-the-air transmission. Beacon frame is a type of management frame that identifies a basic service set (BSS) formed by a number of 802.11 devices. The access point of a BSS periodically transmits the beacon frame to establish and maintain the network. A WiFi device can be used to view this beacon frame transmitted by the RF Signal Generator.

For more information on beacon frame generation using WLAN Toolbox, refer to 802.11 OFDM Beacon Frame Generation (WLAN Toolbox).


To run this example you need:

  • Keysight Technologies N5172B signal generator

  • Keysight VISA version 17.3

  • IVI-C driver for Keysight Technologies N5172B signal generator

  • National Instruments™ IVI® compliance package version or higher

  • WLAN Toolbox

  • Instrument Control Toolbox

Create IEEE 802.11 Beacon Frame

The beacon packets are periodically transmitted as specified by the Target Beacon Transmission Time (TBTT) in the beacon interval field. The beacon interval represents the number of Time Units (TUs) between TBTT, where 1 TU represents 1024 microseconds. A beacon interval of 100 TU results in a 102.4 milliseconds time interval between successive beacons. A beacon frame is generated using the wlanMACFrame (WLAN Toolbox) function. This function consumes the MAC frame configuration object wlanMACFrameConfig (WLAN Toolbox). This object accepts wlanMACManagementConfig (WLAN Toolbox) as a property to configure the beacon frame-body.

beaconInterval = 100; % In Time units (TU)
band = 5;             % Band, 5 or 2.4 GHz
chNum = 52;           % Channel number, corresponds to 5260MHz
bitsPerByte = 8;      % Number of bits in 1 byte

% Create Beacon frame-body configuration object
frameBodyConfig = wlanMACManagementConfig;
frameBodyConfig.BeaconInterval = beaconInterval;  % Beacon Interval in Time units (TUs)
frameBodyConfig.SSID = SSID;                      % SSID (Name of the network)
dsElementID = 3;                                  % DS Parameter IE element ID
dsInformation = dec2hex(chNum, 2);                % DS Parameter IE information
frameBodyConfig = frameBodyConfig.addIE(dsElementID, dsInformation);  % Add DS Parameter IE to the configuration

% Create Beacon frame configuration object
beaconFrameConfig = wlanMACFrameConfig('FrameType', 'Beacon');
beaconFrameConfig.ManagementConfig = frameBodyConfig;

% Generate Beacon frame bits
[mpduBits, mpduLength] = wlanMACFrame(beaconFrameConfig, 'OutputFormat', 'bits');

% Calculate center frequency for the given band and channel number
fc = helperWLANChannelFrequency(chNum, band);

Create IEEE 802.11 Beacon Packet

A beacon packet is synthesized using wlanWaveformGenerator (WLAN Toolbox) with a non-HT format configuration object. In this example an object is configured to generate a beacon packet of 20 MHz bandwidth, 1 transmit antenna and BPSK rate 1/2 (MCS 0).

cfgNonHT = wlanNonHTConfig;              % Create a wlanNonHTConfig object
cfgNonHT.PSDULength = numel(mpduBits)/8; % Set the PSDU length in bits

% The idle time is the length in seconds of an idle period after each
% generated packet. The idle time is set to the beacon interval.
txWaveform = wlanWaveformGenerator(mpduBits, cfgNonHT, 'IdleTime', beaconInterval*1024e-6);
Rs = wlanSampleRate(cfgNonHT);           % Get the input sampling rate

Create a RF Signal Generator Object

Quick-Control RF Signal Generator is used to download and transmit the baseband waveform, txWaveform, generated by WLAN Toolbox.

rf = rfsiggen();

Discover all the available instrument resources you can connect to, using the resources method.

ans =

    ' ASRL::COM3

Discover all the available instrument drivers, using drivers method.

ans =

    'Driver: AgRfSigGen_SCPI
     Supported Models:
     E4428C, E4438C
     Driver: RsRfSigGen_SCPI
     Supported Models:
     SMW200A, SMBV100A, SMU200A, SMJ100A, AMU200A, SMATE200A
     Driver: AgRfSigGen
     Supported Models:
     Driver: nisRFSigGen
     Supported Models:

Connect to Signal Generator

Set Resource and Driver properties before connecting to the object. The IP address of Keysight Technologies N5172B signal generator is , hence the resource specified will be 'TCPIP0::'

rf.Resource = 'TCPIP0::';
rf.Driver = 'AgRfSigGen';
% Connect to the instrument

Download Waveform

Download the waveform, txWaveform, to the instrument with sampling rate Rs.

download(rf, transpose(txWaveform), Rs);

Transmit the Waveform

Call start to start transmitting waveform using specified centerFrequency, outputPower and loopCount.

centerFrequency = fc;
outputPower = 0;
loopCount = Inf;
start(rf, centerFrequency, outputPower, loopCount);

Once the signal generator is transmitting the beacon, you can test by scanning for wireless network using a Wi-Fi device. You should now see a TEST_BEACON SSID in the list of available networks.

Clean Up

When you have finished transmitting, stop the waveform output, disconnect the rfsiggen object from the signal generator, and remove it from the workspace.

clear rf


This example uses the following helper functions: