[USRP-users] E310 rx_samples_from_file stores data based on sample rate and not Bandwidth

olivani s.olivani15 at gmail.com
Tue Jul 25 08:43:55 EDT 2017

Hi ,

Let me first describe my application

I have to collected data (type short, wirefmt sc16) at a particular center
frequency at a sampling rate of 25 Msps and set the bandwidth to be 20 MHz
and the master clock is set to be 25 MHz. I have a custom fpga to detect
the presence of unwanted signal within the 20 MHz bw of data collected .

I am using rx_samples_to_file script to collect data . I assume that when I
plot the data ,, any tone below -10MHz and beyond +10 MHz should be

But when I used the script ./rx_samples_to_file I noticed that the data
collected is equal to the sample rate specified and when plotted using
pwelch function with bin size 512  I still see the tone after 20 MHz bw.

/usr/lib/uhd/examples/rx_samples_to_file --file /dev/test_5bw_20msps_1
--subdev A:A --args="type=e3x0,master_clock_rate=25e6"   --bw 20e6 --freq
110e6 --rate 25e6 --duration 1  --stats

as per input parameter specified above I set the centre frequency at 110
MHz and have injected a tone at 122.5 MHz and set the BW to be 20 MHz. I
assumed the tone should not be visible , but unfortunately it does.

This may lead to faulty detection in my application.

1. I added debug statements to see if at all the bw setting  code is
executed and it does.
2. I varied the bandwidth to be 5 MHz and I am able to see the roll off and
also the tone.

Please find the plot below for the above input command

[image: Inline image 1]

Now setting the bandwidth to 5 MHz for verification purpose[image: Inline
image 2]

The code snippet used to plot the data in matlab as follows

binary_file = '\\fargo\projects\wls\staging\subbuku-o\test_5bw_20msps_1';%./rx_samples_to_file
--file /dev/test_5bw_20msps_2 --subdev A:B
--bw 20e6 --freq 110e6 --rate 25e6 --duration 1 --stats

if ~exist('plotOn', 'var') || isempty(plotOn)

plotOn = 1;


if ~exist('power_dbm', 'var') || isempty(power_dbm)

power_dbm = -100;


fid = fopen(binary_file,'r');

%A = fread(fid,inf,'bit16','ieee-le');

if ~exist('wordWidth','var') || isempty(wordWidth)

% default to 16 bits...

A = fread(fid,inf,'bit16','ieee-le');


% extract according to word desired word width

width = ['bit',num2str(wordWidth)];

A = fread(fid,inf,width,'ieee-le');


%A = fread(fid,inf,'bit16','ieee-le');

%A = fread(fid,inf,'float32');

%parse the entire binary file

%A = fread(fid);


%A = A(1:2*4096);

I = A(1:2:end);

%figure; plot(I,'b-'); %-->counter test

Q = A(2:2:end);

if 0


mag = 20*log10(abs(I));



complex_sig = I + 1i*Q;

%complex_sig = transpose(complex_sig);

%fs = 1024e3;%512e3; %1024kHz for 4x and 8x; 768kHz, 512kHz and 256kHz for
6x, 2x and 1x

%fs = 512e3;

%fs = 256e3;

%fs = 7.68e6;

%fs = 15.36e6;

%fs = 7.68e6;

fs =25e6;

%[Pxx,F] = pwelch(complex_sig(1:4096*15),4096,[],[],fs,'centered');%%4x and

%[Pxx,F] = pwelch(complex_sig(1:end),[],[],fs,'centered');%%4x and 8x

[Pxx,F] = pwelch(complex_sig(1:end),512,[],[],fs,'centered');%%4x and 8x

if plotOn

figure; plot(F,10*log10((Pxx)),'b-'); grid on


if exist('title_str','var')

if ~isempty(title_str)





Please let me know if it is possible to resolve the issue to eliminating
the tone beyond 20 MHz bandwidth for 25 Msps sampling rate . I know with
bandwidth and sample rate being pretty close it might not be possible to
eliminate the tone or there might be aliasing effect . I did increase the
master clock but the highest I could go is 50 MHz. I need 25 Msps sample
rate and cannot change that.

Thanks and Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20170725/ae41e72d/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 10922 bytes
Desc: not available
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20170725/ae41e72d/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 6953 bytes
Desc: not available
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20170725/ae41e72d/attachment-0001.png>

More information about the USRP-users mailing list