WARP Project Forums - Wireless Open-Access Research Platform

You are not logged in.

#1 2015-Apr-23 10:31:08

pranay
Member
Registered: 2014-Jan-21
Posts: 10

WARP as transmitter and receiver with 50 ohm terminator.

Hello
I modified the 4x4 MIMO code (wl_example_mimo_txrx.m) for WARP v.3 to use a MIMO symbol detector in it. I then transmitted an image from Tx and Received it on Rx with nearly 3% BER.
But when I terminated the receivers with 50 ohm terminators provided with the WARP, still the BER is nearly same. Further, I terminated all transmitting ports with matched impedances too. Still the BER is same. Also, I can see the received image which is only marginally distorted (observable effect of 3% BER).
I am attaching the code here. Also the Txed and Rxed images. Please tell, what can I do to see some visible noise effects on my image and why is WARP working properly even after all nodes terminated at both ends?

Transmitted Image
https://mail-attachment.googleusercontent.com/attachment/u/0/?ui=2&ik=c2527cbca6&view=att&th=14ce61bdbfcf3a65&attid=0.3&disp=safe&realattid=f_i8u3ug702&zw&saduie=AG9B_P_wX7GdZctvDNarwIiK9kc3&sadet=1429802655460&sadat=ANGjdJ_shbxM6oNvCxaQRmJ22mXl5Rmj0zuQ0FSoKLXH8rMT_IDW6_SVNW4Kxmk&sads=n7i2Fwhe-CAc9MVS16PFBaVhrkw

Received Image by Algo1
https://mail-attachment.googleusercontent.com/attachment/u/0/?ui=2&ik=c2527cbca6&view=att&th=14ce61bdbfcf3a65&attid=0.1&disp=safe&realattid=f_i8u3ug6a0&zw&saduie=AG9B_P_wX7GdZctvDNarwIiK9kc3&sadet=1429802257364&sadat=ANGjdJ8-cHKeAq_le6cGdmaH0KZ1cV3GgQQvEQRknKNmJBQzjuIrAqe74W5chvI&sads=6dHnKW_xCd-5XP9ycFZtXuDRdsw

Received Image by Algo2
https://mail-attachment.googleusercontent.com/attachment/u/0/?ui=2&ik=c2527cbca6&view=att&th=14ce61bdbfcf3a65&attid=0.2&disp=safe&realattid=f_i8u3ug6t1&zw&saduie=AG9B_P_wX7GdZctvDNarwIiK9kc3&sadet=1429802649424&sadat=ANGjdJ9ArTAuXSvqz5x8k3CaJQnHgDayBKbYyiPEy04mFjNeV2TURO7CyO_e0Do&sads=YNrLr_UvUXQT2eLccZAOGjq-47A


Code Used

Code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% wl_example_mimo_txrx.m
%
% In this example, we send the short symbols from the
% 802.11 PHY specification as a preamble to a simple sinusoidal payload.
% Two radios are used to send sinusoids of different frequencies.
% If enabled by the USE_AGC variable at the top of the code, the AGC core 
% running on the WARP hardware will adjust RF and baseband gains as well as
% subtract off any DC offset that might be present in the reception.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;
clear all;
clc;
M=4;
N=4;
modOrder=4;
num=2^17;
msg=randi([0,(2^modOrder)-1],num,1);
hStr =  RandStream.create('mt19937ar', 'seed',55408);
hmod=comm.RectangularQAMModulator(...
    'ModulationOrder', 2^modOrder,...
    'PhaseOffset', 0, ...
    'NormalizationMethod', 'Average power',...
    'SymbolMapping', 'Gray');
hdmod=comm.RectangularQAMDemodulator(...
    'ModulationOrder', 2^modOrder,...
    'PhaseOffset', 0,...
     'NormalizationMethod', 'Average power',...
    'SymbolMapping', 'Gray');
tx=step(hmod,msg);
img = imread('d:\image2.jpg');
img2=img(:);
imbin = dec2bin(img2);
imbin = imbin.';
imbin = imbin(:);
imbin2 = reshape(imbin,modOrder,length(imbin)/modOrder);
imbin2 = imbin2.';
imdec = bin2dec(imbin2);
imtx= step(hmod,imdec);
x = reshape(imtx,size(imtx,1)/4,4);

% y= reshape(x,size(x,1)*size(x,2),1);
% imrx = step(hdmod,y);
% sd=dec2bin(imrx);
% sd=sd.';
% sdd=sd(:);
% ff=reshape(sdd,8,length(sdd)/8);
% fg= ff.'
% gg= bin2dec(fg)
% dd = reshape(gg,256,256);

% % x=reshape(tx,num/N,N);
% % x= step(hmod,imtx);
USE_AGC = true;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set up the WARPLab experiment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NUMNODES = 2;

%Create a vector of node objects
nodes = wl_initNodes(NUMNODES);


%Create a UDP broadcast trigger and tell each node to be ready for it
eth_trig = wl_trigger_eth_udp_broadcast;
wl_triggerManagerCmd(nodes,'add_ethernet_trigger',[eth_trig]);

%%

%Get IDs for the interfaces on the boards. Since this example assumes each
%board has the same interface capabilities, we only need to get the IDs
%from one of the boards
[RFA,RFB,RFC,RFD] = wl_getInterfaceIDs(nodes(1));

%Set up the interface for the experiment
wl_interfaceCmd(nodes,RFA+RFB+RFC+RFD,'tx_gains',3,50);
wl_interfaceCmd(nodes,RFA+RFB+RFC+RFD,'channel',2.4,11);

if(USE_AGC)
    wl_interfaceCmd(nodes,RFA+RFB+RFC+RFD,'rx_gain_mode','automatic');
    wl_basebandCmd(nodes,'agc_target',-10);
    wl_basebandCmd(nodes,'agc_trig_delay', 500);
    wl_basebandCmd(nodes,'agc_dco', true);
else
    wl_interfaceCmd(nodes,RFA+RFB+RFC+RFD,'rx_gain_mode','manual');
    RxGainRF = 1; %Rx RF Gain in [1:3]
    RxGainBB = 15; %Rx Baseband Gain in [0:31]
    wl_interfaceCmd(nodes,RFA+RFB+RFC+RFD,'rx_gains',RxGainRF,RxGainBB);
end


%We'll use the transmitter's I/Q buffer size to determine how long our
%transmission can be
txLength = nodes(1).baseband.txIQLen;  %32768 by default
% txLength = num;  %

%Set up the baseband for the experiment
wl_basebandCmd(nodes,'tx_delay',0);
wl_basebandCmd(nodes,'tx_length',txLength);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Signal processing to generate transmit signal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% First generate the preamble for AGC. The preamble corresponds to the
% short symbols from the 802.11a PHY standard
shortSymbol_freq = [0 0 0 0 0 0 0 0 1+i 0 0 0 -1+i 0 0 0 -1-i 0 0 0 1-i 0 0 0 -1-i 0 0 0 1-i 0 0 0 0 0 0 0 1-i 0 0 0 -1-i 0 0 0 1-i 0 0 0 -1-i 0 0 0 -1+i 0 0 0 1+i 0 0 0 0 0 0 0].';
shortSymbol_freq = [zeros(32,1);shortSymbol_freq;zeros(32,1)];
shortSymbol_time = ifft(fftshift(shortSymbol_freq));
shortSymbol_time = (shortSymbol_time(1:32).')./max(abs(shortSymbol_time));
shortsyms_rep = repmat(shortSymbol_time,1,30);

preamble = shortsyms_rep;
preamble = preamble(:);

Ts = 1/(wl_basebandCmd(nodes(1),'tx_buff_clk_freq'));
t = [0:Ts:((txLength-length(preamble)-1))*Ts].'; % Create time vector(Sample Frequency is Ts (Hz))

% payload_A = 3*exp(t*j*2*pi*5e6); %5 MHz sinusoid as our "payload" for RFA
% payload_B = 3*exp(t*j*2*pi*8e6); %8 MHz sinusoid as our "payload" for RFB
% payload_C = 3*exp(t*j*2*pi*5e6); %5 MHz sinusoid as our "payload" for RFA
% payload_A = 3*exp(t*j*2*pi*5e6); %5 MHz sinusoid as our "payload" for RFA

% txData_A = [preamble;payload_A];
% txData_B = [preamble;payload_B];
% txData = [txData_A,txData_B];
% txData = reshape(x,size(x,2),2);
% img = imread('c:\image.jpg');

txData = x;

node_tx = nodes(1);
node_rx = nodes(2);



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Transmit and receive signal using WARPLab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for ctr = 1: ceil(length(txData))/32768
    var = 32768*(ctr-1)+1
wl_basebandCmd(node_tx,[RFA,RFB,RFC,RFD], 'write_IQ', txData(var:32768*ctr,:));
wl_interfaceCmd(node_tx,RFA+RFB+RFC+RFD,'tx_en');
wl_interfaceCmd(node_rx,RFA+RFB+RFC+RFD,'rx_en');

wl_basebandCmd(node_tx,RFA+RFB+RFC+RFD,'tx_buff_en');
wl_basebandCmd(node_rx,RFA+RFB+RFC+RFD,'rx_buff_en');

eth_trig.send();

rx_IQ(var:32768*ctr,:) = wl_basebandCmd(node_rx,[RFA,RFB,RFC,RFD],'read_IQ', 0, txLength);
rx_RSSI = wl_basebandCmd(node_rx,[RFA,RFB,RFC,RFD],'read_RSSI');

wl_basebandCmd(nodes,RFA+RFB+RFC+RFD,'tx_rx_buff_dis');
wl_interfaceCmd(nodes,RFA+RFB+RFC+RFD,'tx_rx_dis');

end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Channel estimation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% y = reshape(rx_IQ,2,size(rx_IQ,1));
% zx = reshape(txData,2,size(txData,1));
% zz = [rx_IQ(1,1) rx_IQ(2,1);rx_IQ(3,1) rx_IQ(4,1);]
% tt = [x(1,1) x(3,1);x(2,1) x(4,1);]
% [hest] = chEst(zz,tt)
% [q1,r1]=qr(hest);
yx = rx_IQ.';
zx= txData.';
symbset = constellation(hmod);
inerr=0;
ctr1=0;
 for ctr=1:4:size(yx,2)
    ctr
    
   [hest]= yx(:,ctr:ctr+3)*inv(zx(:,ctr:ctr+3));
   [q1,r1]=qr(hest);
    
 % ctr1=ctr1+1;    
for cntr =1:4
[kbestOut1(:,ctr+cntr-1),nodesk(:,ctr+cntr-1),addsk(:,ctr+cntr-1),multsk(:,ctr+cntr-1)]= kbest(q1,r1,yx(:,ctr+cntr-1),symbset,sqrt(2^modOrder));
[kbestOut(:,ctr+cntr-1),nodesd(:,ctr+cntr-1),addsd(:,ctr+cntr-1),multsd(:,ctr+cntr-1)] = deviation(q1,r1,yx(:,ctr+cntr-1),symbset,sqrt(2^modOrder));
end

% x=reshape(tx,num/N,N);
% x= step(hmod,imtx);
end
 ax = kbestOut1.';
 y= reshape(ax,size(ax,1)*size(ax,2),1);
imrx = step(hdmod,y);
sd=dec2bin(imrx);
sd=sd.';
sdd=sd(:);
ff=reshape(sdd,8,length(sdd)/8);
fg= ff.'
gg= bin2dec(fg)
dd = reshape(gg,256,256);
imwrite(uint8(dd),'kbest.png','png')

ax = kbestOut.';
 y= reshape(ax,size(ax,1)*size(ax,2),1);
imrx = step(hdmod,y);
sd=dec2bin(imrx);
sd=sd.';
sdd=sd(:);
ff=reshape(sdd,8,length(sdd)/8);
fg= ff.'
gg= bin2dec(fg)
dd = reshape(gg,256,256);
imwrite(uint8(dd),'dev.png','png')
 in = step(hdmod,zx(:));
 out = step(hdmod,kbestOut(:));
 out1 = step(hdmod,kbestOut1(:));
 
[ber,berate] = biterr(out,in(1:size(out)));
% [xber,xberate] = biterr(xout,msg(1:1000));
[ber1,berate1] = biterr(out1,in(1:size(out)));
berate
berate1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Visualize results
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% figure(1);clf;
% ax(1) = subplot(4,2,1);
% plot(0:(length(rx_IQ)-1),real(rx_IQ(:,1)))
% xlabel('Sample Index')
% title('RFA: Received I')
% axis tight;
% 
% ax(2) = subplot(4,2,2);
% plot(0:(length(rx_IQ)-1),imag(rx_IQ(:,1)))
% xlabel('Sample Index')
% title('RFB: Received I')
% axis tight
% 
% bx(1) = subplot(4,2,3);
% plot(0:(length(rx_IQ)-1),real(rx_IQ(:,2)),'r')
% xlabel('Sample Index')
% title('RFA: Received Q')
% axis tight;
% 
% bx(2) = subplot(4,2,4);
% plot(0:(length(rx_IQ)-1),imag(rx_IQ(:,2)),'r')
% xlabel('Sample Index')
% title('RFB: Received Q')
% axis tight
% 
% linkaxes([ax,bx],'x')
% 
% 
% subplot(3,1,3)
% plot(0:(length(rx_RSSI)-1),rx_RSSI(:,1))
% hold on
% plot(0:(length(rx_RSSI)-1),rx_RSSI(:,2),'r')
% hold off
% legend('RFA','RFB','location','southeast')
% axis tight
% xlabel('Sample Index')
% title('Received RSSI')
% 
% figure(6)
% scatterplot(txData(:));
% hold on
% scatterplot(rx_IQ(:));

Offline

 

#2 2015-Apr-23 11:59:11

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

Re: WARP as transmitter and receiver with 50 ohm terminator.

pranay wrote:

Further, I terminated all transmitting ports with matched impedances too. Still the BER is same.

That should be a big red flag that your script isn't doing what you think its doing. I glanced through your attached code; it is missing many fundamental pieces that are needed for an operational MIMO physical layer. Specific examples:

1) Modulated symbols are loaded into the transmit buffer directly. This will produce a serial stream of 40MHz-wide samples. This isn't how wide-band PHYs typically operate since it places a huge burden on the receiver to deal with frequency-selective multipath fading. The most common strategy to overcome this problem is OFDM, where a wide-band signal is constructed out of many narrow subcarriers. Each subcarrier is sufficiently narrow to effectively ignore frequency selectivity.

2) There isn't any kind of preamble to the transmission. As such, I can't see how the receiver is supposed to align to the transmitter symbol boundaries. Furthermore, I can't see how the receiver is supposed to do channel estimation since there aren't any training symbols.

3) There is no implementation of CFO recovery, which is critical when your transmitter and receiver are operating with unshared clocks.

4) I'm not sure what the channel estimation chunk of code is doing. I do see that it is using the transmitted data directly, which is something that a receiver can't do (if it has the transmitted data, then the job is done and can just ignore the received waveform). I suspect this has some part to play in fact you are seeing marginally good BER performance even when you aren't transmitting anything (when the radios were capped). A quick test, if you set rx_IQ explicitly to a vector of all zeros, do you see the same behavior?

I'd suggest taking a look at our OFDM Comm Example. That example tackles many of the above pieces that are missing from your design. It isn't MIMO, but it should be your starting point before adding MIMO functionality.

Offline

 

Board footer