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™ software, Instrument Control Toolbox™ software, and Keysight Technologies™ RF signal generator.


In this example, you create an IEEE® 802.11™ beacon frame by using WLAN Toolbox software. Then, you download the generated beacon frame to a Keysight Technologies N517B signal generator for over-the-air transmission by using Instrument Control Toolbox software. A beacon frame is a type of management frame that identifies a basic service set (BSS) formed by some 802.11 devices. The access point of a BSS periodically transmits the beacon frame to establish and maintain the network. You can view this beacon frame, transmitted by the RF signal generator, to a wireless network device.

For more information on beacon frame generation using WLAN Toolbox software, 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

A station (STA) periodically transmits beacon packets 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 TBTTs, where 1 TU represents 1024 microseconds. A beacon interval of 100 TUs results in a 102.4 millisecond time interval between successive beacons. You can generate a beacon frame by using the wlanMACFrame (WLAN Toolbox) function with medium access control (MAC) frame configuration object wlanMACFrameConfig (WLAN Toolbox) and MAC frame-body configuration object wlanMACManagementConfig (WLAN Toolbox).

Specify the network service set identifier (SSID), beacon interval, operating band, and channel number.

ssid = "TEST_BEACON";
beaconInterval = 100;
band = 5;
chNum = 52;

Create a MAC frame-body configuration object, setting the SSID and Beacon Interval field value.

frameBodyConfig = wlanMACManagementConfig( ...
    BeaconInterval=beaconInterval, ...

Add the DS Parameter information element (IE) to the frame body by using the addIE (WLAN Toolbox) object function.

dsElementID = 3;
dsInformation = dec2hex(chNum,2);
frameBodyConfig = frameBodyConfig.addIE(dsElementID,dsInformation);

Create beacon frame configuration object.

beaconFrameConfig = wlanMACFrameConfig(FrameType="Beacon", ...

Generate beacon frame bits.

[mpduBits,mpduLength] = wlanMACFrame(beaconFrameConfig,OutputFormat="bits");

Calculate center frequency for the specified operating band and channel number.

fc = wlanChannelFrequency(chNum,band);

Create IEEE 802.11 Beacon Packet

Configure a non-HT beacon packet with the relevant PSDU length, specifying a channel bandwidth of 20 MHz, one transmit antenna, and BPSK modulation with a coding rate of 1/2 (corresponding to MCS index 0) by using the wlanNonHTConfig (WLAN Toolbox) object.

len = numel(mpduBits)/8;
cfgNonHT = wlanNonHTConfig(PSDULength=len);

Generate the beacon packet by using the wlanWaveformGenerator (WLAN Toolbox) function, specifying an idle time in seconds. The idle time is the duration of an idle period after each generated packet.

tbtt = 1024e-6;
txWaveform = wlanWaveformGenerator(mpduBits,cfgNonHT, ...

Get the waveform sampling rate by using the wlanSampleRate (WLAN Toolbox) function.

Rs = wlanSampleRate(cfgNonHT);

Create RF Signal Generator Object

Use the Quick-Control RF Signal Generator from Instrument Control Toolbox 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 the 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:

The Keysight Technologies N517B signal generator is identified as and the driver that supports this instrument is ArRfSigGen.

Connect to Signal Generator

To connect to the instrument, specify the object's Resource and Driver properties. In this example, the resource string for the Keysight Technologies N517B signal generator is The resource string is different for your instrument.

rf.Resource = "";
rf.Driver = "AgRfSigGen";
% Connect to the instrument

Download Waveform

Download txWaveform to the instrument with sampling rate calculated during beacon packet creation.


Transmit Waveform

Call start to start transmitting the waveform using a specified center frequency for the waveform, output power for the RF signal generation, and number of times to repeat the waveform.

centerFrequency = fc;
outputPower = 0;
loopCount = Inf;

Once the signal generator is transmitting the beacon, you can test by scanning for a 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 are done, stop the waveform transmission, disconnect the rfsiggen object from the signal generator, and clear it from the workspace.

clear rf