802.11 ofdm beacon frame generation -凯发k8网页登录
this example shows how to generate packets containing medium access control (mac) beacon frames suitable for baseband simulation or over-the-air transmission using a software-defined radio (sdr) platform.
introduction
in this example, you create an ieee® 802.11™ beacon frame as described in section 9.3.3.3 of [ 1 ]. you can view the beacon packet transmitted using sdr by using a wi-fi device, as shown in this figure.
a beacon frame is a type of management frame that identifies a basic service set (bss) formed by some 802.11 devices. the beacon frame consists of a mac header, a beacon frame body and a valid frame check sequence (fcs). the beacon frame body contains information fields that allow stations to associate with the network.
you can store the generated waveform in a baseband file format.
you can also transmit the generated waveform over the air. upconvert the beacon packet for rf transmission using xilinx® zynq-based radio sdr hardware. the radio hardware can transmit the waveform over the air.
transmitting the beacon over the air requires the xilinx zynq-based radio support package, which you can install with the . for more information about sdr platforms, see .
example setup
the beacon packet can be written to a baseband file and transmitted using an sdr platform. to transmit the beacon using the sdr platform set usesdr
to true. to write to a baseband file set savetofile
to true.
usesdr = false; savetofile = false;
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 function with medium access control (mac) frame configuration object and mac frame-body configuration object .
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 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 object.
cfgnonht = wlannonhtconfig(psdulength=mpdulength);
generate an oversampled beacon packet by using the function, specifying an idle time.
osf = 2;
tbtt = beaconinterval*1024e-6;
txwaveform = wlanwaveformgenerator(mpdubits,cfgnonht,...
oversamplingfactor=osf,idletime=tbtt);
get the waveform sample rate.
rs = wlansamplerate(cfgnonht,oversamplingfactor=osf);
save waveform to file
save the waveform in a baseband file using the object.
if savetofile bbw = comm.basebandfilewriter("nonhtbeaconpacket.bb",rs,fc); %#okbbw(txwaveform); release(bbw); end
transmission with an sdr device
in this section, you transmit the beacon packet over the air using an sdr device.
if usesdr % the sdr platform must support transmitrepeat. valid platforms are % 'ad936x' and 'fmcomms5'. sdrplatform = 'ad936x'; %#oktx = sdrtx(sdrplatform); tx.basebandsamplerate = rs; % set the center frequency to the corresponding channel number tx.centerfrequency = fc; end
to impair the signal or reduce transmission quality of the waveform, you can adjust the transmitter gain tx.gain
. this parameter, expressed in db, drives the power amplifier in the radio. you can use these suggested values, or select different values appropriate for your antenna configuration.
for increased gain, set the
tx.gain
parameter to0
.for default gain, set the
tx.gain
parameter to-10
.for reduced gain, set the
tx.gain
parameter to-20
.
transfer the baseband waveform to the sdr platform by using the transmitrepeat
function, and then store the signal samples in hardware memory. the example then repeatedly transmits this waveform over-the-air until the release method of the transmit object is called. messages are displayed in the command window to confirm that transmission has started successfully.
if usesdr % set transmit gain tx.gain = 0; %#ok% transmit over the air transmitrepeat(tx,txwaveform); end
conclusion and further exploration
this example shows how to generate a beacon packet for the ieee 802.11 standard and view the beacon packet transmitted using sdr hardware by using a wi-fi device. you can use the stored baseband beacon packet to recover the transmitted information using the ofdm beacon receiver using software-defined radio example.
related examples
references
ieee std 802.11™-2020 ieee(revision of ieee std 802.11-2016). “part 11: wireless lan medium access control (mac) and physical layer (phy) specifications.” ieee standard for information technology — telecommunications and information exchange between systems. local and metropolitan area networks — specific requirements.