Main Content

802.11 OFDM Beacon Frame Generation

此示例显示了如何使用软件定义的无线电(SDR)平台生成适用于基带仿真或空中传输的中型访问控制(MAC)标准框架的数据包。

Introduction

在此示例中,您创建了IEEE®802.11™信标框架,如[1]。您可以通过使用Wi-Fi设备查看使用SDR传输的信标数据包,如本图所示。

信标框架是一种管理框架,它标识了某些802.11设备形成的基本服务集(BSS)。信标框架由MAC标头,信标框架主体和有效的框架检查序列(FCS)组成。信标框架主体包含允许站点与网络关联的信息字段。

您可以将生成的波形存储在基带文件格式中。然后,您可以在802.11 OFDM信标接收器带有捕获的数据示例,显示如何执行信标数据包解码并描述接收器处理。

您也可以将生成的波形传输到空中。使用基于Xilinx®Zynq的无线电SDR硬件来向上转换用于RF传输的信标数据包。无线电硬件可以将波形传输到空中。

在空中传输信标需要基于Xilinx Zynq的无线电支持包,您可以使用它安装金宝app附加资源管理器。有关SDR平台的更多信息,请参阅Hardware Support: Communications Toolbox

Example Setup

信标数据包可以写入基带文件并使用SDR平台传输。使用SDR平台设置传输信标useSDR真实。写入基带文件集saveToFile真实。

useSDR = false; saveToFile = false;

创建IEEE 802.11信标框架

一个站(STA)定期传输标准传输时间(TBTT)在信标间隔字段中指定的信标数据包。信标间隔表示TBTT之间的时间单元(TU)的数量,其中1个TU代表1024微秒。100 TUS的信标间隔导致连续信标之间的102.4毫秒间隔。您可以使用wlanMACFrame具有中等访问控制(MAC)帧配置对象的功能wlanmacframeconfig和MAC框架体配置对象WlanmacManagementConfig

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

ssid =“ test_beacon”;beaconInterval = 100; band = 5; chNum = 52;

创建MAC框架与体配置对象,设置SSID和BEACON INTEVEL FIELD值。

frameBodyConfig = wlanMACManagementConfig(...BeaconInterval=beaconInterval,...SSID = SSID);

Add the DS Parameter information element (IE) to the frame body by using theaddIE对象功能。

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

创建信标框架配置对象。

beaconFrameConfig = wlanMACFrameConfig(FrameType="Beacon",,,,...ManagementConfig=frameBodyConfig);

生成信标框架位。

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

计算指定操作带和通道号的中心频率。

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 thewlannonhtconfigobject.

cfgNonHT = wlanNonHTConfig(PSDULength=mpduLength);

通过使用wlanWaveformGeneratorfunction, specifying an idle time.

osf = 2;tbtt = beaconInterval * 1024 e-6;txWaveform= wlanWaveformGenerator(mpduBits,cfgNonHT,...OversamplingFactor=osf,Idletime=tbtt);

获取波形样本率。

Rs = wlanSampleRate(cfgNonHT,OversamplingFactor=osf);

Save Waveform to File

Save the waveform in a baseband file using thecomm.basebandfilewriterobject.

ifsaveToFilebbw = comm.basebandfilewriter("nonHTBeaconPacket.bb",RS,FC);%#okBBW(txwaveform);释放(BBW);结尾

For information about automatically detecting and synchronizing the waveform stored in the baseband file format, see802.11 OFDM信标接收器带有捕获的数据

Transmission with an SDR Device

In this section, you transmit the beacon packet over the air using an SDR device.

ifuseSDR%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 numbertx.centerfrequency = fc;结尾

为了损害信号或降低波形的传输质量,您可以调整发射器增益tx.Gain。This paramter, expressed in dB, drives the power amplifier in the radio. You can use these suggested values, or select different values apprpriate for your antenna configuration.

  • For increased gain, set thetx.Gain参数为0

  • 对于默认增益,设置tx.Gain参数为-10

  • For reduced gain, set thetx.Gain参数为-20

通过使用该基本波形将基带波形传输到SDR平台传输功能,然后将信号样本存储在硬件内存中。然后,该示例然后重复传输此波形直播,直到调用传输对象的释放方法为止。消息显示在命令窗口中,以确认传输已成功启动。

ifuseSDR%Set transmit gaintx.Gain = 0;%#ok%Transmit over the airTransMitRepeat(TX,TXWAVEFORM);结尾

结论和进一步探索

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 the802.11 OFDM信标接收器带有捕获的数据example.

相关示例

References

  1. 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.