Wifi signal generator and analyzer application

I would like to propose a demo project that using LimeSDR to generate and analyze the WLAN signal.

I have Matlab code that can generate TX IQ waveforms and analyze the RX IQ waveforms (including: Transmit Spectrum MASK test, EVM, Transmit Center Frequency Tolerance, Spectral Flatness, etc. currently my code support 802.11n, HT-MF 20MHz signal).

My initial step is to use LimeSDR as TX sink and RX source, and incorporates LimeSDR into my matlab. And if the performance is good, we can use LimeSDR as can WLAN tester instrument.

Any suggestions or advices or foreseeable issues are welcome! Thanks.

4 Likes

Very cool! Look forward to seeing a video of this on Youtube :slight_smile:

I had a very similar idea and goal in mind when I purchased the LimeSDR. I had started to do some work in Pothos to get familar with moving data around. But did not get very far, before getting distracted on something else. If you are looking for some collaboration, I would be willing to assist. I am a hardware engineer by trade, and work in this arena. So I have access to WLAN test generators and Analyzers that I can use to verify the operation of this project.

Thanks~ My major platform is Matlab, not sure if you can use the same platform.
Currently, I am working on the interface/driver to Matlab for LimeSDR. My concern is how fast the data transfer speed can be? we need to have at least 20MSPS (complex samples) for 802.11n. From my experience with USRP device, the data speed in Windows is less than that in Linux. I am not sure if LimeSDR can reach that speed without any overflow or underflow.

I do not have access to MatLab. I could use Octave, it looks like there is support and some examples for the LimeSDR. It may limit what I can do depending on what ToolBoxes you have used in your code. I will have to get my LimeSDR out and setup again and get it playing with Octave. I had a Pothos project that was bringing the sampled data into the PC and displaying the WLAN spectrum. I am not sure how fast the transfer across the USB was actually running? I can check that out and see if I can get a quick answer. There was a post where Lime was able to get 387Mbyte/s across the interface. So that should be fast enough.

I’ve ran Windows applications such as Gqrx and SDR Console at 20M sample rate.

I use the WLAN system toolbox. Does Octave support the matlab toolbox?

I tested the matlab LimeSDR driver (https://github.com/jocover/Simulink-MATLAB-LimeSDR) in MATLAB 2017b on Win7 x64. It functionally works but has some issues. These are what I found:

  1. If LO is set to 2450MHz, the received samples become a real vector rather than complex one. I am not sure if my code is OK so I attached it.

  2. It seems the matlab driver interface does not provide overflow/underflow indication. I cannot judge whether the waveform is successfully transfered between LimeSDR and host PC.

  3. As an workaround solution to issue 2, I use a CW signal transmitted from signal generator to LimeSDR, and calculate the phase difference between samples, It should be as expected according the the CW frequency, LO frequency, and the sample rate.
    As an example, I set the LO to 1GHz, CW to 1.001111GHz, 20MHz sample rate. The phase difference should be around 20 degrees. You can see from the below figure (3rd line) it is as expected.


    When I set the CW to 1.002222GHz, 40MHz sample rate. The phase difference should still be around 20 degrees. However, the phase difference begin to “jump”. And If I set to 50MSPS, the phase jump is more obvious.

40MSPS

50MSPS

test m-file

% (1) Open a device handle:
dev = limeSDR(); % Open device

% (2) Setup device parameters. These may be changed while the device
%     is actively streaming.
dev.rx0.frequency  = 1000e6;    % when set to 2450e6, samples are real, not complex.
dev.rx0.samplerate = 40e6;      % when set to 40e6, 50e6, overflow may occur.
dev.rx0.gain = 60;
dev.rx0.antenna = 1;

% (3) Enable stream parameters. These may NOT be changed while the device
%     is streaming.
dev.rx0.enable;

% (4) Start the module
dev.start();

% (5) Receive samples on RX0 channel
Duration = 1e-3;    % in second.
numSample = ceil(Duration*dev.rx0.samplerate);
for idxLoop = 1:10
    samples = dev.receive(numSample,0);
%     samples(100) = [];    % manually make some overflow
    plotWaveform(samples, dev.rx0.samplerate)
end

%   (6) Cleanup and shutdown by stopping the RX stream and having MATLAB
%       delete the handle object.
dev.stop();
clear dev;

return

function [] = plotWaveform(waveform, SampleRate)
% time domain waveform
figure(1000)
subplot(211)
plot((0:length(waveform)-1), real(waveform));
xlabel('Time (point)')
ylabel('Real part')
title('Time Domain')
subplot(212)
plot((0:length(waveform)-1), imag(waveform));
xlabel('Time (point)')
ylabel('Image part')

% amplitude-phase domain
figure(1100)
subplot(311)
plot((0:length(waveform)-1), abs(waveform));
xlabel('Time (point)')
ylabel('Amplitude')
title('Amplitude-Phase Domain')
subplot(312)
phaseDegree = rad2deg(phase(waveform));
plot((0:length(waveform)-1), phaseDegree);
ylabel('Phase (degree)')
subplot(313)
phaseDiff = phaseDegree(2:end) - phaseDegree(1:end-1);
meanPhaseDiff = mean(phaseDiff);
stdPhaseDiff = std(phaseDiff);
rangePhaseDiff = max(phaseDiff)-min(phaseDiff);
plot((0:length(waveform)-2), phaseDiff);
xlabel('Time (point)')
str = sprintf('Mean=%.1f, STD=%.2f, Range=%.1 degree',meanPhaseDiff, stdPhaseDiff, rangePhaseDiff);
title(str)
ylabel('Phase difference (degree)')
if rangePhaseDiff>30
    warning('Phase jump!'); 
end


% constellation
figure(1200)
plot(complex(waveform));
xlabel('I-phase')
ylabel('Q-phase')
title('Constellation')

% freq domain waveform
figure(1300)
NumSample = length(waveform);
FullScale = 1;
plot((0:NumSample-1)*SampleRate/NumSample, mag2db(abs((fft(waveform/NumSample/FullScale)))) )
xlabel('Freq (Hz)')
ylabel('Amplitude (dBFS)')
title('Freq Domain')
end

You could try pinging @jocover here or logging an issue on the GitHub tracker.

If you were interested in trying Octave it might be worth a look at the LimeSDR Workshop examples.

Yes, I have submit the issue but no response yet.

As a workaround, I set the LO to 1G and tested my wlan signal generator and analyzer, it works fine. However, this blocks my analyzer to get the “real” Wifi signal that generated from commercial AP.

My WiFi signal generator demo. Analyzer is coming soon. pls stay tuned. :slight_smile:

1 Like

Hi,

WiFi PHY Signal Analyzer (802.11n) demo using LimeSDR with Matlab platform.

3 Likes