Not receiving correct FSK modulated signal [N210 USRP]

4 views (last 30 days)
I have set up two N210 USRPs to transmit/receive simple FSK modulated signals. My code is very similar to the examples in the documentation (https://se.mathworks.com/help/supportpkg/usrpradio/ug/comm.sdrutransmitter-system-object.html and https://se.mathworks.com/help/supportpkg/usrpradio/ug/comm.sdrureceiver-system-object.html) but for the different modulation approach. The two USRPs are connected to two separate computers. One runs a script to repeatedly transmit my signal while the other runs a script to repeatedly scan for a received signal, which it then demodulates and returns to the user. Unfortunately, the received and demodulated signal does not resemble the transmitted signal at all.
I have experimented with different antennas, different gains and different centre frequencies.
What could possibly be causing this?
Transmitter code:
% Message
barkerCode = [1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0]';
message = ones(20, 1);
frame = [barkerCode; message];
% Modulation
H = comm.FSKModulator('ModulationOrder', 2);
messageIQ = H(frame);
% Transmitter
center_frequency = 434e6;
gain = 30;
radio = comm.SDRuTransmitter(...
'Platform', 'N200/N210/USRP2', ...
'IPAddress', '192.168.10.2', ...
'CenterFrequency', center_frequency, ...
'Gain', gain);
% Transmit
fprintf('Transmitting now...\n')
stop = 1000;
i = 0;
while i < stop
underrun = radio(messageIQ);
if (underrun ~= 0)
fprintf('Iteration: %i, underrun: %i\n', i, underrun);
end
i = i + 1;
end
fprintf('Done\n')
release(radio)
Receiver code:
% Radio
center_frequency = 434e6;
gain = 30;
radio = comm.SDRuReceiver(...
'Platform', 'N200/N210/USRP2', ...
'IPAddress', '192.168.10.2', ...
'CenterFrequency', center_frequency, ...
'Gain', gain);
% Demodulator
D = comm.FSKDemodulator('ModulationOrder', 2);
% Receive signal
len = 0;
while len == 0
[rcvdSignal, len] = step(radio);
demodSignal = D(rcvdSignal);
end
plot(debudSignal);

Answers (1)

Abhimenyu
Abhimenyu on 7 Jun 2024
Edited: Abhimenyu on 7 Jun 2024
Hi Aaron,
I could infer that you are experiencing an issue with the received and demodulated signal not resembling the transmitted signal. Please consider the below-mentioned causes and steps to resolve the issue:
1. Frequency Offset: USRP devices may have slight differences in their local oscillators, leading to a frequency offset between the transmitted and received signals. This can cause significant issues with demodulation. Please use a frequency offset correction algorithm like "PLL"(phase-locked loop) in the receiver code. Alternatively, calibrate the frequency of both USRPs to minimize the offset.
2. Timing Synchronization: The transmitted frame starts with a Barker code, which is good for synchronization, but the receiver doesn't seem to implement any synchronization mechanism. Without proper frame synchronization, the receiver might start demodulating at a random point in the received signal, leading to garbage output. Implementing frame detection based on the Barker code will help ensure that demodulation starts at the correct point.
3. Gain Settings: Incorrect gain settings can cause distortion in the received signal or make it too weak to be properly demodulated. Experiment with different gain settings for both the transmitter and receiver.
4. Sample Rate Mismatch: A mismatch in the sample rates between the transmitter and receiver can cause demodulation issues. Ensure that the sample rates of both the transmitter and receiver are identical. Please refer to the below given example MATLAB code that sets the properties of MasterClockRate, InterpolationFactor and DecimationFactor to handle timing synchronization and sample rate matching:
% Transmitter
center_frequency = 434e6;
gain = 30;
radio = comm.SDRuTransmitter(...
'Platform', 'N200/N210/USRP2', ...
'IPAddress', '192.168.10.2', ...
'CenterFrequency', center_frequency, ...
'Gain', gain, ...
'MasterClockRate', 1e6, ...
'InterpolationFactor', 500); % Adjust as needed
% Radio
center_frequency = 434e6;
gain = 30;
radio = comm.SDRuReceiver(...
'Platform', 'N200/N210/USRP2', ...
'IPAddress', '192.168.10.2', ...
'CenterFrequency', center_frequency, ...
'Gain', gain, ...
'MasterClockRate', 1e6, ...
'DecimationFactor', 500); % Adjust as needed
5. IQ Imbalance and DC Offset: IQ imbalance and DC offset can distort the transmitted signal, leading to demodulation errors. Use the built-in calibration tools provided by the USRP hardware to check for the imbalance.
6. Signal Processing Chain: There may be issues in the signal processing chain, such as filtering, windowing, or buffer sizes. Ensure that the entire signal processing chain is correctly implemented. The buffer sizes should match between the transmitter and receiver. Log intermediate signals at different stages of the transmission and reception chain to identify where the issue might be occurring.
I hope this will troubleshoot the issue!

Categories

Find more on Communications Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!