# Wifi signal generator and analyzer application

**URL:** <https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227>\
**Category:** RAN Forum\
**Created:** [11 January 2018 02:36 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227 "2018-01-11T02:36:55Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Collus](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@Collus](https://discourse.myriadrf.org/u/Collus)\
**Post date:** [11 January 2018 02:36 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/1 "2018-01-11T02:36:55Z")

</div>

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).

 ![963768914](https://yyz2.discourse-cdn.com/flex034/uploads/myriadrf/original/2X/8/873f12336ac4ad767dc355869907dcddfdc2d9ab.jpg)

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.

---

<div class="post-metadata">

**Author:** ![andrewback](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@andrewback](https://discourse.myriadrf.org/u/andrewback)\
**Post date:** [11 January 2018 07:30 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/2 "2018-01-11T07:30:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aoldenburg](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@aoldenburg](https://discourse.myriadrf.org/u/aoldenburg)\
**Post date:** [12 January 2018 14:34 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/3 "2018-01-12T14:34:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Collus](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@Collus](https://discourse.myriadrf.org/u/Collus)\
**Post date:** [16 January 2018 01:40 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/4 "2018-01-16T01:40:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![aoldenburg](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@aoldenburg](https://discourse.myriadrf.org/u/aoldenburg)\
**Post date:** [20 January 2018 00:23 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/5 "2018-01-20T00:23:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![andrewback](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@andrewback](https://discourse.myriadrf.org/u/andrewback)\
**Post date:** [20 January 2018 07:29 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/6 "2018-01-20T07:29:21Z")

</div>

> [@Collus](#):
>
> we need to have at least 20MSPS

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

---

<div class="post-metadata">

**Author:** ![Collus](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@Collus](https://discourse.myriadrf.org/u/Collus)\
**Post date:** [20 January 2018 07:59 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/7 "2018-01-20T07:59:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Collus](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@Collus](https://discourse.myriadrf.org/u/Collus)\
**Post date:** [20 January 2018 08:09 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/8 "2018-01-20T08:09:23Z")

</div>

I tested the matlab LimeSDR driver ([GitHub - jocover/Simulink-MATLAB-LimeSDR: Simulink blockset and MATLAB functions to interface with LimeSDR](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.  

40MSPS

 ![40MSPS](https://yyz2.discourse-cdn.com/flex034/uploads/myriadrf/original/2X/0/08748a914567e37c768af0d3992ffaca55f49166.PNG)

50MSPS

 ![50MSPS](https://yyz2.discourse-cdn.com/flex034/uploads/myriadrf/original/2X/1/17b0b4884ded3c2b501691030db9568fc9b9eda7.PNG)

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

```

---

<div class="post-metadata">

**Author:** ![andrewback](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@andrewback](https://discourse.myriadrf.org/u/andrewback)\
**Post date:** [21 January 2018 14:14 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/9 "2018-01-21T14:14:14Z")

</div>

> [@Collus](#):
>
> It functionally works but has some issues. These are what I found:

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.

> **[GitHub - myriadrf/LimeSDR\_Workshop: Intro to software-defined radio with...](https://github.com/myriadrf/LimeSDR_Workshop)**
>
> Intro to software-defined radio with LimeSDR workshop - myriadrf/LimeSDR\_Workshop

---

<div class="post-metadata">

**Author:** ![Collus](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@Collus](https://discourse.myriadrf.org/u/Collus)\
**Post date:** [22 January 2018 03:32 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/10 "2018-01-22T03:32:12Z")

</div>

> [@andrewback](#):
>
> You could try pinging @jocover here or logging an issue on the GitHub tracker.

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.

---

<div class="post-metadata">

**Author:** ![Collus](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@Collus](https://discourse.myriadrf.org/u/Collus)\
**Post date:** [27 January 2018 08:23 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/11 "2018-01-27T08:23:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Collus](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@Collus](https://discourse.myriadrf.org/u/Collus)\
**Post date:** [30 January 2018 09:06 UTC](https://discourse.myriadrf.org/t/wifi-signal-generator-and-analyzer-application/2227/12 "2018-01-30T09:06:58Z")

</div>

Hi,

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