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 126.96.36.199 or higher
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, ... SSID=ssid);
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", ... ManagementConfig=frameBodyConfig);
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, ... IdleTime=beaconInterval*tbtt);
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
ans = ' ASRL::COM3 ASRL::COM4 TCPIP0::A-N5172B-50283.dhcp.mathworks.com::inst0::INSTR TCPIP0::A-N9010A-21026.dhcp.mathworks.com::inst0::INSTR TCPIP0::A-N9030A-71181.dhcp.mathworks.com::inst0::INSTR TCPIP0::csuesg.dhcp.mathworks.com::inst0::INSTR '
Discover all the available instrument drivers, using the
ans = 'Driver: AgRfSigGen_SCPI Supported Models: E4428C, E4438C Driver: RsRfSigGen_SCPI Supported Models: SMW200A, SMBV100A, SMU200A, SMJ100A, AMU200A, SMATE200A Driver: AgRfSigGen Supported Models: E4428C,E4438C,N5181A,N5182A,N5183A,N5171B,N5181B,N5172B N5182B,N5173B,N5183B,N5166B,N5182N,N5183N,E8241A,E8244A E8251A,E8254A,E8247C,E8257C,E8267C,E8257D,E8267D,E8663B '
The Keysight Technologies N517B signal generator is identified as
TCPIP0::A-N5172B-50283.dhcp.mathworks.com::inst0::INSTR and the driver that supports this instrument is
Connect to Signal Generator
To connect to the instrument, specify the object's
Driver properties. In this example, the resource string for the Keysight Technologies N517B signal generator is
TCPIP0::A-N5172B-50283.dhcp.mathworks.com::inst0::INSTR. The resource string is different for your instrument.
rf.Resource = "TCPIP0::A-N5172B-50283.dhcp.mathworks.com::inst0::INSTR"; rf.Driver = "AgRfSigGen"; % Connect to the instrument connect(rf);
txWaveform to the instrument with sampling rate calculated during beacon packet creation.
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; start(rf,centerFrequency,outputPower,loopCount);
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.
When you are done, stop the waveform transmission, disconnect the
rfsiggen object from the signal generator, and clear it from the workspace.
stop(rf); disconnect(rf); clear rf