Author Topic: NanoVNA Custom Software  (Read 464943 times)

0 Members and 2 Guests are viewing this topic.

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2050 on: April 24, 2022, 02:02:24 pm »
Testing a tank at 350MHz, we can see the same step.  What is interesting is as I reduce the drive, the location of the steps narrows (move closer to the peak).   

***
I would show you this without the PC attached but I find it very difficult to scale what is on the screen.
« Last Edit: April 24, 2022, 02:04:56 pm by joeqsmith »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2051 on: April 24, 2022, 03:19:04 pm »
Showing a higher Q tank with the same resonance as the last one (yellow trace).   As we change the span from 100MHz down to 20MHz, we can clearly see the steps in the phase. 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2052 on: April 24, 2022, 03:46:05 pm »
Zooming into the step.   (Note, I changed the delay slightly to show it is not as some unique phase point).     
« Last Edit: April 24, 2022, 03:48:16 pm by joeqsmith »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2053 on: April 24, 2022, 05:15:05 pm »
The more I looked into it, it appeared to be tied to the fact it's a high Q rather than the frequency it is running it. 

Shown with a Q of around 40 at 225MHz.   

The second plot showing the exact same settings and same LC tank circuit.  I have removed the two protection diodes on the front end. 

Makes sense now.   

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #2054 on: April 24, 2022, 08:08:06 pm »
I think you see gain step. V2 models use fixed gain settings for various ranges. This not allow get good resolution.

My last firmware changes - add AGC mode.
Exist one problem - not possible get perfect results on switch step due nonlinearity OpAMP gain. On V2 you also have this errors but not visible (you can see this near 140MHz on V2 most big jump and on 100MHz on Lite).

On start i made gain calibration (you can see it on DMSG screen as GAIN0-GAIN3) on fixed frequency.

How big step you see? My results near 0.01 to 0.05dB i thin this not critical
« Last Edit: April 24, 2022, 08:11:57 pm by DiSlord »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2055 on: April 24, 2022, 11:39:04 pm »
>>How big step you see? My results near 0.01 to 0.05dB i thin this not critical

With last tank, 0.043 dB.  About  1 deg of phase error.  Of course -1/2pi*dP/dF..  That one degree phase step causes some pretty large spikes in the group delay.   I tend to agree.  Its a low cost unit and there's nothing really critical.  It's more just something to be aware of.   

I am still using the same firmware from Feb.  If you would like me to try a different version just post a link.     

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #2056 on: April 25, 2022, 04:21:43 am »
No, in this case you must see only amplitude sift (related to errors in gain), phase shift?

I for change AGC need time (near 4 IF periods), possible signal phase change in time? If you reduce IFBW phase shift change?
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2057 on: April 25, 2022, 01:15:23 pm »
No, in this case you must see only amplitude sift (related to errors in gain), phase shift?

I for change AGC need time (near 4 IF periods), possible signal phase change in time? If you reduce IFBW phase shift change?

The first post, I show the lite stand alone, zoomed in to show the phase shift.
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4134577/#msg4134577

Changing the IFBW from 4k to 400Hz has no effect other than taking longer to acquire. 

I posted a 3d plot showing how indeed the reported phase does change with time.  However, it's a simple LC tank circuit.  So the circuit it self it not changing to cause it.

Things that appear to have an effect:

Q
Loss in the loose coupling
Drive strength
Protection diodes

Offline ee1993

  • Newbie
  • Posts: 5
  • Country: us
Re: NanoVNA Custom Software
« Reply #2058 on: April 25, 2022, 06:35:47 pm »
Joe’s software is excellent for interactive bench work.  Can it be adapted to work as part of an automated test system?  I could probably use an autohotkey script to push buttons and save data files but a direct API or SCPI commands would be more versatile.

One possible use case would be to characterize an LC tuner design over a range of its possible LC combinations; It could then be used for load pull testing (without the VNA).  After setting each LC step, trigger the VNA to sweep and then store the S Parameters.  A typical autotuner can have up to ½ million possible combinations, so maybe take about 1000 streps.  For load pull, set perhaps an  8:1 VSWR and step phases through a full cycle.
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2059 on: April 25, 2022, 11:34:02 pm »
Joe’s software is excellent for interactive bench work.  Can it be adapted to work as part of an automated test system?  I could probably use an autohotkey script to push buttons and save data files but a direct API or SCPI commands would be more versatile.

One possible use case would be to characterize an LC tuner design over a range of its possible LC combinations; It could then be used for load pull testing (without the VNA).  After setting each LC step, trigger the VNA to sweep and then store the S Parameters.  A typical autotuner can have up to ½ million possible combinations, so maybe take about 1000 streps.  For load pull, set perhaps an  8:1 VSWR and step phases through a full cycle.

Seeing that it is written using software that was specifically developed for test automation, the answer is yes.  I've also demonstrated some experiments where I have integrated other peripherals with the software to automate some of my experiments, for example:
https://youtu.be/XaYBpPCo1qk?t=4251

That said, I am guessing the easiest route would be to start with one of the many open source programs and just tailor it to fit your requirements.  I would start by making sure that what ever low cost VNA you plan to use is capable of making your measurements.   

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2060 on: April 26, 2022, 11:26:05 pm »
Showing the raw real and imaginary int32 values of channel 1. 

Offline ee1993

  • Newbie
  • Posts: 5
  • Country: us
Re: NanoVNA Custom Software
« Reply #2061 on: April 27, 2022, 02:30:25 pm »
I prefer to program with LabView.  However, i can likely work with the VNA-qt Python source to expose some controls to LabView. 
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2062 on: April 27, 2022, 09:30:27 pm »
I prefer to program with LabView.  However, i can likely work with the VNA-qt Python source to expose some controls to LabView. 

Another option would be to just write your own custom application.  The interface is a simple serial port so really, not much effort there.   Dislord has provided us with a lot of details beyond the basics depending on what you are trying to do.  That was a big help for me.   

With the downfall of National Instruments,  you may want to consider something other than LabView, especially if you start from scratch.   

If you do get some sort of load pull working with the NanoVNA, please take the time post about it.   Maybe provide a link here.  I would be very interested in seeing what you come up with.

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2063 on: April 27, 2022, 10:30:27 pm »
Dislord,

After much more testing, I now believe this step is indeed a firmware problem.   I had looked at the signals with a scope and it just made no sense that removing the diodes would have anything to do with it but lowering the amplitude does.  I realized then that I had different firmware in the second unit.

I then upgraded the 2nd Lite to the same firmware and indeed the step shows up.  So both VNAs behave the same.   

As it turns out, the three released versions of firmware that I have from 220127 and older do not exhibit the step.    The version from 220225 does.  This was the last version I had downloaded.   

I had saved the Beta versions you had uploaded here as well.  The one from 220213 exhibits the step.  So does the one from 220211.   

So it appears what ever the problem is, it happened between Jan 27 and Feb 11.   Afraid I can't narrow it down any further for you.   Because you are unable to replicate the problem, if you have versions between these two that you would like me to try, just let me know. 

***
I noticed a new release 220228.  This version also exhibits the step problem.   
« Last Edit: April 28, 2022, 12:12:11 am by joeqsmith »
 

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #2064 on: April 28, 2022, 03:55:54 am »
You see gain step change. Older firmware use one gain setting for measure reflect data. Last use auto gain (depend from measured level).

And difficult question where is more correct measure. If use one gain settings you not see step, but error also present (you see smooth data)
Use AGC allow better measure low level signals on reflect.
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2065 on: April 28, 2022, 01:10:00 pm »
You see gain step change. Older firmware use one gain setting for measure reflect data. Last use auto gain (depend from measured level).

I suspect there may be a language problem.    Attached, I am looking at S21 transmitted data.    After installing firmware 220224,  I will see the step.   
  No calibration has been performed at this time.   The VNA will display the step as I have shown.   This step is not the reflected data.  Looking at the raw channel 0 integers, I do not see the step in the incident or reflected data.     

What is this gain setting you are referring to?   How do you calculate it?   What are you actually changing?  Output power of synthesizers based on frequency?   

And difficult question where is more correct measure. If use one gain settings you not see step, but error also present (you see smooth data)
Use AGC allow better measure low level signals on reflect.

Please explain this AGC algorithm in detail.  Again, what ever it is you are doing causes a problem when looking at the transmitted S21 data.   

When connected to the PC,  I expect the VNA to always send raw data. 

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #2066 on: April 28, 2022, 05:43:28 pm »
Before the signal is measured, it is amplified by an operational amplifier that has 4 gain levels.

If the level of the measured signal is low, the amplifier switches to a higher gain level. Later this is taken into account in the calculations. But it is rather difficult to connect all gain levels exactly, since the gain is not quite linear.

Using gain switching allows you to measure weak signals with higher resolution.
For example, without amplification, the signal has a level on an 8-bit ADC of 10 out of 2000, and using analog gain it can be raised to 1000 out of 2000
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2067 on: April 28, 2022, 06:12:12 pm »
That's helpful to know.   So the drive level remains constant.   

Is this done for all ADC measurements?   You mention the reflect but I assume it is for all measurements.   

How do you handle glitches in the data?   Do you have a fixed switch point and some level of hysteresis?   Seeing how the signal looked like it was bouncing between states, it looks like a hard switch point.   

Do you have a way that I can override the AGC with one of the debug registers?  Maybe an enable bit as well as manual control of the gain stage.   If so,  I would like to try running a few tests on it.

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #2068 on: April 28, 2022, 07:24:00 pm »
AGC use for reflect and thru measures. Forward use predefined constant level depend from frequency range (AGC not need, forward signal always constant)

Older firmware use limited AGC for thru measures

How i made it:
I measure min/max value in one IFBW period and if i see low signal i switch to more high gain level. If i see overflow i reduce gain. After restart measure. For apply correct gain i need only one period.

Older firmware made full measure and after this apply gain and restart (and only for thru measures).

How this calibrated (on all fw versions):
Used fixed frequency, and measure forward signal in all gain levels. After this data normalised to 0 level.
you can see it in CONFIG->DMSG as GAIN0 to 3

You can manual control gain level by:
0xE8 - reference gain
0xE9 - Reflect gain
0xEA - Thru gain

0 to 3 used this value, 4 use AGC
!! you can get overflow if use high gain settings
« Last Edit: April 28, 2022, 07:28:35 pm by DiSlord »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2069 on: April 28, 2022, 07:30:12 pm »
If I set these registers, how do I tell your firmware not to change them?   If there a way to turn off the AGC algorithm?

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #2070 on: April 28, 2022, 07:58:50 pm »
>0 to 3 used this value, 4 use AGC

Set 0 to 3 for thru data (0xEA) and you can see changes in noise level.
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2071 on: April 28, 2022, 08:07:40 pm »
Could you provide gain values?

Setting a value of:
0  Av=?
1  Av=?
2  Av=?
3  Av=?
4 = AGC enabled


Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #2072 on: April 28, 2022, 08:21:52 pm »
This depend from hardware, you can see it in CONGIG->DMSG screen as GAIN0 to GAIN3

Not need recalculate, device do it by self in any case.
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11747
  • Country: us
Re: NanoVNA Custom Software
« Reply #2073 on: April 28, 2022, 08:31:13 pm »
So there are different revisions of the Lite hardware with different gains?   There is some sort of diagnostic menu that displays these gain values? 

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #2074 on: April 28, 2022, 08:45:35 pm »
No all Lite have ¬equal gain settings. Difference only from the accuracy of the components used (resistors and capasitors)

Go to CONGIG->DMSG menu (i write this 3 times)
BBGAIN0 to 3 gain levels
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf