joint sampling clock and carrier frequency offset tracking -凯发k8网页登录
this example demonstrates joint sampling clock and carrier frequency offset tracking in a wlan receiver.
introduction
a wlan radio typically uses a single oscillator to derive clocks for sampling and modulation. the oscillators in the transmitter and receiver radios do not run at the exact same frequency. due to this mismatch, carrier frequency offset (cfo) exists between the receiver and transmitter and the sampling instants at the receiver shift relative to the transmitter. this shift of sampling instants between receiver and transmitter is described as sampling clock offset (sco). when the sampling clock at the receiver is running slower than the transmitter, this results in a larger sampling period and a positive sampling clock offset. the inclusion of pilot subcarriers in the ieee® 802.11™ standard allows for tracking and correction of sco and cfo impairments.
in ofdm systems sco manifests itself as a subcarrier- and symbol-dependent phase rotation and inter-carrier interference (ici) [ ]. when the sco is large, and a packet is long, subcarriers far away from dc will experience a substantial impairment. cfo manifests itself as ici and a symbol-dependent phase rotation common to all subcarriers. this figure illustrates the phase rotation on subcarriers from one ofdm symbol to the next due to these impairments. is the phase error for subcarrier index , is the number of subcarriers, is the sco, is the carrier frequency offset, is the period of the symbol, is the phase error gradient (peg), and is the common phase error (cpe). the peg and cpe can be used to estimate sco and residual cfo.
this example shows how to demonstrate an ieee 802.11ac™ vht waveform with fixed sco and cfo impairments [], and shows the equalized constellation of the demodulated impaired waveform with and without joint timing and phase tracking to correct for sco and cfo to demonstrate the effectiveness of tracking.
generate a baseband waveform
create a vht configuration object to parameterize the transmission. use a data payload with only 500 bytes and 16-point quadrature amplitude modulation (16-qam) to produce a small number of ofdm symbols and make the impairment easy to visualize.
cfgvht = wlanvhtconfig; cfgvht.channelbandwidth = 'cbw20'; cfgvht.numtransmitantennas = 1; cfgvht.numspacetimestreams = 1; cfgvht.mcs = 4; % 16-qam and 3/4 coding rate cfgvht.apeplength = 500; % bytes
create a random psdu.
s = rng(10); % seed the random number generator psdu = randi([0 1],cfgvht.psdulength*8,1,'int8');
generate a vht packet.
tx = wlanwaveformgenerator(psdu,cfgvht);
model impairments
model -100 parts per million (ppm) sampling clock offset between the transmitter and receiver using .
sco = -100; % sampling clock offset in ppm
use by specifying the desired sample rate offset. sample rate offset is the relative offset between the sample rate of transmitter and receiver. sampling clock offset is the relative offset between the sampling period of transmitter and receiver.
sro = -sco/(1 sco/1e6); % sample rate offset in ppm
model sampling clock offset, appending zeros to the waveform to allow for filter delay.
samplingclockoffset = comm.samplerateoffset(sro); rx = samplingclockoffset([tx; zeros(100,cfgvht.numtransmitantennas)]);
add residual carrier frequency offset to the waveform. this example assumes the same oscillator is used for sampling and modulation, so that the cfo depends on the sco and carrier frequency.
fc = 5.25e9; % carrier frequency, hertz cfo = (sco*1e-6)*fc; % carrier frequency offset, hertz fs = wlansamplerate(cfgvht); % baseband sample rate rx = frequencyoffset(rx,fs,cfo); % add frequency offset
add noise to the waveform with 30 dbw variance.
awgnchannel = comm.awgnchannel('noisemethod','variance','variance',10^(-30/10)); rx = awgnchannel(rx);
front-end synchronization and receiver processing
to synchronize the packet, in preparation for recovering the data field, the example performs these processing steps.
detect the packet
perform coarse carrier frequency offset estimation and correction
establish symbol timing synchronization
perform fine carrier frequency offset estimation and correction
demodulate the l-ltf and estimate the noise power
demodulate the vht-ltf and estimate the channel response
generate field indices and perform packet detection.
ind = wlanfieldindices(cfgvht); toff = wlanpacketdetect(rx,cfgvht.channelbandwidth);
perform coarse frequency offset correction.
lstf = rx(toff (ind.lstf(1):ind.lstf(2)),:); coarsecfoest = wlancoarsecfoestimate(lstf,cfgvht.channelbandwidth); rx = frequencyoffset(rx,fs,-coarsecfoest);
perform symbol timing synchronization.
nonhtpreamble = rx(toff (ind.lstf(1):ind.lsig(2)),:); symoff = wlansymboltimingestimate(nonhtpreamble,cfgvht.channelbandwidth); toff = toff symoff;
perform fine frequency offset correction.
lltf = rx(toff (ind.lltf(1):ind.lltf(2)),:); finecfoest = wlanfinecfoestimate(lltf,cfgvht.channelbandwidth); rx = frequencyoffset(rx,fs,-finecfoest);
perform channel estimation.
vhtltf = rx(toff (ind.vhtltf(1):ind.vhtltf(2)),:); vhtltfdemod = wlanvhtltfdemodulate(vhtltf,cfgvht); [chanest,chanestsspilots] = wlanvhtltfchannelestimate(vhtltfdemod,cfgvht);
recovery without sampling clock offset or residual cfo tracking
the coarse and fine frequency offset estimation and correction removes the majority of cfo, but residual cfo remains due to the presence of impairments in the waveform. the receiver must track and correct this offset.
disp('front-end impairment correction:');
front-end impairment correction:
frontendcfoest = coarsecfoest finecfoest; disp([' estimated cfo: ' num2str(frontendcfoest,'%.1f') ' hz']);
estimated cfo: -525209.0 hz
residualcfo = cfo-frontendcfoest; disp([' residual cfo after initial correction: ' num2str(residualcfo,'%.1f') ' hz']);
residual cfo after initial correction: 209.0 hz
use the function to recover the vht data field with optional pilot tracking to correct for timing and phase errors due to sco and cfo. control pilot tracking using the object.
first, recover the data field is without pilot tracking. extract the data field from the waveform using the start and end sample indices of the field at the baseband rate. if the receiver sampling rate is higher than the transmitter rate, the receiver requires more samples than the transmitter produces. to allow for this, extract ne
additional samples from the waveform and pass to the recovery function. the maximum number of additional samples required depends on the expected sco, baseband sampling rate, and maximum packet duration.
create a recovery configuration with pilot tracking disabled.
cfgrec = trackingrecoveryconfig;
cfgrec.pilottracking = 'none';
extract data field with ne
additional samples to allow for negative sco.
maxduration = 5.484e-3; % maximum packet duration in seconds maxsco = 120; % ppm ne = ceil(fs*maxduration*maxsco*1e-6); % number of extra samples dataind = toff (ind.vhtdata(1):ind.vhtdata(2) ne); dataind = dataind(dataind<=length(rx)); % only use indices within waveform data = rx(dataind,:);
perform demodulation and decoding.
[rxpsdunotrack,~,eqsymnotrack] = trackingvhtdatarecover(data,chanest,chanestsspilots,cfgvht,cfgrec);
plot the equalized constellation. this plot shows a rotation of all constellation points caused by residual cfo, and a spreading of constellation points due to sco. despite the modest awgn added to the waveform, the impairments cause bit errors within the decoded psdu.
constnotrack = comm.constellationdiagram;
constnotrack.title = 'equalized symbols with no pilot tracking';
constnotrack.referenceconstellation = wlanreferencesymbols(cfgvht);
constnotrack(eqsymnotrack(:));
release(constnotrack)
[~,bernotrack] = biterr(rxpsdunotrack,psdu);
disp('bit error rate:');
bit error rate:
disp([' without tracking: ' num2str(bernotrack)]);
without tracking: 0.066964
recovery with sampling clock offset tracking and residual cfo tracking
now recover the data field with joint timing and phase pilot tracking to correct for sco and residual cfo.
the tracking algorithm in this example estimates absolute values of and per ofdm symbol and applies a per subcarrier and symbol phase correction to the demodulated symbols to reverse the phase errors caused by sco and cfo. the algorithm calculates the phase error between each received pilot subcarrier and the expected value per symbol averaged over pilottrackingwindow
ofdm symbols. from this value, the algorithm calculates least-square estimates of and per symbol, and uses these estimates to apply a phase correction to each symbol and subcarrier [,] .
create a recovery configuration with pilot tracking enabled.
cfgrec = trackingrecoveryconfig; cfgrec.pilottracking = 'joint'; % joint timing and phase tracking cfgrec.pilottrackingwindow = 9; % averaging window in ofdm symbols
perform demodulation and decoding.
[rxpsdu,~,eqsymtrack,cpe,peg] = trackingvhtdatarecover(data,chanest,chanestsspilots,cfgvht,cfgrec);
plot the equalized constellation. this shows a clear 16-qam constellation with no spreading or rotation. the decoded psdu contains no bit errors.
consttrack = comm.constellationdiagram;
consttrack.title = 'equalized symbols with joint pilot tracking';
consttrack.referenceconstellation = wlanreferencesymbols(cfgvht);
consttrack(eqsymtrack(:));
release(consttrack)
[~,bertrack] = biterr(rxpsdu,psdu);
disp([' with tracking: ' num2str(bertrack)]);
with tracking: 0
the function returns measurements from which the residual cfo, and sco can be estimated:
cpe
- the common phase error (radians) per symbolpeg
- the phase error gradient (radians per subcarrier) per symbol
estimate the sco and residual cfo from these measurements using a linear least-square fit of the rate of change. the function performs these measurements and plot the results.
[residualcfoest,scoest] = trackingplotscocfoestimates(cpe,peg,cfgvht);
fprintf('tracked impairments:\n');
tracked impairments:
fprintf(' estimated residual cfo: %3.1f hz (%.1f hz error)\n', ... residualcfoest,residualcfoest-residualcfo);
estimated residual cfo: 198.9 hz (-10.1 hz error)
fprintf(' estimated sco: %3.1f ppm (%.1f ppm error)\n',scoest,scoest-sco);
estimated sco: -98.3 ppm (1.7 ppm error)
cfoest = frontendcfoest residualcfoest; % initial tracked cfo estimate fprintf('estimated cfo (initial tracked): %.1f hz (%.1f hz error)\n',cfoest,cfoest-cfo);
estimated cfo (initial tracked): -525010.1 hz (-10.1 hz error)
rng(s); % restore the state of the random number generator
conclusion
this example shows how you can track and correct sampling clock and carrier frequency offsets when recovering the data field of a wlan waveform.
this example uses data field recovery functions with joint pilot tracking for vht, ht-mf and non-ht formats, and an object to configure the recovery algorithms.
to see an example of pilot tracking for he format packets see the recovery procedure for an 802.11ax packet example.
references
speth, m., s.a. fechtel, g. fock, and h. meyr. “optimum receiver design for wireless broad-band systems using ofdm. i.” ieee transactions on communications 47, no. 11 (november 1999): 1668–77. https://doi.org/10.1109/26.803501.
ieee std 802.11™-2020. ieee standard for information technology - telecommunications and information exchange between systems - local and metropolitan area networks - specific requirements - part 11: wireless lan medium access control (mac) and physical layer (phy) specifications.
chiueh, tzi-dar, pei-yun tsai, lai. i-wei, and tzi-dar chiueh. baseband receiver design for wireless mimo-ofdm communications. 2nd ed. hoboken, n.j: j. wiley & sons, 2012.
horlin, françois, and andré bourdoux. digital compensation for analog front-ends: a new approach to wireless transceiver design. chichester, west sussex ; hoboken, nj: j. wiley & sons, 2008.