I'm trying to understand why a waveform uploaded to the Pluto's internal memory and then transmitted continuously would result in a received waveform with an apparent arbitrary phase shift.
Below is a Matlab plot showing the transmitted waveform using the transmitRepeat() function and the resulting received waveform. The waveform simply consists of two CW tones at 10 and 20 KHz summed together. It appears as though the received waveform is correct, but that a phase shift was added to one of the tones.
Matlab code I used to configure the radio and generate the figure above is shown below
% Clear Environment
clear all;
clc;
% Set Properties
CarrierFreq = 1e9; % 1 GHz
samples = 10e3; % Number of total samples
fs = 1e6; % 1 Msps
f1 = 10e3; % 10 KHz tone
f2 = 20e3; % 20 KHz tone
% Define Timebase
t = 0:1/fs:1/fs*(samples-1);
% Build a complex waveform from two CW tones
cw1 = (0.1 * (cos(2*pi*f1*t) - j*sin(2*pi*f1*t)))';
cw2 = (0.1 * (cos(2*pi*f2*t) - j*sin(2*pi*f2*t)))';
tx_waveform = cw1 + cw2;
% Initialize SDR
sdrdev('Pluto');
% Initialize SDR Receiver Functionality
radio_rx = sdrrx('Pluto',...
'RadioID', 'usb:0',...
'CenterFrequency', CarrierFreq,...
'BasebandSampleRate', fs,...
'GainSource', 'Manual',...
'Gain', 10,...
'OutputDataType', 'double',...
'SamplesPerFrame', samples);
% Initialize SDR Transmit Functionality
radio_tx = sdrtx('Pluto',...
'RadioID', ' usb:0',...
'CenterFrequency', CarrierFreq,...
'BasebandSampleRate', fs,...
'Gain', -10);
% Trigger transmit of on device stored waveform
transmitRepeat(radio_tx,tx_waveform);
% Command Window feedback
disp('Radio Transmitting')
% ---- RUN LOOP ----
% Create Figure
figure
runtime = tic;
while toc(runtime) < 60 % run for 1 minute
% Receive Radio Samples
rx_waveform = radio_rx();
% Plot snippet of TX and RX waveform
subplot(1,2,1)
plot(real(tx_waveform(2000:2500)))
ylabel('real(IQ) value');
xlabel('real(IQ) sample');
title('Transmitted Waveform')
subplot(1,2,2)
plot(real(rx_waveform(2000:2500)))
xlabel('real(IQ) sample');
ylabel('real(IQ) value');
title('Received Waveform')
% Wait 1 second
pause(1);
end
% ------------------
% Release Pluto resources and exit
release(radio_tx);
release(radio_rx);
disp('Done');
return;
Test Setup:
- I've tested this in two configurations. First with direct loop back with the supplied coax cable hooking up TX to RX directly on the Pluto. Second, I've run the TX through a splitter with one output going directly back to the Pluto RX port, and the other going into a spectrum analyzer. The spectrum analyzer shows two steady tones, but I can't tell if the phase shift is present or not.
Questions
- If I'm literally copying the same sample used to generate the Matlab plot into the Pluto's memory to generate the waveform, how could a phase shift be introduced? I can understand if the amplitude would be different, or if there was added noise, but I can't explain this.
Attachments
- 'testScript.m" - A simple matlab script demonstrating this. Hook up the Pluto to a computer and connect a coax between the TX and RX port. The script will run for approximately 1 minute and the received waveform will update at about once a second and you'll (presumably) see the same thing in the picture above.
I appreciate any feedback or suggestions you may have. Thank You,
Marcus