WARP Project Forums - Wireless Open-Access Research Platform

You are not logged in.

#1 2011-Sep-19 19:34:43

witestlab
Member
Registered: 2011-Jun-18
Posts: 7

OFDM on WARPlab (MATLAB only)

I have read some old posts about this but could not find accurate details online.

We are working on implementing 2x2 MIMO with OFDM transciever for some beamforming experiments.This requires a lot of accurate channel measurements and hence OFDM is the natural choice.
Now I believe there are two ways of implementing OFDM.

1) Use the OFDM reference design and bit stream provided by rice. But I did not find enough documentation where I could learn how to use it with my MATLAB generated data and signal and also for 2x2 MIMO case. I have never worked in SysGen and hence do not know anything about this.

2) Build and entire OFDM transciever in MATLAB and just use the regular MIMO 2x2 or 4x4 bit stream. In this case, a previous post suggested I have to implement following steps.

Generate STS/LTS -> Generate Data -> Constellation map for data -> IFFT -> Add CP -> Scale to [-1, 1] -> Upsample (by 4)and Pass through Square Root Raised Cosine Filter -> Tx/Rx via WARPLAB -> Pass through Square Root Raised Cosine Filter and Downsample -> Coarse Timing Sync using STS-> Fine Timing Sync using STS&LTS -> CFO estimation and compensation using STS -> FFT -> Channel Estimation -> Equalization & Demodulation

Has this been implemented before and does it work?

If yes can somewhere please share their views or MATLAB code.

Offline

 

#2 2011-Sep-20 19:33:22

witestlab
Member
Registered: 2011-Jun-18
Posts: 7

Re: OFDM on WARPlab (MATLAB only)

Anyone has anything to share on OFDM or possiblity of beamforming implementation on WARP?

Offline

 

#3 2011-Sep-20 20:37:11

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: OFDM on WARPlab (MATLAB only)

Implementing OFDM in WARPLab is certainly possible. A few comments on the processing chain you described:
-The SRRC filters probably aren't necessary; these are usually used in single-carrier systems to mitigate ISI, and aren't really needed for OFDM.
-The up/downsample by 4 is arbitrary- you can adjust this factor to suit your bandwidth target.
-You'll want to insert pilot tones in dedicated subcarriers, and use these to estimate/correct phase errors at the receiver.
-Because WARPLab processes offline, you can use any part of the received signal for CFO compensation, not just the STS. You'll get better results using the LTS (longer sequence -> more accurate estimate) and pilot tones.

A simple MATLAB SISO OFDM script is included below. I wrote this a *long* time ago; hopefully it's helpful, but I make no performance guarantees. The TxRx_auto() function is a shortcut for the usual WARPLab Tx/Rx cycle (you'll need to add the WARPLab setup code above this, too).

Beamforming is also doable; Melissa has done lots of beamforming experiments in WARPLab for her research. Channel estimation and CFO correction are especially critical here. Sharing RF reference clocks to eliminate CFO is a good "cheat" to use during development.

Offline

 

#4 2011-Sep-20 20:37:17

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: OFDM on WARPlab (MATLAB only)

Code:

trainingSym_freq = [0 -1 1 -1 1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 1 1 1 1 -1 -1 1 1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 1 1 1 -1 -1 -1 -1 -1 -1];
trainingSyms_time = ifft(trainingSym_freq, 64);

chan_impResp = [0.8 0.1 0.1];
pktDetCorr_thresh = 0.3;

numBytes = 240;
numOFDMSyms = 20;
fftWindowOffset = 6;
numTrainingSyms = 4;

pilotTonesTx = (randint(numOFDMSyms, 4, 2) .* 2) - 1;

dataTx_qpsk = randint(1, numBytes*4, 4);
mod_qpsk = qammod([0:3], 4, 0, 'gray');
modnorm_qpsk = modnorm(mod_qpsk, 'avpow', 1);
symsTx_qpsk = repmat([zeros(1,47) 1], 1, 20);%qammod(dataTx_qpsk, 4, 0, 'gray') .* modnorm_qpsk;
symsTx_qpsk = qammod(dataTx_qpsk, 4, 0, 'gray') .* modnorm_qpsk;

symsTx_mat = reshape(symsTx_qpsk, 48, numOFDMSyms).'; %20x48

ifftInTx = zeros(20, 64);

%Start filling in the FFT input matrix, leaving zeros where needed
% Columns: 1->DC, 32->max +freq, 33->max -freq, 64->min -freq
% Leave zeros in columns([1 8 22 28:32 33:38 44 58])
ifftInTx(:, [2:7 9:21 23:27 39:43 45:57 59:64]) = symsTx_mat; %20x64
ifftInTx(:, [8 22 44 58]) = pilotTonesTx;
ifftInTx = [repmat(trainingSym_freq, numTrainingSyms, 1); ifftInTx];

ifftOutTx = ifft(ifftInTx.', 64).';

cycExtTx = [ifftOutTx(:,49:64) ifftOutTx];

TxVec = reshape(cycExtTx.', 1, prod(size(cycExtTx)));
TxVec_air = [zeros(1,250) interp(TxVec, 4) zeros(1,2^14 - length(TxVec)*4 - 250)];

%Channel goes here- either filter() for sim, or WARPLab Tx/Rx exchange
RxVec_air = filter(chan_impResp, 1, TxVec_air);
%RxVec_air = TxRx_auto(TxVec_air);

RxVec_chan = downsample(RxVec_air, 4);

trainingSymCorr = abs(conv(RxVec_chan, trainingSyms_time));
trainingSymCorr_peaks = find(trainingSymCorr > pktDetCorr_thresh);
trainingSymCorrSearch = diff(trainingSymCorr_peaks(find(diff(trainingSymCorr_peaks)~=1)));

if(trainingSymCorrSearch(1) ~= 80)
	%No packet detected; giving up
	disp('No packet detected in received samples!')
	return;
else
	pktStartSamp = trainingSymCorr_peaks(1);
	pktEndSamp = pktStartSamp + (numOFDMSyms*80) + ( (numTrainingSyms-1)*80) - 1;
	RxVec = RxVec_chan(pktStartSamp : pktEndSamp);
end

RxVec_mat = reshape(RxVec, 80, length(RxVec)/80).';
cycRemRx = RxVec_mat(:, [17:80]-fftWindowOffset);

fftOutRx = fft(cycRemRx.', 64).';

trainRx_mat = fftOutRx(1:numTrainingSyms-1, :);

chanEst = sum(repmat(trainingSym_freq, numTrainingSyms-1, 1) .* trainRx_mat)./(numTrainingSyms-1);

symsRx_mat = fftOutRx(numTrainingSyms:end,:);
symsRx_eq = symsRx_mat ./ repmat(chanEst, numOFDMSyms, 1);

pilotTonesRx_eq = symsRx_eq(:, [8 22 44 58]);
pilotTonesRx_phases = angle(pilotTonesRx_eq .* pilotTonesTx);
pilotTonesRx_phases_avg = mean(pilotTonesRx_phases,2);

symsRx_eq_phaseCorr = symsRx_eq .* exp(-j*repmat(pilotTonesRx_phases_avg, 1, 64));

symsRx = symsRx_eq_phaseCorr(:,[2:7 9:21 23:27 39:43 45:57 59:64]);
symsRx_vec = reshape(symsRx.', 1, numOFDMSyms*48, 1);
dataRx_qpsk = qamdemod(symsRx_vec, 4, 0, 'gray');

disp(sprintf('%d Symbol Errors!', length(find(dataRx_qpsk ~= dataTx_qpsk))));

Offline

 

#5 2012-Jul-10 03:20:32

Pratheep211088
Member
Registered: 2012-Jun-20
Posts: 29

Re: OFDM on WARPlab (MATLAB only)

Hi Murphpo,

   I understood the above code and I have question about CFO correction in it. I can observe that you have done timing offset and phase offset correction. But why has nothing been done for CFO compensation?

Thanks
Pratheep

Offline

 

#6 2012-Jul-10 10:48:38

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: OFDM on WARPlab (MATLAB only)

CFO in OFDM manifests as a phase offset in the frequency domain which is constant across subcarriers in each OFDM symbol but increases with increasing symbol index. The phase error correction in this m-code compensates for both CFO and other phase errors. A more robust PHY (like our real-time OFDM PHY) would also estimate and compensate CFO in the time domain (i.e. before the FFT) to reduce ICI, but this simple m code doesn't.

Offline

 

#7 2012-Jul-17 13:32:47

Pratheep211088
Member
Registered: 2012-Jun-20
Posts: 29

Re: OFDM on WARPlab (MATLAB only)

Hi Murphpo,

  I tried implementing this code by using one of the WARPLab demo m-files as TxRx_auto. It works perfectly fine. I would like to extend this design by adding an additional processing algorithm in real-time before the raw samples are stored in the matlab workspace. I basically want to modify the existing bit file and download the new one into the boards using iMPACT. In order to do this, is it enough to make changes in the mdl file, then generate a corresponding bitstream and download it into the boards?

Thanks
Pratheep

Offline

 

#8 2012-Jul-18 15:29:36

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: OFDM on WARPlab (MATLAB only)

The WARPLa ref design is built in XPS. The XPS project integrates the processor (PPC for WARP v1/v2), bus, memories, Ethernet MAC and the WARPLab core. Only the WARPLab core is designed in System Generator. You can definitely update the Sysgen mdl file, then export the updated pcore, replace the pcore in the XPS project, then generate the new bitstream through XPS. This design flow is detailed in the getting start and workshop docs.

Offline

 

#9 2012-Aug-02 02:32:59

Pratheep211088
Member
Registered: 2012-Jun-20
Posts: 29

Re: OFDM on WARPlab (MATLAB only)

Hello Murphpo,

I implemented what you mentioned. Also with the help of the discussion in http://warp.rice.edu/forums/viewtopic.php?id=1300 , I was able to change the antenna port too. But I was able to do it only once. The next time when I made some changes in the Simulink code and replaced the pcore, the new bitstream was not generated in XPS. I have seen to it that I regenerated the pcore (using sysgen) and replaced it with the corresponding pcore in the 'pcores' folder after closing the XPS project. When I reopen the project and tried to generate bitstream, it displays 'no changes in the bitstream'. Kindly let me know if I am making any mistake in the procedure.

Thanks
Pratheep

Offline

 

#10 2012-Aug-02 08:53:26

chunter
Administrator
From: Mango Communications
Registered: 2006-Aug-24
Posts: 1212

Re: OFDM on WARPlab (MATLAB only)

Sounds like maybe the tool is using an old cached design. You could "clean hardware" before building to force it to delete the cache.

Also, we always recommend incrementing the version number of the pcore during the EDK export from System Generator. Then, update your MHS file in your XPS project with the new version number. If you do this, you don't need to clean hardware and you can be confident that the tool is using the correct version of your custom pcore.

Offline

 

#11 2012-Aug-05 18:22:32

Pratheep211088
Member
Registered: 2012-Jun-20
Posts: 29

Re: OFDM on WARPlab (MATLAB only)

Yes. It works fine now. Thanks!

Offline

 

#12 2014-Jul-06 04:25:36

Hasan
Member
Registered: 2014-May-11
Posts: 14

Re: OFDM on WARPlab (MATLAB only)

i want to ask, in ofdm, is it necessary to put preamble code? and how long maximum data can be transmitted at ofdm? thank you before.

Offline

 

#13 2014-Jul-06 14:50:35

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: OFDM on WARPlab (MATLAB only)

i want to ask, in ofdm, is it necessary to put preamble code? and how long maximum data can be transmitted at ofdm? thank you before.

OFDM transmissions typically include a preamble to allow synchronization and channel estimation. The maximum duration of an OFDM transmission depends entirely on the system you're building. Typical constraints on the maximum duration are channel coherence time (if the channel changes and the receiver's channel estimates are stale, errors are more likely) or MAC requirements (802.11 for example limits the maximum duration of a transmission to avoid wasting medium time).

Offline

 

#14 2014-Jul-07 01:43:24

Hasan
Member
Registered: 2014-May-11
Posts: 14

Re: OFDM on WARPlab (MATLAB only)

hmm ok, thanks for your answer. i have one important question again. Is it possible that WARPLab can be used to OFDM? i am not use WARP OFDM Reference Design. thanks before

Offline

 

#15 2014-Jul-07 10:15:37

welsh
Administrator
From: Mango Communications
Registered: 2013-May-15
Posts: 612

Re: OFDM on WARPlab (MATLAB only)

Yes.  Please take a look at the WARPLab OFDM example.

Offline

 

#16 2014-Aug-16 04:31:26

Hasan
Member
Registered: 2014-May-11
Posts: 14

Re: OFDM on WARPlab (MATLAB only)

*sorry for the inconvenient*, based on http://warpproject.org/trac/wiki/WARPLab/Examples/OFDM, i want to asked again:
- what the abbreviation of LTS and EVM?
- at that example used 64 subcarrier and only used 48 subcarrier for data and there are 12 subcarrier not used/blank because no data in there. is it called as virtual carriers?
i'm sorry for no quality questions, actually i'm beginner
thanks before

Offline

 

#17 2014-Aug-16 11:42:49

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: OFDM on WARPlab (MATLAB only)

what the abbreviation of LTS and EVM?

LTS = long training symbol, the 64-sample training sequence defined in the 802.11 spec
EVM = error vector magnitude

at that example used 64 subcarrier and only used 48 subcarrier for data and there are 12 subcarrier not used/blank because no data in there. is it called as virtual carriers?

The highest-frequency subcarriers are empty to avoid interfering with transmissions in neighboring bands. The subcarrier at DC (index 0) is empty to avoid issues with DC offsets in the analog baseband waveforms, which are problematic with direct-conversion RF transceivers. The WARPLab OFDM example uses the same subcarrier mapping as the 802.11 OFDM spec.

Offline

 

#18 2014-Sep-01 01:10:02

Hasan
Member
Registered: 2014-May-11
Posts: 14

Re: OFDM on WARPlab (MATLAB only)

if i want to change fft size to be twice larger at that program. should i change length of LTS and STS? or anything variable should i change maybe? thanks before

Offline

 

#19 2014-Sep-01 13:28:43

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: OFDM on WARPlab (MATLAB only)

Yes- if you change the number of subcarriers you will need to define training symbols which use the new subcarrier mapping.

Offline

 

#20 2014-Sep-23 04:58:14

Hasan
Member
Registered: 2014-May-11
Posts: 14

Re: OFDM on WARPlab (MATLAB only)

hi murphpo
i want to ask why interpolate is very important in OFDM WARP? if i'm not use interpolate, in the receiver will be error even the distance between node are so closed. thank's

Last edited by Hasan (2014-Sep-23 05:23:17)

Offline

 

#21 2014-Sep-23 10:19:07

chunter
Administrator
From: Mango Communications
Registered: 2006-Aug-24
Posts: 1212

Re: OFDM on WARPlab (MATLAB only)

Interpolation isn't fundamental to OFDM. The 2x interpolation in the OFDM example is to account for the fact that WARPLab runs at 40MHz sampling rate (and therefore 40MHz bandwidth). The OFDM waveform used in that example is inspired by the 802.11 standard, which uses only 20MHz of bandwidth down in the 2.4GHz ISM bands (e.g. 802.11g). The interpolation ensures that the actual transmitted waveform is only using 20MHz of bandwidth instead of the full 40MHz that the transceiver is capable of.

If you don't use interpolation, you are effectively doubling the size of each OFDM subcarrier. This means that frequency selectivity in the wireless channel will hurt you more and the link will be more prone to errors. If you want to use the full 40MHz, you are better off redesigning the underlying waveform to use additional subcarriers (i.e. longer IFFT and FFT).

Offline

 

#22 2014-Sep-24 07:56:08

Hasan
Member
Registered: 2014-May-11
Posts: 14

Re: OFDM on WARPlab (MATLAB only)

so bandwidth in WARP is 40 MHz? i think 20 MHz. sorry

and, ofdm waveform which can be implemented in WARP only 802.11 standard. is it right? because i have read IC MAX2828. please correct if i'm wrong

Offline

 

#23 2014-Sep-24 09:20:32

chunter
Administrator
From: Mango Communications
Registered: 2006-Aug-24
Posts: 1212

Re: OFDM on WARPlab (MATLAB only)

1) As described in this post, the 3dB cutoff points for the MAX282 transceiver allows for 36MHz of bandwidth. The WARPLab Reference Design is clocked at a 40MHz sampling rate. So while technically you can transmit and receive at 40MHz of bandwidth, the frequencies between 36-40MHz will be attenuated. This is one of the reasons why only 52 of the 64 possible subcarriers in the 802.11g OFDM waveform are occupied -- many of the higher frequency subcarriers are disabled.

2) WARP is capable of, but not limited to, the 802.11 standard. The 802.11 Reference Design is evidence of this capability. And the many research papers using WARP are evidence of the capability to go far beyond the 802.11 standard.

Offline

 

#24 2014-Sep-25 03:05:59

Hasan
Member
Registered: 2014-May-11
Posts: 14

Re: OFDM on WARPlab (MATLAB only)

but, if i use 2x interpolation so length of samples are two times bigger than 1x interpolation. is it right?

Offline

 

#25 2014-Sep-25 12:10:52

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: OFDM on WARPlab (MATLAB only)

Interpolation increases the sampling rate of a signal without changing its frequency content. 2x interpolation will double the number of samples in a given signal.

Offline

 

Board footer