To this end, I am transmitting and receiving at the same time. I am working at 2e6 samples per second.
In order to do this, I have an octave script that makes a frequency sweep file (complex frequency).
It also sets up the bladeRF, then calls a script that starts receiving, then starts transmitting. I set the board to receive for twice as many samples as to transmit, so that I get the whole transmission.
The problem is that the received signal has a funny looking envelope that is not flat. In addition, it is randomly one of two non-flat envelopes. I have attached screen shots of Octave plots of the real parts of the time waveforms (not spectra). I am not using the loop-back mode, but am connecting rx to tx through a home-made attenuator.
Here is the Octave file:
Code: Select all
%
% based on a file from https://github.com/Nuand/bladeRF/wiki/bladeRF-CLI-Tips-and-Tricks
% modified
%
SAMPLE_RATE = 2e6;
NUM_SAMPLES = 131072; % for tx, not rx
NUM_SECONDS = NUM_SAMPLES/SAMPLE_RATE;
START_FREQ_RAD = -0.9e6 * 2 * pi; % it will be a complex frequency
STOP_FREQ_RAD = 0.9e6 * 2 * pi;
f_axis = linspace(-0.5 * SAMPLE_RATE, 0.5 * SAMPLE_RATE, NUM_SAMPLES);
DELTA= (1/2)*(STOP_FREQ_RAD - START_FREQ_RAD)/NUM_SECONDS;
t = [ 0 : (1/SAMPLE_RATE) : ((NUM_SECONDS) - 1/SAMPLE_RATE) ];
tx_signal = 0.90 * exp(1j .* (START_FREQ_RAD+DELTA.*t) .* t);
save_sc16q11('/media/ramdisk/tx_waveform.sc16q11', tx_signal);
% set up the bladeRF with a bunch of system command line calls
system(["bladeRF-cli -e 'set samplerate rx ",num2str(SAMPLE_RATE),"'"]);
system(["bladeRF-cli -e 'set bandwidth rx ",num2str(SAMPLE_RATE),"'"]);
system(["bladeRF-cli -e 'set bandwidth tx ",num2str(SAMPLE_RATE),"'"]);
system(["bladeRF-cli -e 'set samplerate tx ",num2str(SAMPLE_RATE),"'"]);
system(["bladeRF-cli -e 'set lnagain 0'"]);
system(["bladeRF-cli -e 'set rxvga1 30'"]);
system(["bladeRF-cli -e 'set rxvga2 30'"]);
system(["bladeRF-cli -e 'set txvga1 -4'"]);
system(["bladeRF-cli -e 'set txvga2 25'"]);
system(["bladeRF-cli -e 'tx config delay=0'"]);
result=[]; % for when I do many in a row
freq_result=[];
freq_list=[1000e6]; % just one for now.
%%% now for the loop
for f=freq_list
% set the transmit and receive frequencies
system(["bladeRF-cli -e 'set frequency rx ",num2str(f),"'"]);
system(["bladeRF-cli -e 'set frequency tx ",num2str(f),"'"]);
system("bladeRF-cli -s script_D_1.txt"); % see below for contents of script_D_1.txt
f = fopen("/media/ramdisk/rx_sample", "r", "ieee-le");
samples = fread(f, Inf, "int16");
fclose(f);
samples_i = samples(1:2:end, :);
samples_q = samples(2:2:end, :);
rx_signal = samples_i + j * samples_q;
spectrum=20*log10(abs(fftshift(fft(rx_signal)))/NUM_SAMPLES);
%freq_result=[freq_result f_axis(s1:s2)];
result=[result spectrum'];
%pause(10);
endfor
plot(real(rx_signal)); % not the spectrum
% script file script_D_1.txt is as follows:
%
% tx config delay=0
% tx config file=/media/ramdisk/tx_waveform.sc16q11 format=bin
% rx config file=/media/ramdisk/rx_sample n=262144
% tx config repeat=1
% rx start
% tx start
% tx wait
% rx wait
%
Code: Select all
tx config delay=0
tx config file=/media/ramdisk/tx_waveform.sc16q11 format=bin
rx config file=/media/ramdisk/rx_sample n=262144
tx config repeat=1
rx start
tx start
tx wait
rx wait
I do think that I have the latest version of everything, as shown below:
bladeRF> info
Serial #: ffc7ad36f80a326e49f7921529a3669a
VCTCXO DAC calibration: 0xa104
FPGA size: 40 KLE
FPGA loaded: yes
USB bus: 4
USB address: 2
USB speed: SuperSpeed
Backend: libusb
Instance: 0
bladeRF> version
bladeRF-cli version: 1.2.0-git-067bd41
libbladeRF version: 1.4.0-git-067bd41
Firmware version: 1.8.0
FPGA version: 0.3.3