bladeRF-wiphy is an open-offer IEEE 802.11 like minded machine outlined radio VHDL modem
If you just like the bladeRF-wiphy mission, please judge starring it on Github!
bladeRF-wiphy
What is the bladeRF-wiphy mission?
The bladeRF-wiphy mission is an open-offer IEEE 802.11 like minded machine outlined radio VHDL modem. The modem is ready to modulate and demodulate 802.11 packets (the protocol WiFi is in accordance with), and creep straight on the bladeRF 2.0 micro xA9’s FPGA.
The bladeRF-wiphy coupled with Linux mac80211 lets in the bladeRF 2.0 micro xA9 to change into a machine outlined radio 802.11 win precise of entry to point! 802.11 packets (PDUs) are modulated and demodulated straight on the FPGA, so easiest 802.11 packets are transferred between the FPGA and libbladeRF.
NOTE: While a JTAG adapter (USB-Blaster) can relieve with understanding the modem at creep-time, a JTAG adapter is no longer needed to creep the RBFs linked below.
For instructions on compiling, installing, and running bladeRF-wiphy, device shut a explore on the bladeRF-wiphy instructions . To simulate bladeRF-wiphy device shut a explore on the bladeRF-wiphy simulation data.
Why write and creep a modem on the FPGA of a machine outlined radio?
While enforcing a modem in HDL is a lot more durable than a modem written fully in C or Python, HDL and FPGAs allow for one in every of primarily the most needed aspects of modem sort: low latency and timing modify.
In IEEE 802.11, namely there could be a requirement that a receiving modem (be it a consumer STA, or win precise of entry to point AP) must acknowledge the a success reception of an incoming packet addressed to it by beginning to transmit an an ACK packet internal 10 microseconds of the end of the incoming packet. It is miles impractical, or every so often outright most no longer going to meet such slender timing requirements with C and Python soft-modems thanks to the pretty high latency of data buses at bandwidths wished to stream raw IQ samples. Even high-speed buses comparable to PCIe and USB add too indispensable latency if IQ samples can have to be sent over a bus, processed by a CPU, and a response sent support over the same bus. This distress is no longer up to supreme when in contrast to an HDL modem, where a developer has fleshy deterministic and “clock-cycle precision” modify over the latency and timing of alerts in the modem. HDL modems additionally device shut pleasure in huge parallelization that may even simply also be completed in FPGAs. The stage of modify and efficiency on this case makes HDL modems uniquely able to going thru the project of generating an ACK response internal 10 microseconds.
It is miles value noting that lean HDL modems are at risk of exhaust mounted point arithmetic in their DSP pipelines, which is in stark distinction to soft-modems written in C, Python, and so on which mostly use floating point arithmetic to device shut pleasure in accelerators comparable to AVX (in CPUs) and GPGPUs. One instance of such an accelerator toolbox is GNURadio Volk ( https://github.com/gnuradio/volk ). The critical driver unhurried the mounted point arithmetic in HDL modems is the comparatively huge good judgment handy resource utilization of floating point arithmetic in FPGAs.
HDL modems may even simply find yourself running on FPGAs or converted into ASICs, but early in the strategy direction of, HDL modems may additionally be prototyped as soft-modems. MATLAB, GNURadio, and Python are standard decisions for the first stage of create because of the the phenomenal flexibility of machine sort. As soon as the theoretical efficiency for modem is validated, the DSP algorithms developed in the outdated step may additionally be carried out again as floating point implementation. Afterwards, the floating point implementation can then be carried out again as mounted point arithmetic in a compiled language comparable to C. While this step is non-compulsory, having a mounted point implementation is precious because it might additionally be compiled and validated like a flash to be determined it behaves in addition to the particular theoretical modem designed in the outdated step. The developer can then with out anxiety debug the adaptation between a “identified correct” mounted point implementation (the one written in C) and the HDL modem; right here’s identified as having “bit stage lawful” implementations. Ideally, in the strategy direction of this lets in for like a flash iterations of the mounted point C implementation of the modem by allowing BER and PER curves to be like a flash generated in accordance with hundreds of hundreds of simulated packets; checks can construct in neutral minutes. Simulating an HDL modem in its entirety to generate BER and PER curves will most likely be several orders of magnitude slower.
How does WiFi work?
What we name WiFi is a truly huge stack of technologies that stretches from high layer protocols that use TCP and UDP (layer 4) like HTTP (Layer 7), down to a Medium Safe admission to Withhold watch over (MAC) that coordinates win precise of entry to and authentication (roughly Layer 2), down to a modem (the Physical Layer, PHY), that translates between digital bits and analog RF alerts (Layer 1); a modem that in no runt half has to take care of and mitigated effects dictated by Maxwell’s and Schrodinger’s equations.
To simply the dialogue, the final WiFi stack may additionally be destroy up up into two equally crucial ingredients, the PHY and the MAC. The PHY is in point of fact guilty for translating between digital packets (PDUs) and baseband IQ samples. Packets going in and out of the PHY are then processed by the MAC to set link dispute, and elevated stage protocol capabilities (e.g. beaconing, authentication, affiliation, and data passing).
The PHY, as outlined by the IEEE 802.11 specification, will most likely be an OFDM waveform consisting of subcarriers modulated both as BPSK, QPSK, 16-QAM, 64-QAM, or most lately 256-QAM. The PHY is guilty for modulation PDUs (packet knowledge units, in point of fact an 802.11 body) to raw baseband IQ samples, and demodulation raw baseband IQ samples to PDUs). The PHY’s transmit direction of is reasonably easy, the PHY does no longer notify itself with the contents of the packet it’s asked to transmit by the MAC. So with shrimp to no modifications the PHY begins modulating the digital payload, the PDU, into raw IQ samples and awaits for an different to transmit. On the derive facet, the PHY is repeatedly analyzing alerts and awaits the starting of an 802.11 packet, in a direction of known as acquisition. The 802.11 preamble, which is fresh on the very starting of any IEEE 802.11 RF body consists of 10 fast coaching sequences and a pair of long coaching sequences. The receiving PHY uses the coaching sequences to label (estimate in DSP terminology) what happened to the signal because it turn into transmitted over the air. Multipath, fading, Doppler shifts (and as a consequence Doppler spreads) can vastly distort alerts, on the opposite hand having a identified preamble lets in a receiver to both positively title a packet as belonging to its protocol, and label what it must construct to undo the results of the channel on the signal. For receiving 802.11 frames, the bladeRF-wiphy estimates acquisition, symbol timing, channel offset correction, and channel impulse response parameters. Most of the advanced DSP and statistical theory applied in a modem (constituted of both RX and TX) is in the receiver. Here’s additionally why it’s correct put collectively to open the create direction of with a transmitter.
As soon as two 802.11 modems are in a space to alternate packets successfully, issues like a flash open such as wired communications like Ethernet (IEEE 802.3). There may be on the opposite hand a key contrast with wi-fi verbal exchange, the entire lot shares lawful one finite medium — the RF spectrum, which is at present accessible by anything else internal range. The 802.11 specification requires devices to be conscious of this, and the resolution is relegated to the MAC. In actual fact, the MAC in an 802.11 tool maintains the dispute of the link by exchanging management frames. An win precise of entry to-point advertises its existence (and involves data for sound asleep purchasers) in interval beacon frames, a decision of management body. Conversely, a plot (STA) that desires to join to an AP, must war thru the affiliation direction of: optionally exchanging probe requests and responses with the AP, exchanging authentication management frames, and by some means affiliation management frames. Assuming an open SSID, so long as the STA each so assuredly transmits knowledge to the AP or efficiently receives packets by sending ACKs support to the AP, the link will stay established except both the AP or the STA alternate deauthentication (“deauth”) or disassociation management frames. While the link is established the AP and STA alternate 802.11 frames, which successfully is on the same layer as Ethernet.
As a fast facet display hide, Linux has an fully open-offer 802.11 MAC implementation identified as mac80211 ( https://wi-fi.wiki.kernel.org/en/builders/documentation/mac80211 ). BSD systems additionally have their very own implementation identified as secure80211 ( https://wiki.freebsd.org/WiFi ). On Linux, mac80211 is ready to behave both as an AP and an STA. The mac80211 subsystem may additionally be queried thru the cfg80211 subsystem with familiar instruments like iwconfig and the iw instruments (iw, iwconfig, iwlist, and so on).
How does the bladeRF-wiphy modem work?
The bladeRF-wiphy modem is organized into two main modules wlan_tx and wlan_rx (respectively the modulator and the demodulator), which are unified below wlan_top. The wlan_top module additionally implements queuing and deqeueing of packets, Disbursed Coordination Characteristic (DCF) and Acknowledgement (ACK) mechanisms.
The names of the subsections below mostly correspond to modules found in the fpga/vhdl
directory in bladeRF-wiphy.
wlan_top:
The wlan_top module instantiates the three core formulation of the bladeRF-wiphy IEEE 802.11 like minded modem, at the side of the RX, TX, and DCF modules. The DCF module repeatedly determines if it’s feasible for the contemporary modem to transmit if it desired to. Looking on the selection of packet a transmitter intends to transmit, this can must back an interval of time dictated by both Instant Interframe Place (SIFS) or DCF Interframe Place (DIFS). An IEEE 802.11 modem must reply with an Acknowledgement (ACK) body for each received body that is addressed to it. The laborious limit outlined as SIFS, requires that the transmission of the ACK body open with 10 microseconds of the end of the received body. Sometime of the SIFS time, different IEEE 802.11 modems that received the fashioned body know to provide the intended recipient time to generate an ACK packet. If on the opposite hand, the contemporary modem desires to transmit because it has an data body or management body, it must wait an interval of time outlined as DIFS earlier than it might transmit. In the beginning, DIFS is between 20 and 50 microseconds but if the medium is inaccessible, the wait can develop exponentially to many milliseconds because of the the exponential backoff algorithm. wlan_top’s RX dispute machine waits for decoded packets from wlan_rx and translates them into the phenomenal packet_control_t interface for exchanging digital payloads thru libbladeRF. In case the wlan_rx core determines it desires to ship an ACK body, it asserts ack_mac
and ack_valid
with the fashioned transmitter’s MAC take care of that must derive an ACK packet. wlan_top’s TX dispute machine waits for the DCF to uncover it when it might transmit. If there are any ACK packets, the TX dispute machine waits a SIFS interval of time sooner than transmitting. If on the opposite hand, any different roughly knowledge or management body is supposed to be transmitted, the TX dispute machine will anticipate an interval of time space by DIFS.
In case the modem does have something to transmit but the medium (the RF channel) is for the time being busy, the DCF implements an exponential backoff algorithm that successively waits up to twice as indispensable as the outdated ready interval to transmit. The speculation unhurried exponential backoff is to steer certain of a thundering herd of contention between more than one transmitters, when many blocked transmitters concurrently stare they can transmit because of the the medium being usable again.
This direction of is identified as Provider Sense A pair of Safe admission to / Collision Avoidance (CSMA/CA).
wlan_tx:
wlan_tx_controller:
The wlan_tx_controller module is the critical of two main dispute machines in the transmit chain. Its main reason is to generate the preamble and anticipate its completion, sooner than starting the wlan_framer module. A phenomenal 802.11 body’s preamble consists of 10 Instant Training Sequences (STS) followed by a 0.8 microseconds Cyclic Prefix (CP) for 2 3.6 microsecond long Long Training Sequences (LTS). wlan_tx_controller asserts short_start
to open the STSs, and awaits for long_done
earlier than asserting encoder_start
to open the wlan_framer module. After wlan_framer is began, wlan_tx_controller waits for indication the packet has completed being modulated.
wlan_framer:
The wlan_framer module is primarily guilty for receiving PDU bytes and sending them to the modulator. wlan_framer receives modify of the transmit chain actual after preamble is completed being generated. The critical symbol generated by wlan_framer is the SIGNAL symbol. The emblem is in accordance with tx_vector
, a metadata HDL signal that informs the modulator how long a PDU is and its intended transmission MCS. The SIGNAL symbol decodes to a pair of bytes, these 3 bytes comprise fields that resolve the scale of the packet, and the modulation and coding plan of the following OFDM symbols. It will aloof be well-known, the SIGNAL symbol is repeatedly modulated at 6Mbps rate.
To position into perspective the end goal wlan_tx_controller and wlan_framer strive and construct in outputting, below is an illustration of a in sort IEEE 802.11 burst. A in sort burst involves the preamble (which is archaic by the receiver to estimate symbol timing, heart frequency offset, and the channel impulse response), and data symbols (the first of which is the SIGNAL symbol, followed straight by symbols that encode the payload knowledge). The waveforms in green which appear below the block diagrams are instance IQ samples generated by wlan_tx.
Striking all of it collectively into one device:
The wlan_framer dispute machine prepares sufficient bytes to generate one OFDM symbol at a time. After dispatching sufficient bytes, it waits for mod_done
to be asserted so it might put collectively the following symbol. wlan_framer appends a 32bit CRC on the end of the PDU the utilization of CRC polynomial:
CRC:
CRC Polynomial = x^{32}+x^{26}+x^{23}+x^{22}+x^{16}+x^{12}+x^{11}+x^{10}+x^8+x^7+x^5+x^4+x^2+x^1+x^0
wlan_scrambler:
Every PDU byte is scrambled by an XOR operation with the respective LFSR value. The wlan_scrambler module uses the wlan_lfsr module to generate the corresponding LFSR value for each PDU byte. The SIGNAL symbol is no longer scrambled. Every OFDM symbol requires a mounted choice of bytes to be modulated, if the PDU is no longer long sufficient to maintain the closing symbol, wlan_scrambler creates trailing zeros to pad the closing symbol except the modulator module has sufficient bytes to modulate it.
wlan_encoder:
The wlan_encoder module generates convolution encoder coded bits from the scrambled bytes that it receives from wlan_scrambler. wlan_encoder works on a per symbol basis choice of bytes, equivalent to wlan_scrambler. A 2 code convolutional encoder will manufacture 2 coded bits for each uncoded bit it receives, giving it a “half rate”, r=1/2. IEEE 802.11 requires a pair of more charges at the side of r=2/3 and r=3/4, these charges are completed by deterministically erasing coded bits, as an illustration in the case of the r=3/4 rate, for each 3 uncoded bits supplied to the encoder, 2 bits are punctured (or erased) and 4 are transmitted. So long as the transmitter and receiver are both privy to where the erasures happened, the receiver’s Viterbi decoder can learn to ignore those missing coded bits. Eliminating coded bits, will increase throughput (because successfully, redundancy is diminished) on the value of reduced error correction. Here’s one reason quicker MCSs have elevated encoding charges, the specification assumes there may be already sufficient SNR to transmit a high uncover modulation like 64-QAM, so a lower error conserving rate is believed to suffice.
wlan_interleaver:
To steer certain of grouped clusters of bit errors, interleaving is archaic to separate adjacent bits. In case some roughly channel obstacle destroys half of an OFDM symbol, with interleaving, the coded bits are very at risk of no longer be adjacent. This distribution of bit errors then lets in the Viterbi decoder to potentially correct some bit errors over a half of the trellis dimension. Bits are interleaved in conserving with a sample established in IEEE 802.11.
wlan_modulator:
The wlan_modulator module begins the direction of of adjusting digital bits into IQ samples by a direction of known as modulation. wlan_modulator turns coded bits from wlan_interleaver into constellation points in accordance with the corresponding modulation plan for the packet. The IEEE 802.11 specification requires several modulations for OFDM charges, at the side of BPSK, QPSK, 16-QAM, and 64-QAM. The coded bits sent to wlan_modulator are archaic as indexes in the constellation scheme for each respective modulation.
The selection turn into made for IEEE 802.11 OFDM to have 48 knowledge carrying subcarriers, and all subcarriers have the same modulation plan. In the case of the 6Mbps rate, the subcarriers are BPSK modulated, which technique that each subcarrier easiest modulates 1 coded bit as BPSK. On this case wlan_modulator dequeues 1 bit per subcarrier, and uses that 1 coded bit as an index into the search for desk equivalent to the BPSK modulation, as an illustration (-1 for 0-bit and +1 for 1-bit).
Equally, as one other instance, the 54 Mbps rate uses 64-QAM as its modulation, which technique 6 coded bits are needed per subcarrier to index the constellation mapping for 64-QAM. With 48 knowledge subcarriers, wlan_modulator wants 6 coded bits for each of the 48 knowledge subcarriers for a total of 288 coded bits per OFDM symbol.
wlan_ifft64:
As soon as the wlan_modulator modulates coded bits into constellation points, the advanced (having accurate and imaginary formulation) constellation points in IEEE 802.11 OFDM are turn into advanced IQ samples by a uncomplicated inverse FFT. The inverse FFT is carried out on the fleshy 64 subcarriers (quickly to be assuredly known as FFT containers), which comprises 4 pilot tones, 48 knowledge subcarriers, 1 DC bin, and 9 zero containers that relieve slender IEEE 802.11 spectral facet-lobes.
wlan_sample_buffer:
wlan_ifft64 generates the raw baseband IQ samples that win sent to an DAC for conversion to analog. IEEE 802.11 symbols are 4 microseconds long (assuming long guard intervals), but 64 IQ samples sampled out at 20MSPS is easiest 3.2 microseconds. The final 0.8 microseconds are archaic as a disaster in between symbols to diminish Inter-Image Interference (ISI). The 0.8 microsecond gap which corresponds precisely to 16 IQ samples at 20MSPS is found on the starting of every OFDM symbol interval. The gap is on the opposite hand no longer left clean, in its set aside the closing 16 samples output by the inverse FFT are copied to the starting of the OFDM symbol into the gap. The samples in the gap are known as the Cyclic Prefix (CP). The half is accurate between the end of the CP and the starting of the 64 samples generated by the inverse FFT by virtue of the Fourier Transform being cyclic each 2*pi, on this case 2*pi is 64 samples.
The wlan_sample_buffer module is additionally archaic to construct a 32 sample (1.6 microsecond long Cyclic Prefix) for 2 support-to-support Long Training Sequence repetitions.
wlan_tx_short:
The wlan_tx_short module generates the 16 samples that outlined the IEEE 802.11 Instant Training Sequence. The STS half is 8 microseconds long, and it’s intended to relieve any receiver lock its computerized attain modify (AGC), and attain a rough timing estimate of the packet; this topic is coated in the wlan_rx module.
wlan_tx_long:
The wlan_tx_long module generates the 64 samples outlined as the IEEE 802.11 Long Training Sequence. The LTS half is additionally 8 microseconds long. The sequence is supposed for estimating heart frequency offset, in addition to reference for generating the preliminary equalizer parameters; this topic is coated in the wlan_rx module.
wlan_rx:
wlan_pll:
To ascertain the modem can direction of RX samples as like a flash because it receives them, half of the wlan_rx module runs at 4 times the clock rate of the sample rate (20 MSPS). Most of the OFDM receiver successfully runs in an 80MHz clock enviornment and requires its own PLL thanks to this.
wlan_agc:
This module informs the relaxation of the modem when it’s detecting a burst; a sequence of high energy IQ samples is frequently indicative of a digital packet. This module is written to allow the bladeRF-wiphy modem to both modify manual attain modify or to define the alerts from an AGC. In the case of the bladeRF 2.0 micro xA9, the AD9361’s physical modify GPIO pin ( adi_ctrl_out(0) ) may additionally be archaic to speak the modem when the AD9631 has locked to a recent attain atmosphere. This external signal clues in the modem about when the IQ samples are at risk of be accurate. The module additionally informs the relaxation of the modem when it assumes nothing else is transmitting and the medium is obvious. A resolution it reaches by evaluating the IIR filtered values of I^2 + Q^2 in opposition to an empirically determined value. In actual fact, even when nothing is transmitting, a receiver listening to silence will no longer stare 0 energy because of the the thermal noise (in overall the I and Q samples construct no longer trip to 0) so figuring out the magnitude of the IQ vector that shows “radio silence” needed to be empirically determined. For added data about this topic and enforcing an AGC, device shut a explore on the GRCon-18 presentation about enforcing an 802.11 like minded AGC on the fashioned bladeRF https://www.youtube.com/stare?v=rwmfSVXo8K8 .
wlan_acquistion:
The acquisition module seems to be like and tries to title if the contemporary burst is an 802.11 packet by analyzing patterns which might be indicative of the presence of the 10 repetitions of the phenomenal 802.11 fast coaching sequence (STS), a BPSK modulated signal. The acquisition module additionally uses data handed to it from the AGC regarding the open of burst, and whether attain settings have modified. In case the AGC adjustments after the first several samples are received, the bladeRF-wiphy modem then ignores the few samples earlier than the beneficial properties have locked — those samples are at risk of be highly distorted by clipping and of shrimp handy value excluding for starting the burst counter. The acquisition module is the first module to characteristic a burst counter, a counter that counts the choice of samples for the reason that starting of the burst. Effectively the counter affords the modem a strategy of how a ways alongside in a burst it’s. Remember, the bladeRF-wiphy does no longer retailer any samples, it requires something equivalent to a clock (on this case the burst counter) to resolve define IQ samples. The acquisition module asserts the bought
signal in accordance with the Schmidl&Cox OFDM synchronization strategy but easiest if the synchronization value peaks internal a time-body roughly spherical 12 microseconds into the burst. The synchronization value is in accordance with the similarity of the outdated 16 samples, in opposition to the sensible value of the preceding two 16 sample buckets. The value successfully starts to diminish after the 10th repetition of the fast coaching sequence (STS) is when in contrast in opposition to the eighth and the ninth repetitions. The lawful estimation of the end of the 10th repetition of the fast coaching sequence (STS) is required because the modem uses it as a reference for the open time of every subsequent OFDM symbol, at the side of the long coaching sequence (LTS) repetitions that put collectively the STS repetitions. In DSP terminology, the modem has now completed symbol timing restoration.
To support with mounted point arithmetic, the acquisition module calculates a value in which to scale the mounted point samples to be determined energy normalization for the following phases of the modem. If you is at risk of be questioning why no longer lawful depend on the AGC, it is because the analog attain amplifiers managed by the AGC can easiest construct so indispensable. It is miles up to the p_norm (energy normalization) module to be run the relaxation of the modem has energy normalized samples.
wlan_cfo_estimate:
Shall we inform, when two separate physical 802.11 modems keep up a correspondence, in spite of both of them intending to tune precisely to 2.412GHz, the two devices will most likely tune to a chunk of various frequencies, most likely on the uncover of some a decision of or hundreds of Hz. Here’s brought about by impurities in quartz crystal oscillators archaic as references for Section Locked Loops (PLL) and Local-Oscillators (LO). A quartz crystal oscillator’s error of some ingredients per million on the in sort frequency range of oscillators (10MHz to 40MHz) is propagated by the LO to the LO frequencies. Shall we inform, a crystal’s tolerance (expressed in ppm) is propagated nearly unaffected by the LO, which technique a 5ppm tolerance may additionally be as indispensable as 29kHz for an LO generating 5.8GHz. A DSP algorithm in the receiver has to then atone for this. Fortunately, the CFO is discreet to estimate by computing the half contrast between two subsequent similar OFDM symbols. The double repetition of the long coaching sequence found in the starting of every 802.11 body may additionally be archaic to extract this CFO estimate.
The wlan_cfo_estimate module’s main output is a signal known as cfo_atan_average
. The cfo_atan_average
signal is a space of 64 intelligent sensible windows of CFO estimates (output of the atan2() CORDIC). The critical estimate corresponds to the half contrast between the 1st sample of the first LTS and the 1st sample of the 2nd LTS, and so on and so on except the 64th sample of the first and 2nd LTSs. wlan_rx_controller snapshots this free running value on the correct 2nd, more on this later. The CFO estimate can then be archaic to undo the CFO; the accurate CFO correction happens throughout the wlan_fft module, more on this later.
wlan_rx_controller:
The RX controller module comprises a uncomplicated dispute machine that stalls the OFDM decoding pipeline except the SIGNAL symbol of an 802.11 packet has been efficiently decoded. The SIGNAL comes actual after the long coaching sequence, and it’s repeatedly encoded at in point of fact the 6Mbps OFDM Modulation Coding Plot (MCS) rate. The SIGNAL discipline on the opposite hand comprises a 4-bit discipline that indicates the MCS of the the rest of the packet. The RX controller waits for the Viterbi decoder to construct decoding the SIGNAL symbol earlier than sending OFDM symbols after the SIGNAL symbol additional down the receiver pipeline. The Viterbi decoder takes a deterministic interval of time to total, so the FIFO buffers may additionally be sized accurately.
The RX controller maintains its own sample counter which it uses to calculate the particular time to snapshot and build cfo_atan_average
, which is the CFO estimate supplied by wlan_cfo_estimate. The optimal time to snapshot d_phase
is when the intelligent sensible window in wlan_cfo_estimate is calculated in accordance with samples on the tail end of the LTS. This successfully ensures the CFO is estimated on the LTS samples which might be after the LTS’s Cyclic Prefix.
The capacity normalization value calculated by wlan_acquistion is additionally snapshotted and saved as correction_p_mag. The RX controller inverts the CFO estimate to construct a signal (correction_dphase) that may even simply also be archaic to atone for the CFO, more on this later in wlan_fft.
wlan_fft:
On the core of an OFDM demodulator is an FFT that takes time enviornment samples and converts them into frequency enviornment containers that correspond to OFDM subcarriers. The frequency enviornment subcarrier is mostly a uncomplicated phasor that is modulated the utilization of a aged IEEE 802.11 modulation comparable to: BPSK, QPSK, 16-QAM, 64-QAM, 256-QAM, and so on.
To mitigate the results of the heart frequency offset (CFO), the receiver: estimates the CFO, inverts the CFO estimate to construct a “correction half”, and generates a advanced tone in accordance with the correction half. Eliminate the wlan_rx_controller module computes and affords correction_dphase. The advanced tone (e^{jwt}) is then multiplied in the time enviornment with the baseband IQ samples sooner than being fed into the FFT. The advanced tone is known as advanced because it easiest has one spectral ingredient situated at w in the frequency enviornment. In actual fact, a time enviornment multiplication of the baseband IQ samples with the advanced tone is a frequency enviornment convolution that “frequency shifts” the time enviornment samples to where they would roughly be if no CFO existed. The wlan_fft module uses the symbol_start
signal from wlan_rx_controller to: #1) purchase out which baseband IQ samples to correct then ship to the FFT and #2) open the numerically managed oscillator (NCO) that generates the advanced tone archaic to correct samples in step #1.
For each OFDM symbol, which consists of 64 time enviornment IQ samples, the wlan_fft module outputs 64 “CFO corrected” frequency enviornment samples, each equivalent to a subcarrier.
wlan_cfo_correction:
Since the CFO correction is frequently handled by the wlan_fft module, this module performs the closing correction step earlier than equalization. The wlan_fft module scales samples the utilization of the energy normalization value that turn into calculated by wlan_acquistion and snapshotted by wlan_rx_controller.
wlan_equalizer:
The wlan_equalizer module receives 64 energy normalized “CFO corrected” frequency-enviornment samples per OFDM symbol. Forward of any demodulation can device shut set aside, one closing reversible channel construct in suppose must be mitigated, and that is multipath. As an RF wave propagates, it shows off walls, windows, surfaces, and in point of fact refracts spherical surfaces, culminating in more than one time-delayed copies of the fashioned signal reaching a receiver. In construct, multipath is to wi-fi verbal exchange modems, as echoes or resonant rooms are to folks speaking. In time-enviornment modulation tactics, strategies like Least Squares (LS) equalization may additionally be archaic to estimate a channel impulse response. This estimate is then archaic to construct a filter that inverts (successfully, gets rid of) the channel impulse response. With frequency enviornment tactics like OFDM, once received samples strategy out of the receiver’s FFT, there are no longer any speak echoes to device shut away, in its set aside multipath may additionally be modeled as a per-subcarrier half rotation and magnitude scaling. Put simply, multipath is modeled by a per-subcarrier phasor, or advanced vector. The effects of multipath can then be modeled as a space of per-subcarrier advanced vector multiplications.
S_{received} = C_{channel} S_{transmitted}
The effects of multipath are modeled and assuredly known as the channel impulse response (CIR). The CIR may additionally be estimated by evaluating each frequency-enviornment subcarrier bin (generated by FFT-ing received IQ samples) in opposition to the expected subcarrier’s value (outlined by IEEE 802.11). The wlan_equalizer module takes a Zero Forcing strategy by simply dividing the expected value by the frequency-enviornment bin computed from received IQ samples to manufacture an inverse channel impulse response.
In actual fact, if S_{transmitted} is identified (in 802.11 the constellation points of the LTS are outlined), and S_{received} are the samples that strategy out of wlan_fft, the channel inverse estimate refered to as (C_{channel})^{-1} may additionally be estimated simply by: dfrac{S_{transmitted}}{S_{received}}.
wlan_rx_controller ensures the first space of 64 subcarrier samples that the wlan_equalizer module receives belong to the 2nd LTS symbol. In the INITIAL_ESTIMATE dispute, the wlan_equalizer module generates its preliminary equalizer parameters. These preliminary parameters, (C_{channel})^{-1}, are estimated by dividing the particular samples (fixed “T2”) by the baseband samples (signal “in_sample”) that have been in point of fact received. The per-subcarrier equalizer parameters are saved, and are recalled to correct each subsequent OFDM symbol’s subcarrier samples. Every subcarrier sample is corrected by multiplying it with its corresponding equalization parameter:
S_{equalizer} = S_{received} (C_{channel})^{-1}
wlan_equalizer outputs one fewer OFDM symbol than it receives because the first symbol (the 2nd LTS) it receives is archaic to calculate the preliminary equalizer parameters. Subsequent OFDM symbols are equalized then output by the wlan_equalizer module.
The wlan_equalizer module can additionally device shut a dfe_sample as an enter parameter. This parameter is the constellation-clamped value it estimates it ought to aloof have received. Shall we inform, if after equalization the following IQ sample is 0.9+j0.001, the binary soft resolution module (wlan_bsd), will clamp it to +1 assuming a BPSK constellation. wlan_equalizer then calculates a recent vector:
{(C_{channel})^{-1}}_{next}= dfrac{hat{S}_{transmitted}}{S_{received}}= dfrac{constellation clamp (S_{received})}{S_{received}}.
To steer certain of like a flash adjustments, the updated {(C_{channel})}^{-1} parameter may additionally be weight-averaged with the outdated value. This manufacture of equalization parameter updating, is identified as Probability Feedback Equalization. It is miles precious for mitigating residual CFO, and for varying channel effects. The multipath brought on channel impulse response estimate customarily is no longer lawful for longer than the transmission time of its respective packet. On the other hand, like a flash intelligent objects (comparable to fan blades) can invalidate the preliminary equalizer parameter estimates earlier than the packet is received. These adaptations on the opposite hand, are indispensable much less pronounced between adjacent symbols, so the DFE equalizer can optimistically song the altering channel impulse response because it ought to be.
As a facet display hide, time-enviornment (single provider) waveforms many times use Least Squares (LS) equalization to approximate time-enviornment filter parameters to mitigate multipath. These time-enviornment filter parameters successfully are time-enviornment conversions (FFT) of the inverse channel impulse response, which will most likely be thought of in frequency-enviornment phrases. If those identical LS time-enviornment filter parameters might be converted to the frequency-enviornment by an FFT, they would most likely explore equivalent to the frequency-enviornment derived equalizer parameters.
wlan_phase_correction:
In OFDM IEEE 802.11, 4 equally spaced out subcarriers are reserved as pilot tones. These pilot tones are time-varying but deterministic, and may additionally be anticipated by the received. The pilot tones are archaic by wlan_phase_correction to estimate and mitigate any residual CFO.
When the wlan_phase_correction module receives an OFDM symbol, it extracts the pilot tones, and calculates a residual CFO estimate in accordance with the adaptation in angle between the pilot tones’ expected and measured vectors. Finally, a single per-symbol half correction vector is calculated and then applied to all subcarriers in the contemporary OFDM symbol.
wlan_demodulator:
The wlan_demodulator module serves two capabilities. Its main project is to flip subcarrier baseband IQ samples into bits in accordance with the modulation constellation point closest to the IQ sample. Rather plenty of data may additionally be misplaced if laborious choices are carried out, for occasion, with BPSK an IQ sample of 0.1+j0 would aloof be judicious a +1, but it absolutely is a indispensable weaker +1 than an IQ sample at 0.98+j0.03. To relieve the Viterbi decoder, wlan_demodulator produces a 3-bit run guess (or lack thereof) value for each bit it demodulates, right here’s known as a Binary Gentle Probability (BSD). The nearer a demodulated BSD is to a resolution boundary the much less particular the resolution is, and vice versa. It is a necessity to have in strategies, constellation points are laid out in a system to in the discount of the Hamming distance between constellation points. For prime uncover modulation schemes like 64-QAM, the 4 bits that comprise the constellation point are at different distances from resolution boundaries, so each of the 4 binary soft choices can have different run guess ranges.
Secondly, the wlan_demodulator module affords the constellation point closest to the IQ sample support to wlan_equalizer so as that wlan_equalizer can replace its equalizer parameters as described in the wlan_equalizer half.
Finally, wlan_demodulator outputs the demodulated BSDs it calculates. The selection of BSDs per symbol depends on the modulation plan alone, a maximum choice of 288 BSDs is output for MCSs the utilization of 64-QAM.
wlan_deinterleaver:
The demodulated BSDs are deinterleaved in conserving with the IEEE 802.11 specification. IEEE 802.11 depends on interleaving to be run uncoded bits are no longer adjacent in frequency to steer certain of clusters of grouped bit errors. Viterbi decoder will most likely be no longer able to going thru adjacent groups of bit errors.
wlan_depuncturer:
The deinterleaved BSDs are rearranged to be handed to the Viterbi decoder. The wlan_depuncturer module reverses the puncturing that is completed by the transmitter’s modulator. Puncturing is archaic in IEEE 802.11 to device shut away redundant bits at elevated MCSs when a high SNR link decreases the need for error correction. More redundant bits (the ratio of coded to uncoded bits) decrease the rate “r” value of an MCS, which will increase an MCS’s capacity to correct errors.
wlan_viterbi_decoder:
The wlan_viterbi_decoder uses a Gentle Viterbi Algorithm (SOVA) decoder. Due to overall approachs comparable to traceback based totally Viterbi decoders, the decoded bits device shut a particular amount of clock cycles to be computed. The wlan_viterbi_decoder dispute machine flushes the Viterbi decoder when all linked soft choices have been supplied, and waits for the decoded bits to change into readily available. This dash is terribly noticeable when decoding the SIGNAL symbol, or waiting for the final bytes of a PDU.
wlan_descrambler:
The wlan_descrambler module simply undoes the scrambling completed by the transmitter’s scrambler. The SERVICE byte is repeatedly expected to be 0, so the descrambler finds a LFSR initializing value that meets the standards. Every subsequent byte is descrambled with subsequent values of the LFSR.
Scrambling is precious for heading off transmitting identical IQ samples sequentially thanks to repeated values (or low entropy knowledge) in PDUs, comparable to: strings of zero bytes in in sort TCP and UDP headers, or ASCII characters that in fact easiest encode about 6 bits of entropy per byte. The same IQ samples repeated sequentially can briefly distort the PAPR limits, and reason points for the transmitter.
wlan_rx_framer:
The wlan_rx_framer module is the final dispute machine in the wlan_rx module. In the beginning the wlan_rx_framer decodes the SIGNAL symbol and verifies its integrity by checking the parity bit. The SIGNAL discipline’s MCS and dimension fields are decoded and asserted to the relaxation of the wlan_rx subsystem. Due to this truth, the module assembles bytes coming from the descrambler into a PDU. These bytes are then saved into a fast-term packet FIFO. Finally, wlan_rx_framer calculates a packet’s CRC and verifies whether it fits the body test sequence (FCS) in the received packet. If the CRC fits the FCS, the packet is believed to have been efficiently decoded, and the packet is marked as authentic in the fast-term packet FIFO. wlan_rx_framer additionally determines whether a packet is addressed to the contemporary modem, and whether the 802.11 body model and subtype require an acknowledge body (ACK) to be sent to the fashioned transmitter. In case an ACK is required, wlan_rx_framer sets the ack_mac (the MAC take care of of the intended recipient of the ACK) and asserts ack_valid
. The ack_mac
and ack_valid
are then written into a FIFO buffer the wlan_top module uses to generate an ACK packet straight in HDL on the FPGA. This step is required to meet strict acknowledge timing requirements in IEEE 802.11.
wlan_rx_packet_buffer:
The wlan_rx_packet_buffer is a double buffered FIFO that lets in packets to be kept as they are being received. If a packet is efficiently decoded, wlan_rx_packet_buffer asserts buf_params_valid
as authentic to speak the relaxation of the modem that a authentic packet is fresh. In case it’s determined that a packet is no longer authentic, because the FCS test failed or because the packet’s energy turn into misplaced, wlan_rx_packet_buffer is instructed to certain the fast-term buffer. wlan_rx_packet_buffer receives packets both from the DSSS and OFDM modules.
DSSS:
wlan_dsss_rx:
The IEEE 802.11 Deliver-Sequence Spread Spectrum (DSSS) charges customarily fully exist on IEEE channels 1 thru 11, and are in point of fact assuredly known as legacy bitrates. On the other hand, in spite of the name, DSSS frames are aloof very standard even in 2020. The bottom DSSS bitrate is the 1Mbps rate. This rate occupies 22MHz of bandwidth, when in contrast to the lowest OFDM rate, the 6Mbps rate, which occupies easiest 20MHz. This high stage of redundancy makes DSSS frames inherently more resilient in opposition to bit and packet errors, of which there could be a high most likely in the 2.4GHz ISM band. The DSP algorithms for enforcing DSSS charges are scheme more efficient than those needed for OFDM charges, on the opposite hand having one modem be in a space to decode both OFDM and DSSS charges requires some cautious planning. The correct lowest-overall more than one for IEEE 802.11 DSSS charges sets the sample rate to both 11MSPS or 22MSPS. IEEE 802.11 OFDM charges on the opposite hand want a sample rate that is at risk of be a more than one in every of 20MSPS. Due to the indispensable elevated resilient nature of DSSS charges, it then makes more sense to prioritize the efficiency of the OFDM charges, and use 20MSPS as the gruesome sample rate for a mixed IEEE 802.11 DSSS and OFDM modem.
wlan_dsss_despreader:
IEEE 802.11 DSSS packets comprise chips, which are spread-sprectrum modulated PDU bits. In DSSS, a single PDU bit is modulated then “spread out” into the many samples that present an explanation for a chip. These chips have one in particular bright property: a identified chip sequence easiest has a high correlation value with its advanced conjugate when the comparison window completely aligns the two chips. A diminutive time offset between a received DSSS chip and its identified advanced conjugate is sufficient for the correlation value to be very low. The correlation value is additionally very low when the advanced conjugate of the identified DSSS chip is correlated with noise and non-DSSS samples. The direction of of evaluating correlation values between received IQ samples and advanced conjugates of DSSS chips to get a chip is identified as despreading. An IEEE 802.11 DSSS modem uses the preamble, known as the Originate of Frame Delimited (SFD), which consists of 144 alternating -1 and +1 chips to increase symbol timing.
IEEE 802.11 DSSS uses a undeniable correlation to indicate a ‘1’ bit, and uses a unfavourable correlation to indicate a ‘0’ bit. The bits are then concatenated, turn into bytes, and kept into a FIFO to recreate the PDU.
If the machine have been sampling at 22MSPS, despreading the DSSS chips might be a uncomplicated mix of addition and subtraction of historical values dictated by the DSSS chip sample. On the other hand, because the resolution turn into made to sample at 20MSPS, the 22MSPS DSSS chip sample must be resampled to 20MSPS. This resampled chip is outlined by the fixed known as “preamble” in wlan_dsss_despreader.
wlan_dsss_despreader performs a fleshy DSSS chip correlation on each incoming sample and the outdated 19 samples.
wlan_dsss_peak_finder:
The wlan_dsss_peak_finder module is guilty for estimating symbol timing by finding which of the 20 most likely time offsets (or containers) corresponds to the supreme correlation magnitude. The bin index that is the mode (output signal “out_mode_bin”) is believed to be the correct timing. It is miles then selected as the bin whose correlation output is archaic to reconstruct the PDU, bit by bit.
wlan_dsss_demodulator:
The IEEE 802.11 CCK charges use Differential Binary Section Shift Key (DBPSK) to encode PDU bits. For N choice of PDU bits, N+1 DBPSK chips are needed. A PDU bit “0” is demodulated if the contemporary chip is the same value as the outdated chip, as an illustration a -1 chip followed by a -1 chip. Conversely a PDU bit “1” is demodulated if the contemporary chip is different (Differential) from the outdated chip, as an illustration a -1 chip is followed by a +1 chip.
As these bits are received, the wlan_dsss_demodulator module descrambles the bits earlier than outputting out_bits and out_valid.
wlan_dsss_rx_framer:
The wlan_dsss_rx_framer module in the origin waits for the particular 2nd to snapshot the bin index that is the mode. As soon as snapshotted it’s supplied as an estimate to the relaxation of the DSSS RX chain. Finally wlan_dsss_demodulator is guilty for concatenating descrambled bits from wlan_dsss_demodulator into PDU bytes, and guaranteeing the CRC in the packet header and the FCS in the packet match. PDU bytes are sent to a fast-term buffer in wlan_rx_packet_buffer, except the packet’s FCS may additionally be validated.
Fresh set
The HDL bladeRF-wiphy modem is a IEEE 802.11 like minded implementation. bladeRF-wiphy can for the time being easiest synthesize for the bladeRF 2.0 micro xA9. The bladeRF 2.0 micro xA4’s FPGA is simply too runt to suit all ingredients of the DSSS RX, and OFDM RX and TX modems. The modem may additionally be totally simulated in Modelsim.
Sides
- IEEE 802.11 like minded FPGA based totally PHY receiver and transmitter
- Effectively suited with bladeRF 2.0 micro xA9 (and bladeRF 2.0 micro xA9 THERMAL)
- Linux mac80211 MAC integration
- RX and TX display screen mode reinforce
- Hardware Disbursed Coordination Characteristic (DCF) lets in fast flip-spherical time ACKs
- Excessive-efficiency equalizer – implements Zero Forcing (ZF) and optionally Probability Feedback Equalizer (DFE)
Modulation schemes:
DSSS – CCK
OFDM – 20MHz (6Mbps, 9Mbps, 12Mbps, 18Mbps, 24Mbps, 36Mbps, 48Mbps, 54Mbps)
Bandwidths:
5MHz (precious for 802.11p)
10MHz
20MHz
Modulation constellations:
DSSS-CCK DBPSK
OFDM-BPSK
OFDM-QPSK
OFDM-16-QAM
OFDM-64-QAM
Convolution encoder charges:
r=1/2
r=2/3
r=3/4
Mission
The strategy goal of this mission is to maintain the gap of a single open-offer modem mission that can leverage Linux’s open-offer mac80211.
With any luck the open of this open-offer modem will present builders and researchers with a single mission resolution to learn about OFDM, DSSS, 802.11, MACs.
In the gigantic plan of issues, it is a necessity that the open-offer community has the instruments needed to transparently work alongside with technologies which might be the basis of our stylish verbal exchange strategies.
Future
Currently plenty of the wi-fi protocols we use and depend on in our day to day lives are opaque pieces of workmanship. Researchers and builders are unable to habits experiments and serious be taught.
While the modem for the time being works on the bladeRF, it’s hoped that the bladeRF-wiphy mission might be the starting of a revolution in open-offer verbal exchange and the basis of open-offer chips. For a thriving community focusing on open-offer chip sort please device shut a explore on the Google affiliated Skywater-PDK mission.
Evolved facets and inquiries
For inquiries regarding high efficiency demodulation, Crest Ingredient discount, Digital Predistortion (DPD), Probability Feedback Equalization, re-modulation tactics, reinforce and licensing, please contact [email protected] .
Please contact [email protected] for crucial points regarding an intensive 2 day coaching direction on the fleshy IEEE 802.11 stack overlaying the entire lot between Schrodingers equations and HTTP, at the side of: applied DSP and statistics, DSSS, OFDM, PHYs, MACs, Linux, mac80211.
Notes
The offer code is launched below the GPLv2 license on Github at https://github.com/Nuand/bladeRF-wiphy/ . To characterize bugs, suggestions, and facets requests please join the bladeRF Slack ( channel #bladeRF ).
To contact us, reinforce this effort, or contribute, please contact [email protected] or judge joining the #bladeRF channel in bladeRF Slack.
All specs discipline to interchange at any time with out stare. bladeRF is sold as test equipment and is anticipated for all intents and capabilities to be archaic as such. Exhaust of this tool is at your own threat and discretion. Nuand LLC makes no warranty of any model (whether suppose or implied) in regards to discipline topic supplied on this web page, and disclaims any and all warranties, at the side of accuracy of this characterize, or the implied warranties of merchatability and properly being for use.