EEVblog Electronics Community Forum

Electronics => RF, Microwave, Ham Radio => Topic started by: joeqsmith on July 22, 2019, 11:54:25 am

Title: NanoVNA Custom Software
Post by: joeqsmith on July 22, 2019, 11:54:25 am
Table of Contents

For those unable to use the search, the following links should help guide you


Installing the software:
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4037716/#msg4037716 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4037716/#msg4037716)
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4041214/#msg4041214 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4041214/#msg4041214)
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4055866/#msg4055866 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4055866/#msg4055866)


Software not finding the lvsound2.dll:
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4095544/#msg4095544 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4095544/#msg4095544)

Adding a Transfer Relay:
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4058836/#msg4058836 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4058836/#msg4058836)
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4060027/#msg4060027 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4060027/#msg4060027)
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4060045/#msg4060045 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4060045/#msg4060045)


Running the software on high resolution monitors (resize):
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3617154/?topicseen#msg3617154 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3617154/?topicseen#msg3617154)
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3813608/?topicseen#msg3813608 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3813608/?topicseen#msg3813608)
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3621361/?topicseen#msg3621361 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3621361/?topicseen#msg3621361)
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3616560/?topicseen#msg3616560 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3616560/?topicseen#msg3616560)
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4038201/#msg4038201 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4038201/#msg4038201)

cyp_eev's  non-contact Q measurement test fixture:
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4132957/#msg4132957 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg4132957/#msg4132957)


******************  The beginning  **************************

Is there a document that describes the communications for the NanoVNA?   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on July 23, 2019, 05:22:02 pm
I have started working on the communications and have a simple Smith chart now working.     
Title: Re: NanoVNA Custom Software
Post by: 0xdeadbeef on July 23, 2019, 05:37:33 pm
Hm, there is the official GitHub repository which should allow at least reverse engineering:
https://github.com/ttrftech/NanoVNA
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on July 23, 2019, 10:12:55 pm
It's never a good sign when you have to reverse engineer something.  Someone had started a list of commands and someone else posted the BAUD.  It's easier for me to just sniff it.   All seems fairly basic so far.     
Title: Re: NanoVNA Custom Software
Post by: 0xdeadbeef on July 23, 2019, 10:51:48 pm
Isn't sniffing another way of reverse engineering? Anyway, all the communication commands seem to be implemented in main.c (array "commands"). So that might have been worth a look.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on July 23, 2019, 11:48:41 pm
Isn't sniffing another way of reverse engineering? Anyway, all the communication commands seem to be implemented in main.c (array "commands"). So that might have been worth a look.

You bet it is.  Did I post something otherwise?   Ideally, it would have been documented.  Of course, you could say the code "IS" the document. 
Title: Re: NanoVNA Custom Software
Post by: syau on July 23, 2019, 11:55:17 pm
Another alternative is groups.io

https://groups.io/g/nanovna-users

support by a seller who sell nanovna in aliexpress.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on July 24, 2019, 12:13:19 am
I signed up before it arrived.  This is where the few people posted the list of commands and BAUD rate.   I've been asking them a few questions as I go.  So far things are pretty intuitive.  I was a bit concerned when I saw them use the third harmonic for anything above 300MHz but the group claims it's normal.  Bug wise, it's the only real problem I have seen so far beyond the cheap rocker switch.  I would like to replace it with something better but the touchscreen handles most of it. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on July 25, 2019, 02:09:12 am
Made some progress.   There's a 100pF capacitor attached.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on July 27, 2019, 10:56:32 pm
I made an attempt to get the S21 working but ran into a snag sorting out channel 1.  I took a step away from it for a few days and will have another look.  A couple of paragraphs of detailed documentation would have gone a long way to help this project. 

Most of the channel 0 measurements are now sorted out.  The plan will be to have the graph change modes so the SWR will eventually be shown on the main graph in place of the Smith chart.   

Shown for the most part with a bad SOLT using a 200ohm resistor. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on July 28, 2019, 01:29:27 am
Walking away for a while helped.  Both channels are now sorted out.  Next step is to add the remaining cursor readouts, finish up the graphs and add the ability to store some references. 

Shown looking at a Showa crystal filter.
Title: Re: NanoVNA Custom Software
Post by: KC3EKL on July 28, 2019, 02:18:27 am
Are you going available? I am a bit unsatisfied with the VNA Sharp but lack the skills to write anything better myself.
73, KC3EKL Curtis
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on July 28, 2019, 03:34:09 am
I havn't thought about it.   The reason I started working on it is because the included software wouldn't work.  The cursor readouts would be blank or flash.   It just wasn't usable.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on July 29, 2019, 12:21:19 am
Short demo showing the current status of my LabView interface for the NanoVNA.   

https://www.youtube.com/watch?v=DDvHN2v1gTg (https://www.youtube.com/watch?v=DDvHN2v1gTg)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on July 30, 2019, 01:27:38 am
The software is almost good enough.  I finally added the return loss readout plus support for a couple of storage references and a few other features.  It needs a few more features and I may restructure the communications before wrapping it up.  It's getting close.   

I plan to make some sort of video on the NanoVNA.  Not so much a review but more of a demo showing the basics of how to use it.  I don't plan to dive into all the math or make it too detailed at this point.   If there is anything you want to see, feel free to ask.     I doubt I will get to it until next weekend so there is plenty of time. 
Title: Re: NanoVNA Custom Software
Post by: hagster on July 30, 2019, 09:06:09 pm
Any video would be interesting. Thinking about getting one of these myself. Does it require a LabVIEW licence to run your custom software¿
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on July 30, 2019, 09:08:57 pm
It would be an EXE just like any other program, no license required.
Title: Re: NanoVNA Custom Software
Post by: hagster on July 30, 2019, 09:15:13 pm
Great news
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 01, 2019, 12:19:22 am
Ended up restructuring my software and now have a decent platform to build on.   The original design was a single process where it now has three.  Breaking up the code makes it a lot more flexible. 

With the software now working, I'll start working on the video this weekend as planned.   My goal is to make some sort of beginners guide on how to use it to make some practical measurements.     
Title: Re: NanoVNA Custom Software
Post by: TheSteve on August 01, 2019, 03:45:43 am
I'm kind of tempted to buy one just to see how it compares to my Keysight VNA's. It is much more tempting if there will be good software to use with it.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 01, 2019, 11:53:43 am
I'm kind of tempted to buy one just to see how it compares to my Keysight VNA's. It is much more tempting if there will be good software to use with it.

What don't you like about the included software?
Title: Re: NanoVNA Custom Software
Post by: Theboel on August 01, 2019, 01:02:58 pm
Just curious can the graph show one by one.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 01, 2019, 01:11:43 pm
Just curious can the graph show one by one.

What do you mean by showing one by one?  Are you asking about my software, or what's included with the VNA? 
Title: Re: NanoVNA Custom Software
Post by: Theboel on August 01, 2019, 02:47:47 pm
Just curious can the graph show one by one.

What do you mean by showing one by one?  Are you asking about my software, or what's included with the VNA?

yes its about Your software.
can we choose to show one big graph like only the smith chart alone ?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 01, 2019, 03:42:58 pm
Just curious can the graph show one by one.

What do you mean by showing one by one?  Are you asking about my software, or what's included with the VNA?

yes its about Your software.
can we choose to show one big graph like only the smith chart alone ?

I am still not sure what you are asking.   If you watched the above video, you can see how it cycles through the different retangular, Smith and polar plots.  If you want to know if I support displaying retangular and Smith chart on a single graph, then the answer is I do not.   I just don't have a need for it.    If you are asking if I can make the Smith chart take up the full screen with nothing else displayed,  currently the graphs size and location are fixed.   The three plots on the right will be moved to a separate page or I may remove them all together.   
Title: Re: NanoVNA Custom Software
Post by: nali on August 01, 2019, 04:32:57 pm
What don't you like about the included software?

I've just bought one to have a bit of a tinker. The s/w I have is OKish, probably the only gripe I have is the Smith chart is a bit fuzzy. It's just a grey-on-white bitmap and the resolution's not that great.

Yours is looking pretty neat Joe  :-+
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 01, 2019, 04:43:10 pm
Nali,   I am curious now that you have yours working, when you look at the Smith chart, as you have it shown, do the cursor readouts work?  Do they go blank, flash?  Can you even use them?   

If they work correctly,  what OS are you using?  Version?  Service packs?  Video card?   

If that one feature worked, I wouldn't have gone down this path. 
Title: Re: NanoVNA Custom Software
Post by: nali on August 01, 2019, 05:23:14 pm
Yes they do work, they come up as a floating "hint box". They do flash, it looks like if the cursor moves just by a pixel then the whole box is redrawn. E.g. the screen shot snippet is from a 10MHz sweep centered on 433MHz, with a rubber duckie whip directly on port 0.

This is on W10 x64 build 1903 with AMD Radeon HD-7700 & I7-4770K CPU. If it helps, the exe file is timestamped 26/4/2019 (sorry 04/26/2019 to you!) 04:14 AM and 154624 BYTES

EDIT: I think this is the link to the software download as far as I remember (I normally download things like this in incognito to avoid cookies so it's not in my browser history)

http://myosuploads3.banggood.com/products/20190527/20190527043616NanoVNA.rar (http://myosuploads3.banggood.com/products/20190527/20190527043616NanoVNA.rar)


HTH  :)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 01, 2019, 06:32:14 pm
I looked at the date but I think it's when it was download and unpacked.  There isn't a version in the About page as you would normally find in a released program. 

With mine, I can't get the box to stop flashing.  Sometimes the thing will just go blank.   It's impossible to read the values being displayed.   I plan to show it as part of my demo. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 01, 2019, 06:37:35 pm
I downloaded the one from your link and unpacked it.  It has a different size than the one I tried to use.  Your's does appear to be older, but may actually work.  I'll give it a try and let you know.

Thanks for checking.

****

Upper left corner, v1.01 vs 1.03.   The new one has an about page, where yours doesn't.    I didn't spend much time looking at it.  As soon as I saw the cursors did not work, I set it aside and started working on my own.   
Title: Re: NanoVNA Custom Software
Post by: 0xdeadbeef on August 01, 2019, 07:02:17 pm
I don't want to pretend to have more than a minimum knowledge about high frequency design but in some group about the EU1KY analyzer (aka Mini600/Mini1300), it was discussed that the resistive bridge of the nanoVNA would limit its ability to measure Z > 1000Ohm and result in unstable measurements around 50Ohm while the bridge with a Balun in the EU1KY would allow much better accuracy in the 0..2000Ohm range.
So while I appreciate the effort put into an optimized PC program, I wonder if this is really worth it if the measurements are not very precise anyway`
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 01, 2019, 07:14:49 pm
I don't want to pretend to have more than a minimum knowledge about high frequency design but in some group about the EU1KY analyzer (aka Mini600/Mini1300), it was discussed that the resistive bridge of the nanoVNA would limit its ability to measure Z > 1000Ohm and result in unstable measurements around 50Ohm while the bridge with a Balun in the EU1KY would allow much better accuracy in the 0..2000Ohm range.
So while I appreciate the effort put into an optimized PC program, I wonder if this is really worth it if the measurements are not very precise anyway`

You don't need to be too concerned with how I spend my personal time.   That said, I am very sensitive to how much time I am willing to put into this project as I have no plan of actually using it.   As you can see, I have not been working on it for months.  It's only been a few days.   This is the main reason I use LabView.   
Title: Re: NanoVNA Custom Software
Post by: Theboel on August 01, 2019, 11:54:27 pm
Just curious can the graph show one by one.

What do you mean by showing one by one?  Are you asking about my software, or what's included with the VNA?

yes its about Your software.
can we choose to show one big graph like only the smith chart alone ?

I am still not sure what you are asking.   If you watched the above video, you can see how it cycles through the different retangular, Smith and polar plots.  If you want to know if I support displaying retangular and Smith chart on a single graph, then the answer is I do not.   I just don't have a need for it.    If you are asking if I can make the Smith chart take up the full screen with nothing else displayed,  currently the graphs size and location are fixed.   The three plots on the right will be moved to a separate page or I may remove them all together.   

Sorry if my Java-English made You confuse, The Nali screenshot is exactly what I mean
(https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/?action=dlattach;attach=800451 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/?action=dlattach;attach=800451))   
some times only display one graph a time can help if You using a small screen like in laptop but if You dont need or like, its no problem I can live with it.
btw the real designer of nanoVNA made some update in the github I know nothing about what its done maybe You can take a look
https://github.com/flyoob/NanoVNA-F (https://github.com/flyoob/NanoVNA-F)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 02, 2019, 12:17:57 am
Just curious can the graph show one by one.

What do you mean by showing one by one?  Are you asking about my software, or what's included with the VNA?

yes its about Your software.
can we choose to show one big graph like only the smith chart alone ?

I am still not sure what you are asking.   If you watched the above video, you can see how it cycles through the different retangular, Smith and polar plots.  If you want to know if I support displaying retangular and Smith chart on a single graph, then the answer is I do not.   I just don't have a need for it.    If you are asking if I can make the Smith chart take up the full screen with nothing else displayed,  currently the graphs size and location are fixed.   The three plots on the right will be moved to a separate page or I may remove them all together.   

Sorry if my Java-English made You confuse, The Nali screenshot is exactly what I mean
(https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/?action=dlattach;attach=800451 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/?action=dlattach;attach=800451))   
some times only display one graph a time can help if You using a small screen like in laptop but if You dont need or like, its no problem I can live with it.
btw the real designer of nanoVNA made some update in the github I know nothing about what its done maybe You can take a look
https://github.com/flyoob/NanoVNA-F (https://github.com/flyoob/NanoVNA-F)

Oh, you were wondering if it would fit on a small screen or not.   I havn't been paying attention to the size of the graphics and if it would run on my 8" tablet or not.   My guess is it's close the way it is now.     

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 02, 2019, 01:11:08 am
I tried the older version of the software and have the same effect.  Without moving the cursor, the impedance will flash quickly making it next to impossible to use.   I will show both versions in the demo video. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 02, 2019, 10:36:15 am
I tried both versions of software on my Laptop.  Windows 7 64-bit i7 gen 1 vs 10 64-bit xeon e5-1650 on the desktop.   Both nvidia controllers.  Old laptop flickers badly but I can see the readout.  Beware of epilepsy seizures.   :-DD  Like the desktop, it flickers if data collection is turned off and the mouse is stable. 
Title: Re: NanoVNA Custom Software
Post by: malagas_on_fire on August 02, 2019, 10:44:38 am
Sorry to post but did you tried to change Windows version compatibility for another version eg windows xp?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 04, 2019, 04:15:59 pm
The NanoVNA.

https://www.youtube.com/watch?v=mKi6s3WvBAM (https://www.youtube.com/watch?v=mKi6s3WvBAM)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 06, 2019, 01:32:24 am
Measuring antenna resonance and SWR
https://www.youtube.com/watch?v=_drx7ORUDWI (https://www.youtube.com/watch?v=_drx7ORUDWI)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 07, 2019, 02:04:27 am
Requested plots show fundamental and harmonics at 1MHz and 350MHz CW.  Note above 300MHz, uses 3rd harmonic.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on August 07, 2019, 03:17:40 am
joeqsmith, there are at least 3 versions of nanoVNA with different pcb layout on aliexpress:
https://github.com/hugen79/nanovna_900

Which one you're using exactly?
Title: Re: NanoVNA Custom Software
Post by: bitseeker on August 07, 2019, 05:59:17 am
Thanks for pointing that out. I noticed black vs. white, but didn't realize that there were two different black ones. The "bad" one doesn't appear to have any shielding in the listing photos.
Title: Re: NanoVNA Custom Software
Post by: Bicurico on August 07, 2019, 08:46:51 am
Just to get this thread on my list...

Got me a NanoVNA, too. Have not really used it, yet, as I need to better understand what it actually does. So far I know it measures resistance and capacitance of A/C over frequency --> Impedance.

I am interested in writing my own software in VB .net, as I already did for the SMA/NWT Spectrum analyser developed by BG7TBL.

Is there any document to start with, explaining the serial communication protocol?

Questions to joeqsmith:

- What version of LabView are you using?
- Is the HOME version worth the purchase (discussed in a different thread on this forum - a HOME version for personal use at 49 US$)?
- Does it come with all required components/toolboxes?
- Are you allowed to distribute the compiled version done with HOME version for free? Or would that be against "personal use"?
- How big is the time saving in doing your software in LabView as opposed to .net (C# or VB)?[/li][/list]

Regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 07, 2019, 11:33:30 am
joeqsmith, there are at least 3 versions of nanoVNA with different pcb layout on aliexpress:
https://github.com/hugen79/nanovna_900

Which one you're using exactly?

Exactly the one that is sitting on my desk now.  I doubt there is another exactly like it.  Mine has my fingerprints on it which I am pretty sure make it even more unique.

For a more general idea, I did post 2 videos showing it, one with it apart.  Beyond providing this level of detail, I can't be of much help.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 07, 2019, 12:03:57 pm
Just to get this thread on my list...

Got me a NanoVNA, too. Have not really used it, yet, as I need to better understand what it actually does. So far I know it measures resistance and capacitance of A/C over frequency --> Impedance.

I am interested in writing my own software in VB .net, as I already did for the SMA/NWT Spectrum analyser developed by BG7TBL.

Is there any document to start with, explaining the serial communication protocol?
Not that I am aware of.  I did search and ask the group prior to starting.


Questions to joeqsmith:

Quote
- What version of LabView are you using?
For home, I have a Pro license for 2011, along with the 2014 Home license. 

Quote
- Is the HOME version worth the purchase (discussed in a different thread on this forum - a HOME version for personal use at 49 US$)?
You may as well ask me about houses, cars and handheld DMMs.  There is no way I would know if the Home is worth the purchase for you personally.  Obviously I felt it was worth it for me or I wouldn't have purchased it.

Quote
- Does it come with all required components/toolboxes?
You may have asked me if you car requires four doors or two.  Again, I don't know what your requirements would be.  But as I stated in the other thread you mention, you can run free one week trials on the tools to determine if they fit your needs or not.  And again, they will extend these times.   If your question is if I can run the code I developed for the Nano with the Home edition as supplied, then the answer yes.   

Quote
- Are you allowed to distribute the compiled version done with HOME version for free? Or would that be against "personal use"?
http://sine.ni.com/nips/cds/view/p/lang/en/nid/213095 (http://sine.ni.com/nips/cds/view/p/lang/en/nid/213095)
Quote
You may share your work only for noncommercial, nonindustrial, and nonacademic purposes.

Quote
- How big is the time saving in doing your software in LabView as opposed to .net (C# or VB)?[/li][/list]
I had someone post about it being a pity that I did it in LabView rather than Python.   When I first looked at the supplied software, I knew it couldn't be used for the demo which is why I decided to roll my own.  I didn't waste a lot of time complaining about the problems but rather posted I was going to write my own in LabView, then proceeded to write it in LabView, then made a couple of videos showing the LabView code running it.  All in the course of about a week.    This included the time reversing the protocol.   

Obviously, I am not doing anything to hinder this poster from showing us some Python code or posting about how long they took to develop it.  You could certainly could show us another language and post your development time as well.  Beyond some experts like yourself actually doing something like this, I can't really offer you any data on a time saving metric.    I did however post how I exclusively use LabView for PC software development because of the time it has saved me.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 07, 2019, 04:37:06 pm
I thought about adding Touchstone support and putting together some sort of demo using LTSPICE.   Some time ago there was a conversation about SPICE and I had asked about LTSPICE supporting a blackbox model.   It appears that this feature never was implemented.   

https://www.eevblog.com/forum/projects/what-can-pspice-better-than-ltspice/msg928319/#msg928319 (https://www.eevblog.com/forum/projects/what-can-pspice-better-than-ltspice/msg928319/#msg928319)

I had looked at another simulator that had hopes of supporting S-parameters but they went under.   It appears Orcad still owns PSPICE.  Maybe the student version would handle it.   I'll look into it. 
Title: Re: NanoVNA Custom Software
Post by: hagster on August 07, 2019, 06:23:08 pm
QucsStudio supports touchstone files and can plot smith charts etc. Very easy to use
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 07, 2019, 07:32:54 pm
Nice find.  Thanks.    The current price of PSPICE is $6400USD and the student version wouldn't support it.   I'll have a look at this simulator.  If it looks like I can sort out some sort of demo, I'll go ahead and add Touchstone support.   

Thanks again.
Title: Re: NanoVNA Custom Software
Post by: bitseeker on August 07, 2019, 08:06:39 pm
joeqsmith, there are at least 3 versions of nanoVNA with different pcb layout on aliexpress:
https://github.com/hugen79/nanovna_900 (https://github.com/hugen79/nanovna_900)

Which one you're using exactly?

Exactly the one that is sitting on my desk now.  I doubt there is another exactly like it.  Mine has my fingerprints on it which I am pretty sure make it even more unique.

For a more general idea, I did post 2 videos showing it, one with it apart.  Beyond providing this level of detail, I can't be of much help.

Based on the current title image of this video, he has the good one:

https://www.youtube.com/watch?v=mKi6s3WvBAM (https://www.youtube.com/watch?v=mKi6s3WvBAM)
Title: Re: NanoVNA Custom Software
Post by: _Wim_ on August 07, 2019, 08:08:58 pm
The current price of PSPICE is $6400USD and the student version wouldn't support i.   I'll have a look at this simulator.  If it looks like I can sort out some sort of demo, I'll go ahead and add Touchstone support.   

Thanks again.

Another option is the Microcap software which recently has become free:

https://www.eevblog.com/forum/projects/microcap-12-is-free-(as-in-beer)-now/ (https://www.eevblog.com/forum/projects/microcap-12-is-free-(as-in-beer)-now/)

Title: Re: NanoVNA Custom Software
Post by: Bicurico on August 07, 2019, 09:02:26 pm
@joeqsmith: Thanks for your extensive reply - much appreciated.

Kind regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: hagster on August 07, 2019, 09:12:31 pm
How can you tell which the good ones are?
Title: Re: NanoVNA Custom Software
Post by: Bicurico on August 07, 2019, 09:32:35 pm
I don't know, but I can tell you this:

I ordered the CHEAPEST one i found on eBay (https://www.ebay.de/itm/Nanovna-50KHz-900MHz-Vector-Network-Analyzer-UHF-HF-VNA-UV-VHF-Antenna-Analyzer/133112732589 (https://www.ebay.de/itm/Nanovna-50KHz-900MHz-Vector-Network-Analyzer-UHF-HF-VNA-UV-VHF-Antenna-Analyzer/133112732589)) and it looks like a mixture of both the black pictures: the PCB and shields look like the "best" one, while the lettering on the case is more similar (but not the same) as the "worst" one.

Note that I mean cheapest, but complete: with the "calibration kit" - which consists on three SMA caps: open, closed and 50 ohm, as whell as two pairs of SMA cables and a male-male SMA connector.

The device came in a nice plastic case, which I did not actually expect.

I think that it is just a case of someone having posted these pictures without a real explanation on what/why one devices are supposed to be better than others. The pictures are rubbish and the only visible difference is the "NanoVNA" print next to the screen, which is bolder on the "good" device and thinner on the "worst" device. I call it rubbish.

From what I have read before ordering mine is that the white ones may come without the battery and older black ones had less/no shielding inside. Also, you might be buying just the device without accessories, so make sure you get them, too.

Regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: bitseeker on August 07, 2019, 10:45:43 pm
The only way to know for sure is to buy it only from the originator's store, which is on Taobao. Buying from unauthorized resellers always carries some risk. You can't be sure that the photos match what they're selling on any given day or if they even understand what they're selling in order to answer your question about which one they have in stock.

The one Bicurico bought is the good one. The font matches the one on the author's github page and you can see the shielding in the pic taken of the front edge. Of course, since any reseller can "borrow" photos, it's not a guarantee that you'll get that, but those are the characteristics to look for.
Title: Re: NanoVNA Custom Software
Post by: bitseeker on August 07, 2019, 10:50:31 pm
I think that it is just a case of someone having posted these pictures without a real explanation on what/why one devices are supposed to be better than others. The pictures are rubbish and the only visible difference is the "NanoVNA" print next to the screen, which is bolder on the "good" device and thinner on the "worst" device. I call it rubbish.

The author could've done a better job of explaining what to look for in his comparison pics, but they're not rubbish. There are clear differences after you examine them and some eBay listings.

Glad to hear you got a good one. What does the case look like?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 07, 2019, 11:19:41 pm
@joeqsmith: Thanks for your extensive reply - much appreciated.

Kind regards,
Vitor

Glad to help. 




The current price of PSPICE is $6400USD and the student version wouldn't support i.   I'll have a look at this simulator.  If it looks like I can sort out some sort of demo, I'll go ahead and add Touchstone support.   

Thanks again.

Another option is the Microcap software which recently has become free:

https://www.eevblog.com/forum/projects/microcap-12-is-free-(as-in-beer)-now/ (https://www.eevblog.com/forum/projects/microcap-12-is-free-(as-in-beer)-now/)

Thanks.  I will have a look at it as well.   

***
It does appear to support it as well.  I would think between the two versions of SPICE, I should be able to get something working.   Thanks again.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 08, 2019, 10:50:46 pm
I tried installing both SPICE programs and started to play with them a bit.  It looks very promising so I have added the ability to import a s1p file into my Nano software and want to verify the results.   

Is anyone aware of any free tools used to process Touchstone files?   I am basically just needing something like AppCAD but am looking for something that can plot inductance (and other) directly. 

Plan is to take a component that I have a touchstone file for, import it and make some measurements.  Then test the actual part and compare the results.   Once that works, I will go ahead and add the ability to export.   Then attempt to use the S-parameters from the Nano in SPICE.   

All seems doable but not trusting my math skills. 
Title: Re: NanoVNA Custom Software
Post by: malagas_on_fire on August 08, 2019, 11:02:28 pm
Would any of this program suits your needs?

https://www.rfpage.com/free-tools-to-analyze-and-plot-s-parameters-file/ (https://www.rfpage.com/free-tools-to-analyze-and-plot-s-parameters-file/)

https://www.ag-rf-engineering.de/products/software/s-parameter-viewer/ (https://www.ag-rf-engineering.de/products/software/s-parameter-viewer/)

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 09, 2019, 02:55:46 pm
This part was produced by E F Johnson.    Here you can see AppCAD  showing the Touchstone file created using a slightly higher end VNA.    Also shown is the same file imported with the Nano software.  Cursors were set at 1.6MHz and 8.7MHz.   Part was installed on my BK meter as a sanity check.   The part attached to the Nano, sweeping  from 1 to 10MHz and cursors were set at roughly the same location.

Obviously, the Nano is never going to replace a higher end VNA you would use in the lab.   Still, at $50ish dollars, I am having a hard time finding a reason to bash it.  If you wanted to learn about VNAs, I still think this is one of the best investments out there. 

Odd, attachments didn't load....
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 09, 2019, 03:30:26 pm
And, just for fun comparing $20,000+++  with $???? (whats an 8754A worth today) and $50.   Three VNAs, three answers, just like DMMs.   

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 09, 2019, 06:20:07 pm
Exporting from the Nano and reading with AppCAD.   

Time to read a few SPICE manuals.     
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 09, 2019, 11:52:51 pm
I ended up installing the Micro-Cap simulator.  Like the Nano, the cost was so low (free to download), it's going to be hard to find any fault with it. 

I made up a simple circuit with the 1 port model.  I then imported a Touchstone file from the Nano fully expecting it to crash, started the simulation.    It actually converged!!   

It's way too early to say if it can spit out any useful data but the fact it's doing anything at all is impressive.  I'm keeping my expectations low.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 10, 2019, 12:28:33 am
Just for a simple easy sanity check, I swept a 50 ohm resistor from 50K to 900MHz and stored that into a Touchstone file.  I then imported that into AppCad.  No problem.  Then I imported that same file into MicroCap and using a source with 50 ohms output impedance,  ran a sweep up to 900MHz and plotted the loss.   Looks like -6dB to me. 

I would say we have some meaningful data for S11.   The next step is to get S21 working, then add a transfer relay to the Nano.   Oh wait, the relay would cost 10X more than the Nano.  :-DD

****

I have attached the Touchstone file which would be renamed before using.  The MicroCap software is smart enough to identify touchstone files but it does not automatically calculate the number of data points. 
Title: Re: NanoVNA Custom Software
Post by: tinhead on August 11, 2019, 06:15:04 pm
Joe,

any plans to release the LabVIEW interface?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 11, 2019, 06:51:45 pm
Joe,

any plans to release the LabVIEW interface?

While a few people have now asked,  I have no plans to release it at this time.  The problem is lack of time to support the few people that would actually try it.   It's really what I would call an engineering tool, not what I would consider an end product.   

So while I appreciate the effort put into an optimized PC program, I wonder if this is really worth it if the measurements are not very precise anyway`

Oxdeadbeef seems very much aware of the problem.  While it's not their time, I appreciate their comment.   It's a great little unit for the beginner IMO, but just how much time do I want to invest in it.  Someone wrote me about creating something in Python and it not being much more effort.  Another wanted something for LINUX.  I wouldn't be at all surprised if we don't start seeing different software for it.

I still plan to make one last video for the Nano and will show the latest software for it. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 12, 2019, 07:47:26 pm
Micro Cap SPICE simulation with the NanoVNA

https://www.youtube.com/watch?v=v01lSgWo904 (https://www.youtube.com/watch?v=v01lSgWo904)
Title: Re: NanoVNA Custom Software
Post by: malagas_on_fire on August 12, 2019, 09:06:11 pm
For software programmers a flowchart of you current release SW and maybe serial data protocol could get them on the road for a multi-platform GUI written on python, java, etc ... By the way the mug looks nice, but is it filled?
Title: Re: NanoVNA Custom Software
Post by: OwO on August 13, 2019, 04:46:22 am
I don't understand why there are so many separate community efforts to develop VNA GUI software but none are open source, leading to fragmentation and duplication of efforts. If you are serious about this project please just post it on GitHub. There doesn't seem to be much software skill on this forum and putting the code out there gives real software developers a chance to look at it and possibly develop it further, possibly developing into a generic VNA GUI that can easily support new devices. There is nothing to be gained by keeping the source closed, it will just render your project obsolete as soon as you stop working on it. To me releasing a .exe is the same as not releasing anything at all.
Title: Re: NanoVNA Custom Software
Post by: hagster on August 13, 2019, 05:18:29 am
Joe has built this for himself alone. He doesn't want or need it to be a solution for anyone else.

Besides, i doubt there are many developers that would want to jump in on a project based on LabVIEW.

I would love to see a good Open source GUI though. There is no reason it could not support multiple VNAs including the big expensive Keysight and R&S units via scpi. Maybe then they would stop charging an arm and a leg for simple features like TDR(it's just an IFFT ffs).
Title: Re: NanoVNA Custom Software
Post by: _Wim_ on August 13, 2019, 05:22:12 am
I must say I can understand joeqsmith choice. There is indeed always the expectation when somebody has gone through the “trouble” of compiling/installing your software and it doesn’t work, the developer chimes in to provide some support. And this can cost quite a bit of the spare free time we all have to play around. For successful apps with wide community support this gets somewhat better, but a software package like this is unlikely to get this status.  Also, like many of us we are interested in a certain topic only for a certain period, and then we move on to the next interesting subject. When making software available it is more difficult to leave the topic because there is the expectation to fix bugs and continue development.

Also, as stated correctly above, this is not a programming forum, so this means not so many people will go to the trouble to actually read the source code, most will just run the exe and hope it will work, and ask question on the forum if it doesn’t, especially for a low cost device like this.
I find some of the above comments sounding like joeqsmith is doing us a disfavour, by not posting his software online, while off course the opposite is true, by making the informative videos and comparisons with a real VNA and also showing what is possible with some additional effort. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on August 13, 2019, 06:06:43 am
this is his right to not publish his source code. Some bad people may use his published source code, remove copyright and claim it like this is their own development. They can insult him and trolling just for fun. Some of them may use it in their commercial projects. And the author will loss interest for this project, will stop development and abandon it. And the project will die. I catch similar issues on several popular projects which I published as open source in the past. These things may happens when your project may affect some other commercial projects. Since you publish it for free these guys who make money on the similar projects will start to fight against you. So, now I don't publish source code of my projects which is interested for me for further development. I can publish some parts which is not interested for me anymore, but not these which I'm still working on.

Just think - he may not publish it at all. I have several projects which I never published and I know many people will be interested in it. But I will not publish even binaries of it, due to different reasons. So, if he decided to share just a binary, just say thanks to him. This is his work and he can decide what part of his work to share or not to share. This is better than nothing at all :)

I think joeqsmith doing good job, he sharing his experience and knowledge with other users, he even shared his tool. If you want source code to make something similar, then just make your own. No needs to blame someone for not sharing something that you're needs. There may be reason for this.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 13, 2019, 01:58:14 pm
I don't understand why there are so many separate community efforts to develop VNA GUI software but none are open source, leading to fragmentation and duplication of efforts. If you are serious about this project please just post it on GitHub. There doesn't seem to be much software skill on this forum and putting the code out there gives real software developers a chance to look at it and possibly develop it further, possibly developing into a generic VNA GUI that can easily support new devices.

If there really are separate efforts as you suggest, I would suspect it has to do with the various communities having different objectives.  Some want LINUX support, some want Python, some C#, some VB, some want it running on Apple products.    My goal was just to put some sort of demo together to help show how to use the Nano.     

I reversed the protocol and put together the main program in a couple of days.  Reading about Touchstone, installing and leaning a little about Micro-Cap added a few days.  Actually changing the code to support Touchstone and adding the state machine to perform the narrow sweep was a few hours.  It's hardly what I would consider a major effort compared with some of my other home projects. 

I will be the first to admit that I am not a "real software developer".    I suspect these experts you mention would have it done in half the time with twice the features.   I'm certainly not impeding anyone's efforts and if anything, have offered a few details about my software.   

There is nothing to be gained by keeping the source closed, it will just render your project obsolete as soon as you stop working on it.

I would say the opposite is true in that I have nothing to gain by releasing it.  Maybe you think the fame and recognition of having a few people use it is important to me.  It's not.   The gain in not releasing it is the time I don't spend supporting it.   

To me releasing a .exe is the same as not releasing anything at all.

I doubt I would have made this last demo had Micro Cap not released their simulator.  I could care less if they released the source or not.

I suggest you personally step up and show the community how it's done.  Lead by example. 
Title: Re: NanoVNA Custom Software
Post by: bitseeker on August 13, 2019, 05:45:27 pm
That narrow-band sampling feature was very cool, Joe. Thanks for adding it to your demo. Even though it takes time to run, it certainly adds to the potential value of the NanoVNA platform. Hopefully the Nano developer can enhance the included software like that, too.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 13, 2019, 07:49:09 pm
That narrow-band sampling feature was very cool, Joe. Thanks for adding it to your demo. Even though it takes time to run, it certainly adds to the potential value of the NanoVNA platform. Hopefully the Nano developer can enhance the included software like that, too.

I couldn't come up with an better solution.   The latest software has a quasi log sweep where it takes the start, stop and samples per decade, then calculates a series of start and stop segments.  The Nano still performs a linear sweep over each segment but the overall effect is a log.

Without the transfer relay, and me being far too lazy to flip the part, I just fudged S12 and S22 to get the Touchstone working.  Shown is a 500MHz lowpass being swept on the Nano.  The Touchstone is then read by AppCad.  They don't seem to have a dual vertical axis option and I couldn't seem to get it to plot in a linear format but it's obviously working.    Also shown is the 2-port file imported to Micro-Cap and running an AC analysis. 

So, it seems the basics all work. 

I may have some old, low frequency RF transistors floating around.  I could try and find the manufactures S-parameters for them and see if I could come up with the similar numbers with the Nano.  Build and amp and try to simulate that.  A bit more complex but something a little more real world.     
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 13, 2019, 08:13:36 pm
Joe

Just discovered your work here....very nice! Maybe this question has been asked and answered: Are you going to release it into  the wild so others can use it?

Keep up the great work!

Joe
W3JDR
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 13, 2019, 08:37:14 pm
Joe

Just discovered your work here....very nice! Maybe this question has been asked and answered: Are you going to release it into  the wild so others can use it?

Keep up the great work!

Joe
W3JDR

Yes, it's been answered.  Maybe read the last 10 posts or watch the last video.   
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 14, 2019, 12:24:05 pm
Anyone know if/where the NanoVNA communications interface protocol is documented?

Joe
W3JDR
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 14, 2019, 04:14:12 pm
Anyone know if/where the NanoVNA communications interface protocol is documented?

Joe
W3JDR

Maybe read the first 5 posts. 
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 14, 2019, 04:40:10 pm
Thanks for the reply.

Yes, I've seen all of those but none offer a direct or conclusive solution. I'm looking for something that describes the message structure in both directions so I can try to roll my own application, probably in VB.

Joe
W3JDR
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 14, 2019, 05:17:50 pm
Then you know that I have asked and was unable to locate such a document.   Assuming you took the time to watch that first video where I described what I saw with the BAUD rate and protocol, and you looked at the document containing the list of commands, you should be all set.   Is there something specific you are not understanding?   

If you havn't tried communicating with it, I suggest you just open a dumb terminal and send it the "info" command and see if that works.  Once you have that working, replicate it in what ever language and build from there.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 14, 2019, 06:52:19 pm
Something is really wrong in the attached picture....
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 14, 2019, 07:21:44 pm
This list of commands can be sent from a serial terminal program set for 9600 baud and the results will be displayed. Courtesy of the Google Groups site:

NanoVNA Console Commands:
=========================
help – prints most of the following commands (below) – some are not enabled but appear in the source code
exit – exits and then restarts console mode and prints command prompt
info – prints firmware info:
    Kernel:       4.0.0
    Compiler:     GCC 5.4.1 20160919
    Architecture: ARMv6-M
    Core Variant: Cortex-M0
    Port Info:    Preemption through NMI
    Platform:     STM32F072xB Entry Level Medium Density devices
    Board:        NanoVNA
    Build time:   May  5 2019 - 08:54:38
echo - Usage: echo "message"
systime – outputs binary time from 1/1/1980: eg: 81225068
threads
reset - Performing reset
freq - frequency(Hz)}
offset - frequency offset(Hz)}
time – get the time in: timespec.year+1980, timespec.month, timespec.day, timespec.millisecond
dac - usage: dac {value(0-4095)}
saveconfig - saves current configuration - and prints "Config saved".
     not sure what in total it saves - need to go through source code.
clearconfig - usage: clearconfig {protection key}
    where key is predefined as “1234”
    and wrong input gives: “Key unmatched” error.
    Correct key gives: “Config and all cal data cleared”
data - usage: data [array]
dump  - (if enabled) outputs dump buffer
gamma – Prints  gamma[0]& gamma[1]
frequencies – prints a long list of all the sweep points from start to stop
port – Sets port of DSP tlv320aic3204
    usage: port {0:TX 1:RX}
stat – outputs processor status:
    average: -138 -137
    rms: 3597 8
    callback count: 9126700
    awd: 27
gain – sets gain of DSP tlv320aic3204
     usage: gain {lgain(0-95)} [rgain(0-95)]
power - usage: power {0-3}
sweep - usage: sweep {start(Hz)} [stop] [points]
    if no inputs: then prints current setup eg:300000000 500000000 101
    otherwise, can force new sweep settings using the following commands:
    start
    stop
    center
    span
    cw
    set – sets sweep points
    start
    stop
test – unknown how to use – appears to set freq span from 10MHz to 90MHz and involves one of the LEDs and touchscreen input
touchcal – produces calibration touch points in the upper left and lower right corners
    outputs: "first touch upper left, then lower right...")
         "done”
         "touch cal params: A B C D (upper left and lower right x-y co-ords)
touchtest – test touch accuracy – touch, hold and drag pointer
pause – pause LCD display output
resume – resume LCD display output
cal - usage: cal [load|open|short|thru|isoln|done|reset|on|off|in]
save - save {id} where ‘id’ is from 0 to 4
recall - recall {id} where ‘id’ is from 0 to 4
trace – prints status of either 2 or 4 traces depending on F/W version used:
    0 SWR CH0 1.000000000 0.000000000
    1 LOGMAG CH1 1.000000000 7.000000000
    2 SMITH CH0 1.000000000 0.000000000
    3 PHASE CH1 1.000000000 4.000000000
marker – Usage:  marker [n] [off|{index}]
edelay – electrical delay in picoseconds
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 14, 2019, 07:29:41 pm
"This list of commands can be sent from a serial terminal program set for 9600 baud and the results will be displayed. "
 :-DD
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 14, 2019, 07:58:55 pm
Why do you find this amusing?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 14, 2019, 08:20:01 pm
Why do you find this amusing?

Then you know that I have asked and was unable to locate such a document.  Assuming you took the time to watch that first video where I described what I saw with the BAUD rate and protocol, and you looked at the document containing the list of commands, you should be all set.   
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 14, 2019, 08:44:47 pm
Huh??.

I asked you directly if you had a protocol document. The answer I got seemed snippy, snooty and indirect, but I dismissed it and found what I was looking for elsewhere. I thought others might find it useful, so I posted it here. Mea culpa for my ignorance. I won't trouble you any further.

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 14, 2019, 09:17:15 pm
Huh??.

I asked you directly if you had a protocol document. The answer I got seemed snippy, snooty and indirect, but I dismissed it and found what I was looking for elsewhere. I thought others might find it useful, so I posted it here. Mea culpa for my ignorance. I won't trouble you any further.

I thought my response was direct.  To make it more clear,  I have no such document.   Again, I had asked and wasn't able to find such a document.  The only document I found was the list of commands, which you have included.   

The BAUD rate in the document you posted needs more explication.   I explained I had created a video which covered what I had found in case others wanted to create their own software.  In case of the BAUD rate, for this application it serves no purpose.  If it did, 9600 would not come close to matching the performance required.     
 
Based on your frustration, I assume these answers were not what you were looking for.  Sorry, I can't help with that. 
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 14, 2019, 10:01:06 pm
I found that adjusting the baud rate in the terminal program had no affect. Being a CDC USB connection, it goes as fast as it can.  Anyway, I hope the list allows others here to jump-start their efforts. I tested every one of the commands and they work as descibed, so no reverse engineering required. So everyone, the race is on! Get those apps going.

BTW, some nice additional features in a new app would be a signal generator mode and a power meter mode.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 14, 2019, 10:39:08 pm
I found that adjusting the baud rate in the terminal program had no affect. Being a CDC USB connection, it goes as fast as it can. 

Pretty much verbatim of what I had stated in the video.  Good to see you are on your way.
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 15, 2019, 12:05:52 am
Other wish-list features would be capacitor/inductor measurement at a user--specified spot frequency with digital readout including ESR/EPR resistance values
I found that adjusting the baud rate in the terminal program had no affect. Being a CDC USB connection, it goes as fast as it can.  Anyway, I hope the list allows others here to jump-start their efforts. I tested every one of the commands and they work as descibed, so no reverse engineering required. So everyone, the race is on! Get those apps going.

BTW, some nice additional features in a new app would be a signal generator mode and a power meter mode.
.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 15, 2019, 01:12:08 am
Looks like this person tried connecting a transfer relay.    This is pretty much where I am heading with the 2-port Touchstone.  The problem I see with their setup is they do not perform a full calibration which could be part of the errors they show.    It seems like they could use the basic cal, then flip the cables, or run two cals and select between the two when switching the transfer relay. 

In my previous picture, you can see the Nano is running without a calibration.  I have a short attached and my software is showing a short.  At this stage, I had pushed the SOL down into my software.  I just finished up with the full SOLT that will handle all four S-parameters.   The software could tell the Nano to switch between cals as it can store more than one, but putting it in the software means that there is no delay when switching. 

https://www.youtube.com/watch?v=HYlQHwDb9fA (https://www.youtube.com/watch?v=HYlQHwDb9fA)

Looking at Pasternack, you get some idea on the cost.   I have an old relay similar to what this person shows in their video, but it would be nice to use something lower cost and readily available.   It may be cheaper to buy DPDT RF relay common to scopes and such and layout a board for it. 

https://www.pasternack.com/medium-power-transfer-electromechanical-relay-switches-category.aspx (https://www.pasternack.com/medium-power-transfer-electromechanical-relay-switches-category.aspx)
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 15, 2019, 12:03:32 pm
Joe

Can you explain the return data pairs in the data array? Eg, if you send "data 1" you get a 2-wide array that corresponds row-by-row with the "frequencies" array. What does each value in a pair represent? It seems that the first value is the raw magnitude of S21 before the 20log scaling is applied. I thought the second value might be the phase of S21, but I'm having a difficult time understanding the scaling.
Title: Re: NanoVNA Custom Software
Post by: edigi on August 15, 2019, 12:23:53 pm
It's good that I found this thread.
Hopefully the developers will fix their SW. After all that's their product/job.

joeqsmith
Running Windows SW using Linux is OK for most of the time, the key is Wine. There can be still issues with Linux like printing and proprietary drivers (e.g. related to HW like WiFi) but that's typically not a show stopper for an app.

It's a pity that you've decided not to release your SW, as in my view the difficulty is not developing communication towards the equipment or GUI but knowing the use cases and making sensible user interface for that. That's a lot more than to be able to interpret Smith chart and only few people can do that, typically not those who are good at SW development.
I also acknowledge that it's a real risk that someone does the real work and other people make profit out of it so your decision is understandable. Probably even GPL helps little in this.
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 15, 2019, 01:03:44 pm
edigi

I agree with JoeQ that releasing his source might be of little value to us except to illustrate how it could be done, though that in itself might have value to others. One of the problems I see is that he developed in a proprietary rapid development environment (I think LabView) that is closed and expensive. To develop with a team requires a license that costs thousands for each developer, so getting his code would have only academic use for most of us. Nonetheless, I don't see this as a difficult project if you have the right toolkit. I've done several similar applications and I think something functional could be knocked out in days if you work in a more general and open rapid development environment. I'm thinking vb.net. There are only 2 things preventing me from diving into this: 1) I'd like not to have to re-invent the Smith Chart GUI and, 2) I already have too many other unfinished projects and little spare time.

JoeR
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 15, 2019, 04:20:26 pm
Joe

Can you explain the return data pairs in the data array? Eg, if you send "data 1" you get a 2-wide array that corresponds row-by-row with the "frequencies" array. What does each value in a pair represent? It seems that the first value is the raw magnitude of S21 before the 20log scaling is applied. I thought the second value might be the phase of S21, but I'm having a difficult time understanding the scaling.

Yes, I obviously could explain the data format.   There's an old saying, "You can lead a horse to water but you can not make it drink" or as I like to say, "You can lead a whore to culture but you can not make her think".   Today you can walk someone to the edge of the water, and they not only refuse to drink but take offense to it.  The few that drink  jump up and down yelling,  "look at me, I discovered the ocean!"  :-DD   

I will say that I've had to blow out a few cobwebs while working the equations for the Nano but it's been a lot of fun.   

With that link I provided to the home edition of LabView including the application builder being offered for $50, I am seeing even less of a reason to ever use another language to develop Windows apps.   

Good luck with your project.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 15, 2019, 04:30:15 pm
It's good that I found this thread.
Hopefully the developers will fix their SW. After all that's their product/job.

joeqsmith
Running Windows SW using Linux is OK for most of the time, the key is Wine. There can be still issues with Linux like printing and proprietary drivers (e.g. related to HW like WiFi) but that's typically not a show stopper for an app.

It's a pity that you've decided not to release your SW, as in my view the difficulty is not developing communication towards the equipment or GUI but knowing the use cases and making sensible user interface for that. That's a lot more than to be able to interpret Smith chart and only few people can do that, typically not those who are good at SW development.
I also acknowledge that it's a real risk that someone does the real work and other people make profit out of it so your decision is understandable. Probably even GPL helps little in this.

At this time, I am not too concerned with the financial aspect of it.  For me, it's just a hobby.   It does appear though that the person driving the sales and development is not the original designer.   They have a store setup and I assume are profiting from the creators work. 

I too would really like to see the developers continue to improve the software they supply.  They are certainly free to copy any of the ideas I have thrown out to the public and profit from them.  I would actually be happy if the did as their users would benefit.     
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 15, 2019, 04:54:36 pm
It appears Mini-Circuits offers a few transfer relays.  The cost is still about 6X higher than the Nano.

https://www.minicircuits.com/WebStore/Switches.html (https://www.minicircuits.com/WebStore/Switches.html)

It appears that the unit I have matches the schematic in the manual from Hugen79.    P2 allows access to VDD, ground and the JTAG signals.  I havn't looked into yet but it seems like the JTAG could be used for general purpose I/O once the part is configured.  Adding the ability to use these pins for a simple SPI port or even just two simple on/off controls, under software control may make adding peripherals to Nano more integrated.

I would like to make a small PCB with a transfer relay and a couple of bias T's on it along with a place holder for a fixed attenuator.  Babbling and havn't thought it through.   First step is to sort out if the firmware for the Nano is available an see if using these pins is even an option without having to involve the current designers.

Part of yesterday's efforts, showing the 10dB attenuator using my software's SOLT routines and shutting off the Nano's calibration.   


 
Title: Re: NanoVNA Custom Software
Post by: hagster on August 15, 2019, 05:35:31 pm
If your making your own board there are plenty of RF relays available.


E.g

https://www.mouser.co.uk/ProductDetail/Omron-Electronics/G6ZK-1FE-DC3?qs=sGAEpiMZZMt%2FATQILEa77R5xBUwBD43UVicKLmkegz0%3D (https://www.mouser.co.uk/ProductDetail/Omron-Electronics/G6ZK-1FE-DC3?qs=sGAEpiMZZMt%2FATQILEa77R5xBUwBD43UVicKLmkegz0%3D)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 15, 2019, 07:00:20 pm
If your making your own board there are plenty of RF relays available.


E.g

https://www.mouser.co.uk/ProductDetail/Omron-Electronics/G6ZK-1FE-DC3?qs=sGAEpiMZZMt%2FATQILEa77R5xBUwBD43UVicKLmkegz0%3D (https://www.mouser.co.uk/ProductDetail/Omron-Electronics/G6ZK-1FE-DC3?qs=sGAEpiMZZMt%2FATQILEa77R5xBUwBD43UVicKLmkegz0%3D)

I would like to see some sort of breakout board about this size with the bias T's and attenuator build up area.   A small cable to connect it to the Nano.   It would be nice to machine up a metal case that would hold the whole assembly including the nano.  Bolt the SMA bulkheads right to the metal case.   Maybe some of MACOMs GaAs switches.   

Then again..... it's a $50 unit.   
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 15, 2019, 07:11:40 pm
Does this mean that you will or that you won't help me by explaining the data array values?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 15, 2019, 07:32:35 pm
Does this mean that you will or that you won't help me by explaining the data array values?

It means I obviously could explain the data format but I see no reason to add to your frustration of having to deal with me.   You also made it clear when you wrote "I won't trouble you any further." that you really don't need my help anyway.   So again, good luck with your math project.   Looking forward to seeing what you come up with.
Title: Re: NanoVNA Custom Software
Post by: joedarock on August 15, 2019, 07:43:04 pm
Wow! What a great guy.

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 15, 2019, 08:15:35 pm
Wow! What a great guy.
At least you have figured out that I'm not here to wipe your nose and give you a participation trophy.
Title: Re: NanoVNA Custom Software
Post by: KE5FX on August 15, 2019, 09:00:33 pm
Somebody get a hose (https://wiki.lesswrong.com/wiki/Crocker%27s_rules)....  ::)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 17, 2019, 06:23:41 pm
Somebody get a hose (https://wiki.lesswrong.com/wiki/Crocker%27s_rules)....  ::)

There is a fair bit of math involved in understanding a VNA.  Without a higher level education you may have a steep learning curve.  Then again, they did provide the source code which would perform all the basic calculations so it would seem like even someone with no background in math but decent code skills should be able to get the job done. 

So, maybe an education would be more valuable than your recommended hose.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 17, 2019, 06:32:02 pm
Prototype of the GaAs transfer relay with bias Ts for the Nano. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 17, 2019, 07:23:06 pm
Pictures showing the back and side of the prototype.   I spent some time comparing the two schematics and looking for the source for current firmware.   I don't think it would be too difficult to control the relay from the nano but without the source, I would need to create another fork from the original source.    In the end, the problem I see is the slow communications rates which caused me to move the calibration to LabView.   The new plan is to just use a second USB interface for the relay.  Simple, fast switching and keeps the nano stock.   

 
Title: Re: NanoVNA Custom Software
Post by: Bicurico on August 18, 2019, 05:43:02 pm
Hi,

Here is my quick update...

I have returned from the first part of my holidays, so I had this afternoon to sit at my shack and try the NanoVNA.

Coming from pure spectrum analysis, the VNA is totally new to me, so here is what I understood so far and I welcome any correction. I write this as if thinking out loud and to allow others to learn from the little insight I got so far. Again, please do correct me (hopefully in a friendly manner - this is just a hobby, I am not a RF engineer by education or trade).

1) The VNA can be used to tune antennas. The idea is that you want as little as possible of the outgoing wave to be reflected by the antenna - this causes the signal to travel back into the device. There are two problems with this: a) If the signal is reflected instead of being transmitted, it is not transmitted! This is kind of useless... b) The signal going back into the the device might actually break the device.

When measuring the antenna, we want to determine the minimum reflection of the wave at a given frequency. Any antenna is typically tuned for a specific frequency. The S11 logarithmic measurement will show a notch at this frequency. By making the antenna longer or shorter or whatever, you can increase the loss of signal return (=maximum transmission of the signal) - the notch will become greater. And, you can especially move the frequency of the notch. This is what is called antenna tuning.

2) Resistance and Capacitance at AC behave differently from DC: they vary with frequency and a capacitor actually acts as a resistor. Plus: it lets the AC flow through it!
By plotting the variation of the capacitance through frequency, we can analyse the behaviour of the DUT. One way to represent this is by means of a SMITH chart, which plots the data in a polar diagram, considering the complex number nature of capacitance/phase vs frequency. Sorry - at this point I am lost... What do you ACTUALLY measure? Why and what for?

3) S11 and S21: this is easy to explain: there are two ports on the NanoVNA: Port 1 and Port 2. When you only use port 1, you send out a signal on port 1 and then read the reflection of this signal back into port 1. So you measure 1-->1 = S11. S21 means that you generate a signal at port 2 and send it through a DUT. From the output of the DUT you read the signal in port 1: 2 --> 1 =  S21. My guess is that S11 = measure antennas and/or signal reflection / SWR. S21 allows to measure how a DUT messes up a signal: phase (due to delay?), attenuation?

Regarding writing a custom PC software:

1) The NanoVNASharp software works without any problem for me, so I wonder why people are so motivated to write their own software? The reason I ask is to understand what OTHER measurements COULD be implemented. Also, what functionality is missing that would be required?

2) The connection to the NanoVNA, as already discussed, is fairly simple: just open Putty, configure the respective COM port and off you go. Type "help" and you can see all commands. Their output is quite self explanatory and the data (literally "data") can be easily copy&pasted to Excel for initial tests.

The data consists 101 samples made of the two components of a complex number, x and y, as usual with impedance measurement.

To represent the data in a polar chart (Freq/Vector):
Vector= 180/PI*Atan2(y, x)

To represent the data in a linear Freq/dB chart:
dB = Sqrt(x^2+y^2)

To represent the data in a logarithmic Freq/dB chart:
dB = 20*Log10(Sqrt(x^2+y^2))

I am not 100% sure this is correct, but first tests look good.

The "frequencies" command will output the frequency matching each of the 101 samples, which is nice, as you don't have to calculate them yourself (which would not be a big deal anyway).

I did not figure out what the "dump" command outputs.

Hope this helps and I am with joeqsmith: let's see what comes out! Again, I am at this point unsure on how to improve the NanoVNASharp software, so my personal desire to make my own software is not so big right now - I don't even know all the applications of the NanoVNA in the first place.

I, personally, don't believe in freeware/open source, btw. Any work done for free is normally to be considered "worthless" by those using it...

@joeqsmith: Can you explain what a GaAs transfer relay is and what purpose it has? I tried to google it without success, as the results want to show a GAS relay. So much about AI.

Regards,
Vitor

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 18, 2019, 05:56:39 pm
@joeqsmith: Can you explain what a GaAs transfer relay is and what purpose it has? I tried to google it without success, as the results want to show a GAS relay. So much about AI.

Regards,
Vitor

I assume you watched the video I posted where the person demonstrated a mechanical transfer relay.   I also assume you watched the first video I made where I talked about the use of a transfer relay.    GaAs, Gallium Arsenide is the technology used in my relay.  You can find information about that in Wiki. 
   
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2616768/#msg2616768 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2616768/#msg2616768)
https://en.wikipedia.org/wiki/Gallium_arsenide (https://en.wikipedia.org/wiki/Gallium_arsenide)

Quote
The signal going back into the the device might actually break the device.
The VNA is designed to handle 100% reflected.  Obviously if you are testing PAs, all bets are off.  You could easily destroy it with the forward power as well.

Quote
I wonder why people are so motivated to write their own software?
As I stated before and demonstrated during the video, I started out because of the flicker when using the cursors. 
Title: Re: NanoVNA Custom Software
Post by: edigi on August 18, 2019, 08:03:48 pm
Here is my take (or guess if you like) how NanoVNA operates, it requires no higher education, although it helps if you know quadrature signals.
For that you may check https://dspguru.com/files/QuadSignals.pdf (https://dspguru.com/files/QuadSignals.pdf) (it contains a lot more than needed here but it never hurts to know more).

I re-iterate that may be know already from elsewhere:
There is a clock chip with 3 outputs that beyond clocking the ADC and MCU chips (with the same clock) outputs 2 RF signals (one for downmixing, one for reference) with a small difference between them (that falls into audio range where the ADC can operate after mixing).
One of the RF signals is used to down mix to audio band and there are 3 double balanced mixers that share the same RF signal for downmixing:
- 1 mixer for the signal that is used to feed a resistor bridge (the reference RF signal)
- 1 mixer for the middle of the bridge (that measures unbalance)
- 1 mixer for the input of the VNA (RX)

In the resistor bridge instead one of the resistors the output of the VNA connected (TX).

If the VNA output is impedance matched (meaning pure resistive 50 Ohm), there is no signal in the middle of the bridge as it's balanced.
If the output is mismatched but still pure resistive there is signal in the middle of the bridge but it's phase aligned with the reference (that is feeding the bridge).
If the output is totally mismatched (meaning also reactive component) the middle of the bridge will show a phase shifted signal.

Checking in the source dsp.c file the ADC output of the downmixed signal is correlated with sine and cosine (5 periods in 48 samples, meaning like 5kHz difference between the RF signals with 48kSa/s that is my take or 10kHz with 96kSa/s with no practical difference) both for the signal being checked and the reference. The phasor difference between them is calculated and stored in rectangular form.
This is done for all the points in the scanned frequency range and plotted in the form that is desired (starting around line 430 of plot.c).
The same phasor difference is done for the input port in case of S21 measurement.

Like Bicurico already wrote, with S11 you can check the frequency dependent characteristic of a component (antenna included) what resistive and reactive part it has at various frequencies.
With S21 you can check what transfer characteristic of a component like filter, amplifier etc. has again at various frequencies.

In the what could be enhanced part for me the range extension occurred first. The clock chip is just 200MHz that is extended with many already documented tricks till 900 MHz but that is still not that high and due to the extension dynamic range is compromised as well...
Luckily the whole thing is open source (and very far from worthless) so anyone can enhance, correct.

Note: there are different sources, one from the original Japanese author (trftech) and then who makes this product:

https://github.com/ttrftech/NanoVNA (https://github.com/ttrftech/NanoVNA)
 https://github.com/hugen79/NanoVNA-H (https://github.com/hugen79/NanoVNA-H)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 19, 2019, 05:56:52 am
Today I made up a USB cable to control the transfer relay and finished up the software to support it.   Switching happens automatically when running a calibration or a 2-port sweep.   

Sadly the prototype has proven to be worthless.  I was hoping that the Nano's performance was poor enough that the error from the GaAs switches would be negligible but this wasn't the case.  This would have a been a fairly low cost solution.   If you are curious about the T check, Rohde Schwarz published a paper on it that may be worth the read.     

https://scdn.rohde-schwarz.com/ur/pws/dl_downloads/dl_application/application_notes/1ez43/1ez43_0e.pdf
Title: Re: NanoVNA Custom Software
Post by: radiolistener on August 19, 2019, 11:29:58 am
If you are curious about the T check, Rohde Schwarz published a paper on it that may be worth the read.     

do you have T-check results for nanoVNA?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 19, 2019, 02:43:41 pm
If you are curious about the T check, Rohde Schwarz published a paper on it that may be worth the read.     

do you have T-check results for nanoVNA?

I'm not sure what you are asking as a T-check for the Nano wouldn't make sense as it can't measure all four S parameters.   The reason I added this basic metric to my software is to help validate the transfer relay (and bias Ts).   

If you read the document I posted and understood it, looking at the picture I had attached, notice that the Function is set to 2-Port T-Check.  I am sweeping from 1 to 150MHz which is the X-axis of the graph.  The Y-axis it is in percent deviation from a perfect system, as shown in the Rohde Schwarz paper.  Even at just 150MHz, you can see it is already 15% low which is a fail.  It gets much worse.   

As I mentioned, I have an old transfer relay that I could easily drop in and use but my goal wasn't to just show an old relay connected to the Nano like the video I had linked.  That video doesn't show anything about how it is actually used and I doubt many people would want to see me just connect a relay.   I would like to sort out something cost effective that could be replicated.   

The end goal would be one last video showing how it could be used to create a full 2-port Touchstone file for a more complex device (RF transistor) and use it as part of an amplifier circuit modeled in SPICE. 

I was looking at that Siglent setup but it looks like it suffers from the same problems.   Being a modern system and over $1000, I was expecting more.    I was actually hoping they had a low cost test set as I can't believe anyone would disturb their cables when making measurements, let alone swap them.    Had they, and if it was cost effective, maybe adapt it to the Nano.     

Oh well, strike one. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 19, 2019, 07:21:27 pm
The plan is to switch to a mechanical relay like hagster had pointed out.   Teledyne and others make some that have some decent specs.    The ones used in my DSO have a very low profile.  I would like to keep the size down like the first attempt.   It will take another week or so to get something together to try. 

It's too bad that they didn't offer this as an accessory.  Maybe it's getting too specialized. 

A few people have been asking me about the PCBs used for the cal standards.  I don't have a store where I try to sell anything but again, maybe this is another opportunity for the people making the Nano.   
Title: Re: NanoVNA Custom Software
Post by: radiolistener on August 19, 2019, 08:04:39 pm
I'm not sure what you are asking as a T-check for the Nano wouldn't make sense as it can't measure all four S parameters.   The reason I added this basic metric to my software is to help validate the transfer relay (and bias Ts).   

If I understand correctly, T-check can be done with 2-port. But I'm not sure what are meaning of these S21* and S12* (marked with star) on equation (12) in the document (see page 5).

If I understand correctly, S11 and S21 are measured on usual T-connector with some dummy load on a third port.

Technically we can measure S22 and S12 by just turn T-connector in different direction. But since we're using symmetric T-connector, the result should be almost the same, so we can assume that S22 = S11 and S12 = S21. Is it correct?

But what means S21* and S12* (with star)? How to measure it?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 19, 2019, 08:25:02 pm
I'm not sure what you are asking as a T-check for the Nano wouldn't make sense as it can't measure all four S parameters.   The reason I added this basic metric to my software is to help validate the transfer relay (and bias Ts).   

If I understand correctly, T-check can be done with 2-port. But I'm not sure what are meaning of these S21* and S12* (marked with star) on equation (12) in the document (see page 5).

If I understand correctly, S11 and S21 are measured on usual T-connector with some dummy load on a third port.

Technically we can measure S22 and S12 by just turn T-connector in different direction. But since we're using symmetric T-connector, the result should be almost the same, so we can assume that S22 = S11 and S12 = S21. Is it correct?

But what means S21* and S12* (with star)? How to measure it?

https://en.wikipedia.org/wiki/Complex_conjugate
Title: Re: NanoVNA Custom Software
Post by: radiolistener on August 19, 2019, 08:36:45 pm
ok, thanks, I will try to measure it when I get nanoVNA.

So the last screenshot in the post #110 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2625981/#msg2625981) is ct value multiplied by 100 for 1..150 MHz range, measured on your nanoVNA? Is it correct?

I'm just confused because there is a word "Gain", so I thought this is something other in dB... :)


15% error at 150 MHz looks much worse than example from T-check document. Is it really so bad?

What is usual error of other amateur VNA?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 19, 2019, 08:52:45 pm
ok, thanks, I will try to measure it when I get nanoVNA.

So the last screenshot in the post #110 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2625981/#msg2625981) is ct value multiplied by 100 for 1..150 MHz range, measured on your nanoVNA?

If swapping the cables, there's no need for the full 2-port cal, no need for the transfer relay, no need for the T-check.   Of course, ideally you would want to mechanically lock everything down when making measurements. 

Yes, like in the  Rohde Schwarz paper, I have multiplied by 100.  Yes, 1 to 150MHz.  Yes, measuredish on my Nano.   Ish, meaning that I am not taking the time to torque things or taking care to keep things from moving.  More of a check to see if it was even worth spending any time with.  It wasn't. 

I'm just confused because there is a word "Gain", so I thought this is something other in dB... :)

You have just discovered first hand the reason for not releasing the software.  It's really an engineering tool.   These little details like "Gain" vs something like "T-Check Percent (see RS paper.....)" would eat up a lot of time trying to explain and clean up for the general user.     

I suspect that most people will have no need for a full 2-port setup or want to play with things like Touchstone files and SPICE.   

missing word
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 19, 2019, 09:08:13 pm
15% error at 150 MHz looks much worse than example from T-check document. Is it really so bad?

What is usual error of other amateur VNA?

The NanoVNA is really my only reference for a cheap amateur VNA so I really can't say what to expect.  The problem I see with the cheap systems, like the Nano or the Siglent is there is no test set.  Which again.... see my last post.   So, if I ever get something I feel is good enough to use for a video,  you will have at least one data point.   Still, this will be custom one-off hardware, so there is a lot at play.   Right now, I would say your guess is as good as mine.   

Yes, 15% is pretty bad, especially when you consider that the full working range of the Nano is 900MHz.  It's just the first prototype.  Hopefully rev 2 will be better. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 20, 2019, 03:10:58 pm
Running the Nano for about 5 minutes after SOLT cal.  Then with the 50 ohm standard applied, let it run for roughly 18 minutes.  The histogram is for every sample.  So 101 samples per sweep multiplied by the 1600 sweeps,  or 160K.    I suspect if I were to do this for 0-300Mhz, it would look gaussian. 

The software just records the raw data for both channels and the frequency.  I can then calculate what ever I want to look at from that even though there are only six parameters listed.     
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 20, 2019, 04:37:15 pm
Zooming into the 300MHz area, I suspect the reason we are seeing a pattern still is the lack of points. 

The scatter plot is showing the mag phase for the 50 ohm standard.  If it were perfect, we would just see a line from 0,0 at 50KHz to 0,0 at 900MHz. 
Title: Re: NanoVNA Custom Software
Post by: erikka on August 20, 2019, 04:48:40 pm
The nanoVNA switches to harmonics mode when measuring above 300MHz. (see this code)
Code: [Select]
  if (freq > 900000000) {
    freq /= 5;
    ofreq /= 7;
  } else if (freq > 300000000) {
    freq /= 3;
    ofreq /= 5;
  }
My own build VNA using SI5351 and 3 SE612 uses the same aproach
This switching to 3rd and 5th harmonic when using above 300MHz is relatively ok because of the relative phase and amplitude  measurement but as the main signal drops more then 10dB it is a interesting test for the linearity of the onboard ADC.
Even when using a high end USB audio input the transition to harmonic mode its still observable
Title: Re: NanoVNA Custom Software
Post by: erikka on August 20, 2019, 05:26:55 pm
My own cables and calibration set is insufficient to do a good TEE test. (My VNA uses the same measurement approach and has many same components except ADC and controller)

(http://athome.kaashoek.com/public/eevblog/Tee%20test.PNG)

OK till about 600Mhz but deteriorating at higher frequencies.

Mind you, calibrating a standard 50 ohm load and measuring from 0.1 till 900MHz gives a very repeatable outcome at the accuracy level I am interested in. But then I am measuring with 24bit 192kHz ADC instead of the nanoVNA 16bit 48kHz ADC
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 20, 2019, 06:09:24 pm
The nanoVNA switches to harmonics mode when measuring above 300MHz. (see this code)
Code: [Select]
  if (freq > 900000000) {
    freq /= 5;
    ofreq /= 7;
  } else if (freq > 300000000) {
    freq /= 3;
    ofreq /= 5;
  }
My own build VNA using SI5351 and 3 SE612 uses the same aproach
This switching to 3rd and 5th harmonic when using above 300MHz is relatively ok because of the relative phase and amplitude  measurement but as the main signal drops more then 10dB it is a interesting test for the linearity of the onboard ADC.
Even when using a high end USB audio input the transition to harmonic mode its still observable

Covered a long time ago but yes.
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2566308/#msg2566308 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2566308/#msg2566308)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 20, 2019, 06:11:18 pm
Looks good.  What language did you use? 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on August 20, 2019, 06:22:39 pm
According to application icon this is .net.  :)

https://github.com/erikkaashoek/Tapr-VNA

Title: Re: NanoVNA Custom Software
Post by: erikka on August 20, 2019, 06:42:27 pm
Yes. PC software to control hw similar to nanovna
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 20, 2019, 07:27:19 pm
Is your plan to port it to the NanoVNA? 
Title: Re: NanoVNA Custom Software
Post by: wwoofbum on August 20, 2019, 10:28:06 pm
The nanoVNA appears to be based on a kit, the Vector Impedance Analyzer, produced by the Austin QRP Club.  The website on which this kit was available (currently sold out), https://www.qsl.net/k5bcq/Kits/Kits.html, (https://www.qsl.net/k5bcq/Kits/Kits.html,) has considerable documentation which might be of use.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 20, 2019, 11:24:15 pm
I tried running a narrow band sweep, set to 909 data points rather than 101.  The standard deviation is still not real good. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 20, 2019, 11:28:03 pm
Cleaned all the connectors, torqued everything then repeated the test with the same settings.  It had a fairly dramatic effect.   
Title: Re: NanoVNA Custom Software
Post by: gardner on August 21, 2019, 05:03:41 am
The website on which this kit was available

You had an extra comma in the URL which caused it to totally fail.  It took me a few mins to figure it out since the main page has no links to this stuff.

https://www.qsl.net/k5bcq/Kits/Kits.html (https://www.qsl.net/k5bcq/Kits/Kits.html)
Title: Re: NanoVNA Custom Software
Post by: erikka on August 21, 2019, 07:07:26 am
Is your plan to port it to the NanoVNA?
No, as I do not own a nanoVNA, but its sub 50$ price makes it tempting.
All HW dependencies in my SW are in the USB_EZ_interface files. Main part is setting the VNA do to a scan (the "Sweep" function)  and retrieving the data (the "ReadWrite" function), just like the nanoVNA commands
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 21, 2019, 12:27:40 pm
Maybe someone else will port it over.  It looks like it would be a decent interface as is, or as a minimum a good start to one.   Actually, what they have for the Nano wouldn't be too bad if they would fix the readout.   

A while ago, I was playing with a TI 32-bit ADC and put this box together for it.   The plan is to run a longer narrow sweep (same setup as the last test) from a cold start with the nano in this box.

SP
Title: Re: NanoVNA Custom Software
Post by: erikka on August 21, 2019, 03:16:38 pm
The NanoVNA is rather immune to EMC as the DSP IQ demodulator is only sensitive to one very narrow frequency (couple of Hz around the measurement frequency). However when scanning the complete range you may run into spurs from the CPU or SI5351 clock right at the measurement frequency and that translates to impedance deviations
I added a "spectrum analyzer" in my own SW where I disabled the test signal output of the SI5351 and only run the demodulator LO and measure the power present on the selected frequencies. You have to modify the measurement SW in the VNA for this as there is no longer a reference signal to compare to.
This spectrum analyzer mode will quickly show if there are relevant spurs interfering with the impedance measurement. And its useful as a (rather bad) spectrum analyzer
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 21, 2019, 05:37:38 pm
Plots representing over 5 hours of data, using the same settings.  Unit was calibrated while inside the case, everything torqued.  It appears there could be some gains to letting it warm up for a little while.   Standard deviation is just under half.           

All of this data was taken using the Nano's internal calibration.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 21, 2019, 05:46:49 pm
If we only look at the 4 - 150MHz region, basically removing the two ends were it starts to have trouble, the noise is much closer to a gaussian distribution and the standard deviation is 5x lower.   I may try repeating this test using my own calibration routines and see if I can flatten it out.   
Title: Re: NanoVNA Custom Software
Post by: tkamiya on August 21, 2019, 06:28:04 pm
I am very impressed!   :-+
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 21, 2019, 07:02:46 pm
The mechanical relay and some new end launch connectors just arrived for the second attempt at a transfer relay for the Nano.  The plan is to keep the case size the same.  Maybe this one will work good enough to show.   
Title: Re: NanoVNA Custom Software
Post by: radiolistener on August 21, 2019, 07:18:29 pm
Do you talking about these 600+ USD mechanical relay?
https://www.pasternack.com/sma-electromechanical-transfer-switch-18ghz-35watts-24-32volts-f-pe7150-p.aspx (https://www.pasternack.com/sma-electromechanical-transfer-switch-18ghz-35watts-24-32volts-f-pe7150-p.aspx)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 21, 2019, 08:16:35 pm
Do you talking about these 600+ USD mechanical relay?
https://www.pasternack.com/sma-electromechanical-transfer-switch-18ghz-35watts-24-32volts-f-pe7150-p.aspx (https://www.pasternack.com/sma-electromechanical-transfer-switch-18ghz-35watts-24-32volts-f-pe7150-p.aspx)

The mechanical relay and some new end launch connectors just arrived for the second attempt at a transfer relay for the Nano. The plan is to keep the case size the same. Maybe this one will work good enough to show.   


From the datasheet:
Length 2.63 in [66.8 mm]
Width/Diameter 2.16 in [54.86 mm]
Height 1.36 in [34.54 m

Looks like it may not fit.    :-DD :-DD   That said, the Mini-circuits part I linked was half the price.  Both would get the job done.   

As I mentioned, I have an old transfer relay that I could easily drop in and use but my goal wasn't to just show an old relay connected to the Nano like the video I had linked.  That video doesn't show anything about how it is actually used and I doubt many people would want to see me just connect a relay.   I would like to sort out something cost effective that could be replicated.   

That cost effective part is up in the air.  $600+, seems a bit excessive.   :-DD
Title: Re: NanoVNA Custom Software
Post by: ealex on August 22, 2019, 07:47:08 am
@joeqsmith - nice thread

my unit just got here - I've only had time to take it apart ( i's missing the RF section shields ) and run some basic checks

I'll look over the python interface for linux, but the next weeks will be overloaded.
(an idea - make it as an attachment for a RPI3 + LCD -> make a hand-held unit with a nice display - i can duplicate the board without the LCD and make it fit the RPI extension header footprint)

Title: Re: NanoVNA Custom Software
Post by: DL9SAD on August 22, 2019, 01:31:08 pm
Hi Joe,
is it possible to get Gerber-files ior KiCad sources of your attenuator PCBs ?
I watched youe video about MiniVNA and was very imptressed. Great job !

Martin DL9SAD
Title: Re: NanoVNA Custom Software
Post by: profdc9 on August 22, 2019, 02:46:06 pm
While the gain on the SA612 mixers are temperature compensated, it is not perfect temperature compensation.  Furthermore, unless they used C0G capacitors and the like, the capacitance is also likely to have temperature variation as well.  So for best results, plugging it in and waiting for the device to thermally equilibrate is best for the most accurate results.

Also, you can check out my VNA at

http://www.github.com/profdc9/VNA (http://www.github.com/profdc9/VNA)

It is similar to the NanoVNA, but you can assemble it yourself, and it may offer some advantages in accuracy because I actively lock into the intermediate frequency.  But it still requires a thermal warmup period.

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 23, 2019, 01:23:45 am
Isolation is better but still poor compared with the Nano.  However, it may be good enough to do something with.   I was hoping that the isolation specs would have been ultra conservative.  If you want good isolation, it seems you are going to have to pay for it.   :-DD   

I was looking at the poor input match of the Nano but doubt I will try to do anything with it.   I ran a cal using a 1-150MHz sweep, then repeated the T-check without the switch as before.   It smooths it out a bit, which we would expect with more data points but it's a wash.  Errors I suspect are me not taking care to torque it.   But that mismatch is really bad for running these two port tests.   My guess is most people don't care.  After all, its a $50 analyzer, not $50,000.   

I think the thing to do is run the T-check over a 50MHz sort of range using the my full 2-port calibration and see what we come up with.     
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 23, 2019, 01:25:45 am
Hi Joe,
is it possible to get Gerber-files ior KiCad sources of your attenuator PCBs ?
I watched youe video about MiniVNA and was very imptressed. Great job !

Martin DL9SAD

Sorry, I don't sell any products nor do I open source any code or designs.   I will say that AppCad does have a built in strip line calculator that you may be interested in.  The tool is free to download. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on August 23, 2019, 08:42:38 am
is it possible to get Gerber-files ior KiCad sources of your attenuator PCBs ?

some pcb for attenuators and filters, may be it will be useful for you:
https://oshpark.com/profiles/K8VFO
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 23, 2019, 08:26:20 pm
Picture showing the test setup.   

The components for the bias Ts have been added to the transfer relay.   I engraved the copper plate because the steal case is very thin and easy to cut through.   

Using the new transfer relay as shown,  I ran a full 2-port cal from 1 to 500MHz and then ran a T-Check.   It's pretty poor but believe it or not, this is much better performance than I saw with the first prototype.   

For those playing along, I am using an OMRON G6K RF DPDT relay.  These are about $20 USD in singles.   As I mentioned earlier, it behaves like a $20 relay, not a $600 relay.   

****

Added picture of the setup mentioned.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 23, 2019, 08:32:59 pm
I repeated the full 2-port calibration, this time sweeping from 10 to 50MHz.   I'm just wanting to work in a less error prone region.   

The attached shows the results of repeating the T check.   Even with this narrow span, we can see it's still +/-8% error.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 23, 2019, 08:41:54 pm
This is looking at S21 after the 2-port cal, using the thru standard.     

A new reference feature was then added to the software to allow me to easily measure the gain from a 0dB reference.   The second plot is showing the two MidWest Microwave 10dB attenuators attached (shown in the setup picture).   You can find information on these here:

https://www.mouser.com/ProductDetail/Midwest-Microwave-Cinch-Connectivity-Solutions/ATT-0290-10-HEX-02?qs=kRS0rR9cfpUxbNsiwYNf9w%3D%3D (https://www.mouser.com/ProductDetail/Midwest-Microwave-Cinch-Connectivity-Solutions/ATT-0290-10-HEX-02?qs=kRS0rR9cfpUxbNsiwYNf9w%3D%3D)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 23, 2019, 08:54:24 pm
I haven't measured how much input power the Nano can handle before it starts to compress.  Looking at the output signal with a calibrated SA, it was fairly close -9 to -13dB called out in the manual.   It's far from flat.     

The transistor will have a gain of 14dB or so.  -20dB should keep me from out of the non-linear region.   

Replacing the thru section of the cal standard with our test transistor and increasing the bias, we can measure the the gain. 
Title: Re: NanoVNA Custom Software
Post by: TheSteve on August 23, 2019, 08:58:44 pm
I don't know the specs but the price seems right and they are from a serious RF company. Could they possibly be useful?
https://www.ebay.com/itm/Anritsu-MM700022A-Microwave-Switches-Lot-of-2/173844545453 (https://www.ebay.com/itm/Anritsu-MM700022A-Microwave-Switches-Lot-of-2/173844545453)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 23, 2019, 09:06:26 pm
I don't know the specs but the price seems right and they are from a serious RF company. Could they possibly be useful?
https://www.ebay.com/itm/Anritsu-MM700022A-Microwave-Switches-Lot-of-2/173844545453 (https://www.ebay.com/itm/Anritsu-MM700022A-Microwave-Switches-Lot-of-2/173844545453)


Maybe.   Someone would need to look up the datasheets for them.    If you read the posts, again I have a transfer relay that I could easily bolt on but that's not the goal.   

As I mentioned, I have an old transfer relay that I could easily drop in and use but my goal wasn't to just show an old relay connected to the Nano like the video I had linked.  That video doesn't show anything about how it is actually used and I doubt many people would want to see me just connect a relay.   I would like to sort out something cost effective that could be replicated.   

****
Cleanup....

I'm not sure how you would use them.  This is more like what you would want if you were looking for used.  Again, you would need to find the datasheet.  Then being used, it may no longer meet the specified performance.
https://www.ebay.com/itm/RF-Transfer-Relay-with-Suppress-Switch-CS-37S10-DM/163664843937?hash=item261b2f54a1:g:74QAAOSw9Mtcwcod (https://www.ebay.com/itm/RF-Transfer-Relay-with-Suppress-Switch-CS-37S10-DM/163664843937?hash=item261b2f54a1:g:74QAAOSw9Mtcwcod)
Title: Re: NanoVNA Custom Software
Post by: Bicurico on August 23, 2019, 09:54:25 pm
Just a dumb question, sorry if it is stupid.

From what I understood, you want to switch S1 and S2 for different measurements, without having to screw the cables on/off.

Wouldn't a cheap DiSEqC-switch as used for satellite TV reception do the job? The controller that implements the DiSEqC switching could be replaced by some simple logic (press button or whatever).

These switches are optimized for 950MHz-2150MHz, but will handle lower frequencies for sure. They come in all shapes and forms (2 in - 1 out up to 16 in - 1 out or even 16 in - 16 out).

https://en.wikipedia.org/wiki/DiSEqC

Again, sorry if this does not make sense, if so, please explain in a friendly way.

Regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: Bicurico on August 23, 2019, 09:55:11 pm
Sorry: just remembered that TV/CATV/SAT is 75 Ohm and not 50 Ohm.

Regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 23, 2019, 10:01:34 pm
My old antique 70's HP VNA may be a relic but it has some nice features, like a DC-3GHz step attenuator.  Sadly, I don't have one just laying around.

Wanting to get some idea where things start to compress (nano + amp)  one attenuator was removed from the drive but it had little effect.   The second 10dB attenuator was then swapped out for a 3dB part and the test was repeated.  We can see it's now about 2dB low.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 23, 2019, 10:27:49 pm
I suspect the compression is not the DUT but the Nano being over driven.  The Nano would be putting out somewhere below 10dB which shouldn't be a problem for our DUT.   I didn't see in the Nano's manual where they talk about at what point it starts to go nonlinear.   I doubt people care about it. 

To sort it out,  this is the crappy setup.  The whole thing is really a bad outside of a great setup for learning the basics.  It's not something you would want to try and use.   To see if the Nano is compressing, I would like to add a 10dB attenuator after the bias T and see if we get our 16dB back. 

So this nightmare of error prone mess was placed between the DUT and transfer relay.  Ideally I would characterize it, but I really just want to know it we get our gain back.   The large part is a commercial bias T followed by a Midwest BNC style 10 dB attenuator. 

I ran this with the thru and stored that as my reference then repeated the test using our DUT.

Hard to say how the different flavors of Nanos behave or what would be a safe region to use.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 23, 2019, 10:35:42 pm
Just a dumb question, sorry if it is stupid.

From what I understood, you want to switch S1 and S2 for different measurements, without having to screw the cables on/off.

....

Again, sorry if this does not make sense, if so, please explain in a friendly way.

Regards,
Vitor

Yes, I want to flip the cables without disturbing the test setup in order to measure all four S parameters.    This is the job of the transfer relay.   If you want to use two coaxial SPDT relays, you will need to sort out how to combine the signals.  The stub may burn you as well.   

Looking at the picture showing the inside of my HP test set, you can see the transfer relay and step attenuator.  Sitting between them is a SPDT relay.  This relay will terminate the unused pin rather than float it.    Point being if you are going to buy some used relays to make some sort of test set, make sure you locate and read the datasheets first. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 23, 2019, 10:51:44 pm
Corrected post to include the picture showing the test setup.   

https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2638257/#msg2638257 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2638257/#msg2638257)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 24, 2019, 02:00:07 am
I located the original articles I mentioned that talk about using the S-parameters with SPICE.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 24, 2019, 05:10:04 am
The first attached graph shows S21 while sweeping the collector current .   A bit odd as the gain dips sharply when the current is very low.   There is no amplification until roughly sweep 112. 

The second graph is the same setup but driving the DUT a bit harder and zooming in.  The datasheet shows the 1dB compression at 100MHz is roughly 17.5dB.   You can clearly see it has started to compress at 19.
Title: Re: NanoVNA Custom Software
Post by: erikka on August 24, 2019, 10:38:46 am
If I make no mistake interpreting the nanoVNA schematic and the datasheets of the SA612 and the ADC you have to stay below about -10dBm for P2.
The SA612 amplifies about 17dB (below 500MHz). The max input level to the ADC is about 0dBm and the resistor network at P2 reduces the level with about 6dB. Or am I making a mistake?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 24, 2019, 01:54:42 pm
If I make no mistake interpreting the nanoVNA schematic and the datasheets of the SA612 and the ADC you have to stay below about -10dBm for P2.
The SA612 amplifies about 17dB (below 500MHz). The max input level to the ADC is about 0dBm and the resistor network at P2 reduces the level with about 6dB. Or am I making a mistake?

https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2598729/#msg2598729 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2598729/#msg2598729)
Title: Re: NanoVNA Custom Software
Post by: erikka on August 24, 2019, 06:02:05 pm
I was not aware the output spec is the same as the input spec. Please ignore my post  :-[
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 24, 2019, 07:13:32 pm
I was not aware the output spec is the same as the input spec. Please ignore my post  :-[


... I didn't see in the Nano's manual where they talk about at what point it starts to go nonlinear.   I doubt people care about it. 
...
Hard to say how the different flavors of Nanos behave or what would be a safe region to use.   

It should be safe to say it supports a thru without distortion or what would be the point of running a SOLT.   From playing with that transistor, we can get some idea but I haven't looked into it any further.  Staying below the output level should be safe but the dynamic range of the Nano is pretty limited.  My low cost transfer relay certainly doesn't help with this.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 24, 2019, 08:51:49 pm
Plot showing all four S parameters.    This data was collected automatically using the low cost transfer relay, after running a full 2-port calibration.   The T-check was installed as the load. 

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 26, 2019, 12:02:21 am
1000 mating cycles, I like that.

https://youtu.be/U3Fabnw9U04?t=40

Title: Re: NanoVNA Custom Software
Post by: battlecoder on August 26, 2019, 12:13:55 am
I just started following this thread since I'm interested in getting a nanoVNA, and you've done such an impressive work. Thanks for sharing all the research and tests you've done on this device!
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 26, 2019, 02:00:53 am
I just started following this thread since I'm interested in getting a nanoVNA, and you've done such an impressive work. Thanks for sharing all the research and tests you've done on this device!
No problem.  Glad you are finding them of interest. 

In the attached plot, the Nano is used to monitor the effects of applying corona dope to a 5 pole low-pass filter and watching it dry.

The filter was attached to the transfer relay after cal, then used as a baseline.  The plot is the deviation from that baseline. 

The first few sweeps (towards the back), it is reasonably flat with a clean PCB.  The deep blue is after applying the liquid dope.    As it slowly drys, I would expect it to return to normal once fully cured.   
Title: Re: NanoVNA Custom Software
Post by: z33t on August 27, 2019, 04:32:49 pm
Hello,
Can You tell me what "CORRECTION" does to NanoVNA, plase?
It seems that it is something like 10 dB attenuator, but I am not sure.

"CORRECTION" is in "CAL" menu.
Thanks
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 27, 2019, 05:16:43 pm
Hello,
Can You tell me what "CORRECTION" does to NanoVNA, plase?
It seems that it is something like 10 dB attenuator, but I am not sure.

"CORRECTION" is in "CAL" menu.
Thanks

It's just an easy way to enable / disable the correction factors created after the unit was calibrated.   
Title: Re: NanoVNA Custom Software
Post by: z33t on August 27, 2019, 08:31:25 pm
Thanks
Title: Re: NanoVNA Custom Software
Post by: z33t on August 27, 2019, 09:30:03 pm
I have made comparison between Rohde Schwarz and NanoVNA.
The same homemade VHF Helical Band-Pass filter was measured with both instruments.
The results was amazing!
Here is the pictures:
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 27, 2019, 11:31:41 pm
Looking good. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on August 30, 2019, 04:13:24 pm
Someone had asked me about making one more video for the Nano.   As I said in the attached, I am not apposed to it if there is some interest.   Feel free to chime in if there is something else you would like to see.   
Title: Re: NanoVNA Custom Software
Post by: Roland_W on August 31, 2019, 09:42:18 pm
Dear All,

It look like a issue with the calibration procedure, or the calibration method is "simple".
I found some description about VNA project, with the issue of the simple method. http://hforsten.com/improved-homemade-vna.html (http://hforsten.com/improved-homemade-vna.html)

It could be some track for improve the software in this device.
Best regards
Roland
Title: Re: NanoVNA Custom Software
Post by: NY2KW on September 01, 2019, 02:12:13 pm
Instead of GaAs pin diodes you could use this:  https://www.psemi.com/pdf/datasheets/pe4250ds.pdf (https://www.psemi.com/pdf/datasheets/pe4250ds.pdf) which supposedly has better performance up to 3 Ghz

Jerry NY2KW
Title: Re: NanoVNA Custom Software
Post by: Evi on September 01, 2019, 02:15:54 pm

The topic should have been called Private Software.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 01, 2019, 04:31:22 pm
Instead of GaAs pin diodes you could use this:  https://www.psemi.com/pdf/datasheets/pe4250ds.pdf (https://www.psemi.com/pdf/datasheets/pe4250ds.pdf) which supposedly has better performance up to 3 Ghz

Jerry NY2KW

I don't see how that would ever work.   You would need to sketch out how you would use them as I am lost.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 01, 2019, 04:37:25 pm

The topic should have been called Private Software.

As my software continues to evolve, I start thinking maybe it's something that could be useful for others,  but then comments like yours bring me back to reality.  So thanks for that wake up call.

SP
Title: Re: NanoVNA Custom Software
Post by: 5q5r on September 01, 2019, 09:26:18 pm
Inspired by Joe's great YouTube videos on the NanoVNA, I went ahead and botched together a little Python app that does some of the same things (most importantly, multiple sweeps to increase the amount of data points.)

It's open source and on github, as "NanoVNA-Saver" (because I initially just made it to save s1p/s2p files). I daren't post a link in my first post on this forum though :-)

Thanks Joe for the inspiration, and I hope some of the rest of you may find it useful.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 01, 2019, 11:11:02 pm
Inspired by Joe's great YouTube videos on the NanoVNA, I went ahead and botched together a little Python app that does some of the same things (most importantly, multiple sweeps to increase the amount of data points.)

It's open source and on github, as "NanoVNA-Saver" (because I initially just made it to save s1p/s2p files). I daren't post a link in my first post on this forum though :-)

Thanks Joe for the inspiration, and I hope some of the rest of you may find it useful.

Welcome to the forum.

I just released a viewer Q&A video for the Nano that you may be interested in as well.   

https://www.youtube.com/watch?v=GJNMnq8eD0E (https://www.youtube.com/watch?v=GJNMnq8eD0E)
Title: Re: NanoVNA Custom Software
Post by: N2CUA on September 02, 2019, 03:08:03 pm

The topic should have been called Private Software.

As my software continues to evolve, I start thinking maybe it's something that could be useful for others,  but then comments like yours bring me back to reality.  So thanks for that wake up call.

SP

Thats sad .. One guy ruined it for the rest of us :(   
I truly appreciate your hard work and attention to detail ..
You have a lot of awesome videos .   ( is it working? lol )
You truly do though ..

Would love to play with that software ..
Can I trade you for a few mini-circuits SMA style attenuators? ;)

I used to program .. but it was awhile ago ..  retired USAF TSgt ..
So have some extra time to play and try to keep my mind active ..

Just bought the NanoVNA .. and still learning ..
Ham radio operator - N2CUA

Either way .. thanks so much for all your great info ..
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 02, 2019, 04:14:43 pm

The topic should have been called Private Software.

As my software continues to evolve, I start thinking maybe it's something that could be useful for others,  but then comments like yours bring me back to reality.  So thanks for that wake up call.

SP

Thats sad .. One guy ruined it for the rest of us :(   
I truly appreciate your hard work and attention to detail ..
You have a lot of awesome videos .   ( is it working? lol )
You truly do though ..

Would love to play with that software ..
Can I trade you for a few mini-circuits SMA style attenuators? ;)

I used to program .. but it was awhile ago ..  retired USAF TSgt ..
So have some extra time to play and try to keep my mind active ..

Just bought the NanoVNA .. and still learning ..
Ham radio operator - N2CUA

Either way .. thanks so much for all your great info ..

Thank you for your service to our country. 

I'm glad you enjoyed the videos and thread.  This was put together for a friend of mine who wanted to learn a little more about VNAs and I decided to try and help them along.   Their use of the VNA is more for PCB design.  Personally, electronics has been one of my hobbies for many years.  I have been in a continual state of learning but still know hardly anything about it.   

I've never understood where certain people came up with the idea that I owe them.   It's not what I would expect from a technical community and I'm sure it's obvious that my threshold is fairly low when dealing with them.   :-DD
Title: Re: NanoVNA Custom Software
Post by: N2CUA on September 02, 2019, 04:25:29 pm
Yeah I never got that concept either ..
My sister is a bit like that .. but she's family so I just accept it for what it is and try to find ways to make her see ( gently ) that its just not the case .. Takes time ... but I think she is coming around .. a bit of tough love though .. 

I hope you change your mind at some point .. but thats your call of course..

Thanks for the kind words .. :)

You would think with all the available data on the USB bus coming from the VNA that there would be a more robust interface ..
But still ... for the price its great and I dont have to lug my Rigol spectrum analyzer around when helping friends with their antennas ..

Randy
Title: Re: NanoVNA Custom Software
Post by: Psynosaur on September 02, 2019, 04:32:46 pm
Thanks to the OP joeqsmith.

Your videos are very educational and well put together :)

Then thanks 5q5r for your nanovna - saver app, it quite a treat playing with it :D

Kind regards

Keep the information coming!

ZS1SCI
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 03, 2019, 11:46:53 am
5q5r

I tried your prebuilt EXE on Windows 10.  It connected to the Nano and I was able to get it to plot the data without any problems.   It looks like a very good start.   So far, I think you are the only one who has stepped up and shown something other than lip service.   With the number of people asking for open source, Python code, you are making a lot of people very happy.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 03, 2019, 12:00:23 pm
Yeah I never got that concept either ..
My sister is a bit like that .. but she's family so I just accept it for what it is and try to find ways to make her see ( gently ) that its just not the case .. Takes time ... but I think she is coming around .. a bit of tough love though .. 

I hope you change your mind at some point .. but thats your call of course..

Thanks for the kind words .. :)

You would think with all the available data on the USB bus coming from the VNA that there would be a more robust interface ..
But still ... for the price its great and I dont have to lug my Rigol spectrum analyzer around when helping friends with their antennas ..

Randy

I'm a bit surprised myself that the PC software was released in its current state.    You could have a look at 5q5r's code.  Obviously they are just getting started but it looks promising.

https://github.com/mihtjel/nanovna-saver

Title: Re: NanoVNA Custom Software
Post by: hendorog on September 03, 2019, 12:03:58 pm
I haven't been following this thread, but if anyone is interested:

Here are some examples of offline calibrations, comparative tests with my HP 8753 and another NanoVNA, and a TDR example.

https://github.com/hendorog/nanovna_test
This uses the free Jupyter Notebook which you need to install if you want to play on your machine with this code.
Apologies in advance as the comments are pretty sparse, most were done as part of conversations on groups.io.

Note, I am not grabbing the data automatically yet, this is just for offline analysis at the moment. I have been using the NanoVNA C# app to get the s1p files to date.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 03, 2019, 10:14:45 pm
hendorog, what mixers are used in your nanovna version - SA602 or SA612?

Can you take S1P for some load different than 50 Ohm?
For example 500 Ohm (SWR=10.0) will be a good choice for testing nano vna precision.
You can create such dummy load with SMA connector and two 1k SMD resistors soldered on it.

Such dummy loads - 500 Ohm and 5 Ohm is a must have for VNA testing and calibration. They both should give SWR=10.
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 03, 2019, 11:14:53 pm
hendorog, what mixers are used in your nanovna version - SA602 or SA612?

Can you take S1P for some load different than 50 Ohm?
For example 500 Ohm (SWR=10.0) will be a good choice for testing nano vna precision.
You can create such dummy load with SMA connector and two 1k SMD resistors soldered on it.

Such dummy loads - 500 Ohm and 5 Ohm is a must have for VNA testing and calibration. They both should give SWR=10.

The last graph on this page https://github.com/hendorog/nanovna_test/blob/master/NanoVNA%20test.ipynb (https://github.com/hendorog/nanovna_test/blob/master/NanoVNA%20test.ipynb) shows nanovna and 8753 measurements of a reference attenuator provided with my cal compared with reference data provided by Dr Kirkby.
(Note the 8753 was intentionally setup to match the nanovna, without any cal kit information. When properly configured for the cal kit, the 8753 will match the green line closely)

This gives a good idea of the out of the box accuracy of the device using its own (uncharacterised) cal kit against an independently measured standard above 50MHz.

Will do some more tests for you, but if I don't get it done tonight it might be a while due to other commitments.

My two devices (white gecko and black hugen) both have 602 mixers. I have read that the two models of mixers are internally identical but no idea if that has been confirmed.

Title: Re: NanoVNA Custom Software
Post by: hendorog on September 03, 2019, 11:22:53 pm
Also, just to add there is a known bug in the released NanoVNA sharp application when using it to do calibrations.

The measurement of the other standards are discarded unless the Short is the first standard measured.

This is because the Short button click event in the NanoVNA sharp app does a call to the 'cal_reset' operation - which wipes any earlier measurements out.

So if you do a cal in Open Short Load order using the NanoVNA sharp application, there will be an error of about 0.3dB - not much, but significant enough to be important when doing comparisons as can be seen in the attached pic.

First pic attached showing the effect of doing OSL cal order.
Second pic attached which is the same as in the previous post, showing the workaround of doing SOL cal order.

Title: Re: NanoVNA Custom Software
Post by: N2CUA on September 03, 2019, 11:54:44 pm
Inspired by Joe's great YouTube videos on the NanoVNA, I went ahead and botched together a little Python app that does some of the same things (most importantly, multiple sweeps to increase the amount of data points.)

It's open source and on github, as "NanoVNA-Saver" (because I initially just made it to save s1p/s2p files). I daren't post a link in my first post on this forum though :-)

Thanks Joe for the inspiration, and I hope some of the rest of you may find it useful.

Would you be up to helping me set up my Python on windows 10? Its installed but having issues with installing PyQT5. Python is completely new to me ..  Not sure if its worth all this just to have a better interface .. :(
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 04, 2019, 01:50:05 am
My two devices (white gecko and black hugen) both have 602 mixers. I have read that the two models of mixers are internally identical but no idea if that has been confirmed.

It looks that SA612A works much better. My NanoVNA have SA602A mixers. Here is my 500 Ohm terminator measurement:

Series RLC:
[attach=2]

Parallel RLC:
[attach=3]

Also see S1P file for SA602A version with 500R terminator on CH0 in attachment.


Here is also screenshot for 500R terminator from another user, who have NanoVNA with SA612A:
[attach=4]

As you can see, SA612A looks much better and works almost up to 900 MHz with above 200 Ohm result. While SA602A is going below 200 Ohms at just 160 MHz. But I'm not sure. May be this is just quality issue with my NanoVNA (for example bad soldering or something like that).

It will be good if you can confirm that your SA602A version also has bad performance on Series RLC screen. So, if SA602A is the root of cause for that, then it probably can be fixed by replacement SA602A mixers with SA612A :)
Title: Re: NanoVNA Custom Software
Post by: N2CUA on September 04, 2019, 02:45:20 am
Inspired by Joe's great YouTube videos on the NanoVNA, I went ahead and botched together a little Python app that does some of the same things (most importantly, multiple sweeps to increase the amount of data points.)

It's open source and on github, as "NanoVNA-Saver" (because I initially just made it to save s1p/s2p files). I daren't post a link in my first post on this forum though :-)

Thanks Joe for the inspiration, and I hope some of the rest of you may find it useful.

Would you be up to helping me set up my Python on windows 10? Its installed but having issues with installing PyQT5. Python is completely new to me ..  Not sure if its worth all this just to have a better interface .. :(


I got it working .. Just have to learn PYTHON now .. lol
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 04, 2019, 03:48:57 am
My two devices (white gecko and black hugen) both have 602 mixers. I have read that the two models of mixers are internally identical but no idea if that has been confirmed.


As you can see, SA612A looks much better and works almost up to 900 MHz with above 200 Ohm result. While SA602A is going below 200 Ohms at just 160 MHz. But I'm not sure. May be this is just quality issue with my NanoVNA (for example bad soldering or something like that).

It will be good if you can confirm that your SA602A version also has bad performance on Series RLC screen. So, if SA602A is the root of cause for that, then it probably can be fixed by replacement SA602A mixers with SA612A :)

Interesting - based on the hint I mentioned, I searched and found this story on the internet:
https://soldersmoke.blogspot.com/2009/06/na5n-on-ne602.html

I'll do that test, tonight if I have time, and I will also sweep the loads on my 8753 for comparison.



Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 04, 2019, 08:22:19 am
it seems that my NanoVNA with SA602A may be OK. Probably this measurement error caused by 1 cm SMA-M to SMA-M adapter (https://www.aliexpress.com/item/32818446366.html). I tried to add two adapters on another VNA and got similar measurement error.

Just incredible, 1 cm SMA to SMA adapter leads to so high measurement error...  :)
Title: Re: NanoVNA Custom Software
Post by: N2CUA on September 04, 2019, 01:22:40 pm
it seems that my NanoVNA with SA602A may be OK. Probably this measurement error caused by 1 cm SMA-M to SMA-M adapter (https://www.aliexpress.com/item/32818446366.html). I tried to add two adapters on another VNA and got similar measurement error.

Just incredible, 1 cm SMA to SMA adapter leads to so high measurement error...  :)

Can you try a calibration with all cables and connectors that will be used in place ?
Other than the needed calibration items of course
Title: Re: NanoVNA Custom Software
Post by: Flynt on September 04, 2019, 05:22:08 pm
A greeting to the whole group.
I'm a new user.

I tried to follow all the Treead, but I don't read English well, (I'm Italian).

I would like to ask you if anyone can kindly tell me where to recover this software "Custom Lab View for Nano VNA"

THANK YOU ANTICIPATEDLY WHO WILL MAKE ME AID ... :) :) :)
Title: Re: NanoVNA Custom Software
Post by: _Wim_ on September 04, 2019, 06:44:22 pm
A greeting to the whole group.
I'm a new user.

I tried to follow all the Treead, but I don't read English well, (I'm Italian).

I would like to ask you if anyone can kindly tell me where to recover this software "Custom Lab View for Nano VNA"

THANK YOU ANTICIPATEDLY WHO WILL MAKE ME AID ... :) :) :)

Hello Flynt, for the moment ;) this software is not available for download. It was developed by joeqsmith to show what is possible with the Nanovna, to make some educational youtube video's about the NanoVNA and to inspire others to make apps of their own (which has worked already, thanks to 5q5r)

Title: Re: NanoVNA Custom Software
Post by: Flynt on September 04, 2019, 07:18:56 pm
Thanks Wim
I've already written a private message to joeqsmith, to know how to get it ... :)

I'm not able to program... :-\
Title: Re: NanoVNA Custom Software
Post by: _Wim_ on September 04, 2019, 08:51:43 pm
I think this software is a good alternative to what joeqsmith has made:

https://github.com/mihtjel/nanovna-saver

Title: Re: NanoVNA Custom Software
Post by: _Wim_ on September 04, 2019, 08:56:05 pm
The executable can be downloaded from here if you do not want to run it in phython (download the zip file)

https://github.com/mihtjel/nanovna-saver/releases

Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 04, 2019, 09:09:31 pm
Can you try a calibration with all cables and connectors that will be used in place ?
Other than the needed calibration items of course

The problem here is that all calibration loads should be connected through the same length as 500 Ohm terminator.

Here is my calibration kit and 500 Ohm terminator:
[attach=1]

As you can see, it's about 15 mm longer than calibration terminators. It leads to additional delay in wave propagation and as result it leads to measurement error.

You can check my previous S1P file for 500R terminator, see Group Delay S11, it's about 0.25 ns.

Now I tried to setup ELECTRICAL DELAY = 247 picoseconds (see SCALE menu in NanoVNA) to get software correction for that delay. I tried different values and 247 ps give me the best result. So it seems like these 15 mm leads to 247 ps delay. And now, with 247 ps delay correction, I get much better result :)

Series RLC:
[attach=2]

Parallel RLC:
[attach=3]

Group Delay S11:
[attach=5]

S11:
[attach=6]

VSWR:
[attach=7]
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 04, 2019, 09:50:19 pm
Here is another finding. When I tried to get the same measurement (with electric delay 247 ps) for 500R terminator with no connection to PC (powered from accumulator), it shows 500 Ohm and VSWR=10 almost up to 900 MHz.

For example:
600 MHz: Rs = 550 Ohm, VSWR = 11.07
700 MHz: Rs = 501 Ohm, VSWR = 10.03
800 MHz: Rs = 478 Ohm, VSWR = 9.62
900 MHz: Rs = 462 Ohm, VSWR = 9.08

So, it seems that USB connection to PC affects measurements...

Tried more tests about that. When I connect it to powered off power bank, there is no influence, but after power on, there is a change in measurement above 500 MHz. It seems that external power supply leads to increase power supply voltage and it affects measurement.

I tried to calibrate it with external power supply, but it seems, that calibration cannot eliminate measurement error which appears with external power supply. So, the only way to get the best measurement is to disconnect device from external power supply. Very strange. Any idea how to fix it?
Title: Re: NanoVNA Custom Software
Post by: rhb on September 04, 2019, 11:09:22 pm
I checked the pinout of  the STM32F303CCT6 with 48 KB of RAM and 256 KB of flash today and it should be a drop-in replacement for the existing STM32F072CBT6.  The 3x increase in RAM and 2x increase in flash would allow a substantial increase in features such as TDR, storing multiple calibration ranges, etc.  The groups.io list is a firehose of activity.

I was going to do the chip swap myself, but one of the sellers, hugen, has offered to provide a unit with the '303 part.  I expect that will be very popular with people wanting to write FW with additional features.  So I'm hoping for an announcement that '303 based units are available for  an extra $5-10 US.  In quantity 2400 from Digikey, the price differential is $1.28 US.  $1.92 vs $3.20 for the MCU.  That makes it an attractive change for an OEM if it allows more features.

The 16 KB memory of the current versions is a significant limitation.  An important application for the additional memory is TDR from VNA data. There are already multiple implementations for producing TDR traces from VNA data being done on a PC, but no room for it on the device.

The existing FW should run on the larger part unaltered, so buying a unit with the STMF303 part  makes it easy for a buyer who is not interested in writing FW to do updates as things develop.  This is the RF version of the $20 LCR-transistor tester.  Hang on to your hats!

Have Fun!
Reg
Title: Re: NanoVNA Custom Software
Post by: rhb on September 04, 2019, 11:19:40 pm
Here is another finding. When I tried to get the same measurement (with electric delay 247 ps) for 500R terminator with no connection to PC (powered from accumulator), it shows 500 Ohm and VSWR=10 almost up to 900 MHz.

For example:
600 MHz: Rs = 550 Ohm, VSWR = 11.07
700 MHz: Rs = 501 Ohm, VSWR = 10.03
800 MHz: Rs = 478 Ohm, VSWR = 9.62
900 MHz: Rs = 462 Ohm, VSWR = 9.08

So, it seems that USB connection to PC affects measurements...

Tried more tests about that. When I connect it to powered off power bank, there is no influence, but after power on, there is a change in measurement above 500 MHz. It seems that external power supply leads to increase power supply voltage and it affects measurement.

I tried to calibrate it with external power supply, but it seems, that calibration cannot eliminate measurement error which appears with external power supply. So, the only way to get the best measurement is to disconnect device from external power supply. Very strange. Any idea how to fix it?

My first guess would be EMI coming in on the power cable.  Does the cable you're using have chokes?
Title: Re: NanoVNA Custom Software
Post by: tautech on September 04, 2019, 11:25:02 pm
The sweep width and the few data points available is also a significant limitation on accuracy. Joe showed this earlier where the interpolation with so few points had it drawing a series of straight lines on the Smith chart.
The user needs keep this data point limitation firmly in mind and use a sweep width that's appropriate and a heap of averaging if necessary.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 05, 2019, 12:01:40 am
My first guess would be EMI coming in on the power cable.  Does the cable you're using have chokes?

I also thought about it. But this is not the case. I can connect any length of cable and it doesn't affect measurement. Also I tried to connect cable to power bank with disabled output and it doesn't affect measurement. But when I press power on button on power bank, it leads to measurement error. So, the the issue appears when external voltage is applied and don't depends on the cable.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 05, 2019, 12:18:19 am
After some period of time I found that cable influence disappears.  ??? May be it happens when battery is charging. And when battery is full this effect disappears.

Here is 500 Ohm terminator measurement with 247 ps correction for wave propagation delay in SMA-SMA adapter:

[attach=2][attach=3][attach=4]

Now it looks great  ^-^


By the way, my NanoVNA has 3.7V 450 mAh battery and can work from battery up to 130 minutes.
Title: Re: NanoVNA Custom Software
Post by: rhb on September 05, 2019, 12:34:22 am
You probably should probe the output of U3 with a scope and DMM and see what Vdd looks like with and without external power.

The +5 V connection on terminal 3 of U3 looks as if it would power the whole board any time the USB had 5 V unless it's an unconnected power input.  But it looks to me as if it is coming from the USB.  So I'm a bit puzzled by the schematic.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 05, 2019, 12:54:09 am
Confirmed. Measurement is affected when battery is charging.
When charge LED stops flashing, measurement error disappears.

I tried to measure voltage between GND and VDD on ST-LINK connector.

When powered from the battery: 3.3350 V
When external power connected: 3.3306 V
After some time with ext. power: 3.3325 V (measurement error is still present)
When charge LED stops flashing: 3.3339 V (measurement error disappears)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 05, 2019, 01:03:37 am
Someone had posted this comment about torque wrenches.  This is my super expensive torque wrench calibration station.   The bolt that holds the scale and hex standoff is mounted on two ball bearings that were clamped in the Panavice.   The steal is very close to 1lb.      Lower right, you can see the screwdriver style and my modified deep wall socket.  Also my ultra thin spanner that is used to hold some of the SMA parts, when using the torque wrench.   

After reading their comment, I would be very interested in knowing how much other SMA torque wrenches vary as they describe.  As I note, mine is about 1" and you need to choke up on the rubber to get to 8".   I could see more error in the technique used if you didn't follow the instructions.   
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 05, 2019, 01:16:43 am
Confirmed. Measurement is affected when battery is charging.
When charge LED stops flashing, measurement error disappears.

I tried to measure voltage between GND and VDD on ST-LINK connector.

When powered from the battery: 3.3350 V
When external power connected: 3.3306 V
After some time with ext. power: 3.3325 V (measurement error is still present)
When charge LED stops flashing: 3.3339 V (measurement error disappears)

Very interesting discovery. I had not heard of that and it might explain a few issues people are having comparing similar devices.

I'll try and replicate as all of my testing has been done with the devices plugged in.
Title: Re: NanoVNA Custom Software
Post by: KE5FX on September 05, 2019, 01:19:41 am
Choking up on the wrench should make no difference to the breakover torque.  That's the whole idea behind a torque wrench. 

That said, it does make a subtle difference regarding how the force is applied.  There is one right way and (numerous) wrong ways to use a torque wrench (actually two wrenches) on high-grade connectors.  A great operator training guide was created for UC Berkeley students at one point but I couldn't find a straightforward .PDF edition, just a bunch of skeevy links to "slide sharing" sites and (with some effort) the original PowerPoint file.  I went ahead and printed it to a .PDF, linked here (http://www.ke5fx.com/VNA_equipment_calibration_connector_handling_care.pdf) (61 pages, 6 MB).

Highly recommended reading even if (like me) you blow off 80% of these guidelines in day-to-day use.  At least you will know what you're doing wrong.  >:D
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 05, 2019, 01:59:16 am
Choking up on the wrench should make no difference to the breakover torque.  That's the whole idea behind a torque wrench. 

That said, it does make a subtle difference regarding how the force is applied.  There is one right way and (numerous) wrong ways to use a torque wrench (actually two wrenches) on high-grade connectors.  A great operator training guide was created for UC Berkeley students at one point but I couldn't find a straightforward .PDF edition, just a bunch of skeevy links to "slide sharing" sites and (with some effort) the original PowerPoint file.  I went ahead and printed it to a .PDF, linked here (http://www.ke5fx.com/VNA_equipment_calibration_connector_handling_care.pdf) (61 pages, 6 MB).

Highly recommended reading even if (like me) you blow off 80% of these guidelines in day-to-day use.  At least you will know what you're doing wrong.  >:D


https://www.youtube.com/watch?v=RsMxtEx0uik (https://www.youtube.com/watch?v=RsMxtEx0uik)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 05, 2019, 02:15:27 am
I had mentioned in the last video I made about the limited resolution (distance) when making TDR measurements.    I talked a bit about how you may be able improve it but with it being a $50 unit, I don't see much of a point.   Well except for the pure fun of it.....

So I talked it over with a friend of mine and we had a good laugh about the whole project.  He offered one idea that should help improve the setup but it's all a guess if the Nano can actually be used this way and get any useful information from it.   Of course, cost will need to be ignored which is part of the humor.... 
 
First baby step,  modify my software to support the range extender.   It may not look like anything is going on in the attached plot, but what you see the Nano using Channel 1 for S11.  That's not a misprint.   Granted, it's only 100MHz.    :-DD   Like I said, baby step.   

***
Should mention, yes, it is indeed a 100 ohm resistor. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 05, 2019, 02:30:28 am
If you read the document you linked, on page 14, they show the hand placement.  That is the marking that the person commenting on my video mentions.   He is absolutely correct that it will have an effect which is why this training manual talks about it.  Page 15, they show the damaged connector after the person chokes up on the wrench.   

What I would like to know is how much of an effect various wrenches have.  I only have the one click type. 
Title: Re: NanoVNA Custom Software
Post by: KE5FX on September 05, 2019, 02:37:55 am
If you read the document you linked, on page 14, they show the hand placement. 

Yes, together with the completely bogus reasoning that it has anything to do with the grasping point along the moment arm. 

It's still a good document, IMO, despite that.

Quote
That is the marking that the person commenting on my video mentions.   He is absolutely correct that it will have an effect which is why this training manual talks about it.  Page 15, they show the damaged connector after the person chokes up on the wrench.   What I would like to know is how much of an effect various wrenches have.  I only have the one click type.

I've always found that I can apply pretty much whatever torque I want by holding it in a certain (incorrect) way, whether dealing with a ratchet or an open-ended torque wrench.  The angle at which you apply the force is important, but the distance along the handle considered by itself is not.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 05, 2019, 02:45:23 am
Again, you can lead the horse to water....  But I can't help you. 
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 05, 2019, 03:11:44 am
If you read the document you linked, on page 14, they show the hand placement. 

Yes, together with the completely bogus reasoning that it has anything to do with the grasping point along the moment arm. 

It's still a good document, IMO, despite that.

Quote
That is the marking that the person commenting on my video mentions.   He is absolutely correct that it will have an effect which is why this training manual talks about it.  Page 15, they show the damaged connector after the person chokes up on the wrench.   What I would like to know is how much of an effect various wrenches have.  I only have the one click type.

I've always found that I can apply pretty much whatever torque I want by holding it in a certain (incorrect) way, whether dealing with a ratchet or an open-ended torque wrench.  The angle at which you apply the force is important, but the distance along the handle considered by itself is not.

Hmm, I am not so sure. I think that the position of the force you apply to the handle will matter - because of the construction of the wrench. The breaking 'knuckle' is offset from the centre of rotation of the nut.

So there are two levers involved- one from your hand to the nut, and a shorter one from your hand to the knuckle.

If you were to use the wrench and measure the exact force to the end of the handle to break the knuckle, then:
Reduce the hand-knuckle lever length to 10% of what it was, then obviously you will need to apply 10 times more force to break the knuckle. Force x distance.
Now 10 times more force is being applied to the end of the hand-nut lever. The lever is shorter than it was, but it is not 90% shorter because of the nut-knuckle distance hasn't changed.

That is also the case - but with a smaller nut to knuckle distance - in the posted video.

Title: Re: NanoVNA Custom Software
Post by: KE5FX on September 05, 2019, 03:20:32 am

That is also the case - but with a smaller nut to knuckle distance - in the posted video.

But that's a different moment arm than the one shown in the document.

As long as you hold the torque wrench somewhere along the actual handle (i.e., the red part shown here (https://www.fairviewmicrowave.com/sma-fixed-torque-wrench-click-st-sma3-p.aspx), using the model of torque wrench I have here as an example) you will be able to deliver the specified torque or something very close to it.  It (should) go without saying that if you grab the wrench just behind the knuckle, you can apply pretty much whatever force you want in whatever direction you want. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 05, 2019, 03:31:46 am
I like this website for practical information:

https://www.microwaves101.com/encyclopedias/torque-wrench (https://www.microwaves101.com/encyclopedias/torque-wrench)
https://www.microwaves101.com/encyclopedias/connector-care (https://www.microwaves101.com/encyclopedias/connector-care)

Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 05, 2019, 03:54:42 am
It seems that CH1 on my NanoVNA has not so good VSWR, is it ok?
[attach=1][attach=2]
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 05, 2019, 04:16:54 am

That is also the case - but with a smaller nut to knuckle distance - in the posted video.

But that's a different moment arm than the one shown in the document.

Same principle applies, just different dimensions.

Quote
As long as you hold the torque wrench somewhere along the actual handle (i.e., the red part shown here (https://www.fairviewmicrowave.com/sma-fixed-torque-wrench-click-st-sma3-p.aspx), using the model of torque wrench I have here as an example) you will be able to deliver the specified torque or something very close to it.  It (should) go without saying that if you grab the wrench just behind the knuckle, you can apply pretty much whatever force you want in whatever direction you want. 


Makes sense to me - as long as it's designed for that usage, so that it stays it in the torque range its spec'd for - or at least not far enough out of range to break stuff if you aren't doing critical stuff.

Title: Re: NanoVNA Custom Software
Post by: edigi on September 05, 2019, 07:50:38 am
Confirmed. Measurement is affected when battery is charging.
When charge LED stops flashing, measurement error disappears.

I tried to measure voltage between GND and VDD on ST-LINK connector.

When powered from the battery: 3.3350 V
When external power connected: 3.3306 V
After some time with ext. power: 3.3325 V (measurement error is still present)
When charge LED stops flashing: 3.3339 V (measurement error disappears)

My NanoVNA creates zig-zags on the display between 295 and 300 MHz when the battery is low or charging. Not a surprise that it's sensitive to supply voltage in that frequency range, as per datasheet the clock chip supposed to operate till 200 MHz...
I heavily suspect that the random lines occasionally appearing is also not just a drawing error but a consequence of this.

As for the torque wrench I don't think that the low frequency range and precision of NanoVNA justifies it (it's more like a waste of money and time for this level), the SMA connector can be tightened without it quite well but NanoVNA is just the perfect tool to check this.

Replacing the MCU is an interesting idea. What would be even more interesting if clock chip could be replaced with something that allows operation up till 2-3 GHz range (means mixer replacement as well...). Probably the resistor bridge would not cut it till 6 GHz but still if clocking (test signal generation) could be improved it would be a significant improvement (sure, not in this price range as significantly more expensive chips would need to be used...).
Note: When there is integer relationship between the clock source of the clock chip and its output signal is quite OK, but when I set 800MHz it's not so clean anymore (it uses 3rd harmonic, so in reality chip is set to 266.6...MHz or so)..
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 05, 2019, 08:07:53 am
My NanoVNA creates zig-zags on the display between 295 and 300 MHz when the battery is low or charging.

Is your NanoVNA has these zig-zag spikes at 300 MHz with low battery only?  ???
My one always have these 300 MHz spikes... Sometimes it higher, sometimes lower, but it always here...

Here is CH0 and CH1 both terminated with 50 Ohm:
[attach=2]

What is your CH1 SWR at 900 MHz?  (just connect CH0 to CH1 with good cable to measure it)

My CH1 SWR is 1.31. Measured with 15 cm RG405:
[attach=1]

Cable delay is 1550 ps. I entered it into ELECTRICAL DELAY, and it shows Rs = 41 Ohm at 900 Mhz...
Title: Re: NanoVNA Custom Software
Post by: Flynt on September 05, 2019, 09:23:41 am
joeqsmith,i Sent You a PVT Message....

TANKYOU VERY MUCH
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 05, 2019, 12:13:39 pm
As long as you hold the torque wrench somewhere along the actual handle (i.e., the red part shown here (https://www.fairviewmicrowave.com/sma-fixed-torque-wrench-click-st-sma3-p.aspx), using the model of torque wrench I have here as an example) you will be able to deliver the specified torque or something very close to it.  It (should) go without saying that if you grab the wrench just behind the knuckle, you can apply pretty much whatever force you want in whatever direction you want. 
Makes sense to me - as long as it's designed for that usage, so that it stays it in the torque range its spec'd for - or at least not far enough out of range to break stuff if you aren't doing critical stuff.

Which if you read my response, it pretty much what I had stated. 
Quote
Looking at the error of the torque wrench shown, using a knife blade and going from one end of the handle to the other, the variance is about 1" lb. Still well within spec no matter where you hold it.
  Obviously the torque is dependent on the position but my question is how much do different wrenches vary.  I assume many of you have them and would know or at least be able to measure them within some degree of accuracy.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 05, 2019, 12:35:04 pm
joeqsmith,i Sent You a PVT Message....

TANKYOU VERY MUCH

I appreciate your enthusiasm for the Nano and your wanting to try other software.  As you were told by _Wim_ and I have stated a few times in this thread, mentioned in my videos and answered numerous time in the comments, the answer is the same. 

Your persisting to SPAM my inbox after clearlying being told no, is part of the reason I won't release it.  I just don't have the time to support it.   

***
As _Wim_ mentioned, you should look at some of the other software being offered here.    It seems that they are off to a very good start and could use some encouragement. 
Title: Re: NanoVNA Custom Software
Post by: Flynt on September 05, 2019, 03:07:01 pm
 :'( :'( :'(

joeqsmith, I apologize, for what you call "SPAM", but I didn't get any of your Rejection messages, and as I wrote you, I don't read English well and I can't program ... I just needed your software, to work and I was even willing to give you a donation.

I can't use a Translator to convert 10 pages of trhead ...

Okay it does nothing, I will use the original software. :-\ :-\ :-\

Thanks anyway, even if it didn't cost you anything send it to me ...
Title: Re: NanoVNA Custom Software
Post by: _Wim_ on September 05, 2019, 06:45:58 pm
It seems that CH1 on my NanoVNA has not so good VSWR, is it ok?
[attach=1][attach=2]

I think this is caused by the input impedance of channel 2 in your method, not by channel 1. If you connect your calibration load to ch1 (and preferably calibrate the NanoVNA with a smaller bandtwidt, for example 800M to 900M) you can achieve a VSWR or 1.02 (S11 of -40dB) for 800M<->900M, and even better for lower frequencies.
Title: Re: NanoVNA Custom Software
Post by: edigi on September 05, 2019, 07:04:55 pm
My CH1 SWR is 1.31. Measured with 15 cm RG405:

It's roughly the same (1.33) here.
For the price though there is still nothing to complain.

_Wim_
NanoVNA has CH0 and CH1 and what is meant is what you describe (just naming is different).
Title: Re: NanoVNA Custom Software
Post by: _Wim_ on September 05, 2019, 07:09:56 pm

_Wim_
NanoVNA has CH0 and CH1 and what is meant is what you describe (just naming is different).

 |O

Mine is indeed also simular than. When calibrated with a 100Mhz span it drops a little to 1.28.
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 05, 2019, 07:23:47 pm
As long as you hold the torque wrench somewhere along the actual handle (i.e., the red part shown here (https://www.fairviewmicrowave.com/sma-fixed-torque-wrench-click-st-sma3-p.aspx), using the model of torque wrench I have here as an example) you will be able to deliver the specified torque or something very close to it.  It (should) go without saying that if you grab the wrench just behind the knuckle, you can apply pretty much whatever force you want in whatever direction you want. 
Makes sense to me - as long as it's designed for that usage, so that it stays it in the torque range its spec'd for - or at least not far enough out of range to break stuff if you aren't doing critical stuff.

Which if you read my response, it pretty much what I had stated. 
Quote
Looking at the error of the torque wrench shown, using a knife blade and going from one end of the handle to the other, the variance is about 1" lb. Still well within spec no matter where you hold it.
  Obviously the torque is dependent on the position but my question is how much do different wrenches vary.  I assume many of you have them and would know or at least be able to measure them within some degree of accuracy.   

Cool, I was responding to KE5FX, no sorry I didn't see your response or question at the time.

Another option is to work that effect out just from dimensions of the wrenches which might be easier info to get from people.

Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 05, 2019, 10:35:51 pm
joeqsmith, it seems that you have professional vector analyzer and other equipment.

Could you please measure CH1 input impedance of NanoVNA?
Two sweeps for 1-300 MHz and for 1 MHz - 1.5 GHz will be nice to see how it can be used with direct mode (1-300 MHz) and with extended mode (1-1.5 GHz).

It seems that CH0 has pretty good performance, but CH1 going to SWR=1.32 at 900 MHz which may affect measurements. What is your thoughts about it?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 05, 2019, 10:40:25 pm
:'( :'( :'(

joeqsmith, I apologize, for what you call "SPAM", but I didn't get any of your Rejection messages, and as I wrote you, I don't read English well and I can't program ... I just needed your software, to work and I was even willing to give you a donation.

I can't use a Translator to convert 10 pages of trhead ...

Okay it does nothing, I will use the original software. :-\ :-\ :-\

Thanks anyway, even if it didn't cost you anything send it to me ...

I just assumed from your acknowledgment to _Wim_ that you understood what they wrote and did not require any further response from me.

Hello Flynt, for the moment ;) this software is not available for download. It was developed by joeqsmith to show what is possible with the Nanovna, to make some educational youtube video's about the NanoVNA and to inspire others to make apps of their own (which has worked already, thanks to 5q5r)

I do not ask for donations, do not enable ads,  have no Pateron's, nor do I beg people to join my channel.   

Suggesting that my making the software available to you wouldn't cost me anything is a naive view.   Considering that you required a personal response from me even though someone else had provided you with an answer, I doubt that by handing you the software that your questions would subside.   Even if I made it free, with no support implied, I suspect you and others would request support.   I would hope you are not suggesting that my time is worth nothing.     

Again, I suggest you support the people who are willing to invest their time to to create an open source platform. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 05, 2019, 10:51:22 pm
joeqsmith, it seems that you have professional vector analyzer and other equipment.

Could you please measure CH1 input impedance of NanoVNA?
Two sweeps for 1-300 MHz and for 1 MHz - 1.5 GHz will be nice to see how it can be used with direct mode (1-300 MHz) and with extended mode (1-1.5 GHz).

It seems that CH0 has pretty good performance, but CH1 going to SWR=1.32 at 900 MHz which may affect measurements. What is your thoughts about it?

I suspect that you are correct that the match may not be all the great.  I mentioned that in the last video where I show that T-check.  But it's just $50 and I can't really bitch about it at that price.   

Sadly, I just don't use a VNA enough in my electronics hobby to justify getting a newer system.  Now if Keysight, RS or Copper Mountain wanted to donate a new 2-port 6GHz system, I may have to change my stance on donations.   :-DD   Imagine the fun one could have with a modern higher end VNA..
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 05, 2019, 11:00:03 pm
joeqsmith, it seems that you have professional vector analyzer and other equipment.

Could you please measure CH1 input impedance of NanoVNA?
Two sweeps for 1-300 MHz and for 1 MHz - 1.5 GHz will be nice to see how it can be used with direct mode (1-300 MHz) and with extended mode (1-1.5 GHz).

It seems that CH0 has pretty good performance, but CH1 going to SWR=1.32 at 900 MHz which may affect measurements. What is your thoughts about it?

This app note has good info on the effect that Port 2 (Port 1 on the Nano) load match has on measurements. It can usually be mitigated with a good attenuator, at the cost of some dynamic range.
http://anlage.umd.edu/Microwave%20Measurements%20for%20Personal%20Web%20Site/5965-7709E.pdf (http://anlage.umd.edu/Microwave%20Measurements%20for%20Personal%20Web%20Site/5965-7709E.pdf)

Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 05, 2019, 11:36:41 pm
Just tested, with 10 dB attenuator it is usable up to 200 MHz (SWR=1.01). With 20 dB attenuator up to 700 MHz (SWR=1.03).

But it reduces dynamic range... Is it possible to fix CH1 input to get swr=1.00 up to 300 MHz?

Currently it drops down to 45 Ohm at 300 MHz.
Title: Re: NanoVNA Custom Software
Post by: rhb on September 05, 2019, 11:44:57 pm
I had mentioned in the last video I made about the limited resolution (distance) when making TDR measurements.    I talked a bit about how you may be able improve it but with it being a $50 unit, I don't see much of a point.   Well except for the pure fun of it.....

So I talked it over with a friend of mine and we had a good laugh about the whole project.  He offered one idea that should help improve the setup but it's all a guess if the Nano can actually be used this way and get any useful information from it.   Of course, cost will need to be ignored which is part of the humor.... 
 
First baby step,  modify my software to support the range extender.   It may not look like anything is going on in the attached plot, but what you see the Nano using Channel 1 for S11.  That's not a misprint.   Granted, it's only 100MHz.    :-DD   Like I said, baby step.   

***
Should mention, yes, it is indeed a 100 ohm resistor.


A distance resolution of 1 mm requires timing to 5 ps, 10 ps for a reflection.  At 900 MHz 1 degree is 3 ps.  So if the nanoVNA reads phase to even 10 bits of accuracy, 1 mm resolution for a broadband reflection is not a problem.  Just do a linear fit to the phase in the frequency domain.

It gets more complicated if there are multiple reflections of different bandwidths, however, a sparse L1 aka basis pursuit can reliably solve that.  Though it might take a fairly powerful desktop to do that in less than several minutes.

I'm trying to squeeze TDR into the nanoVNA MCU with a swap out for an STM32F303CCT6 part with 48 KB of RAM and 256 KB of flash.  That's a completely different can of worms.

BTW What do you mean by "range extender"  is this frequency or time?

Reg
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 06, 2019, 12:01:27 am
Just tested, with 10 dB attenuator it is usable up to 200 MHz (SWR=1.01). With 20 dB attenuator up to 700 MHz (SWR=1.03).

But it reduces dynamic range... Is it possible to fix CH1 input to get swr=1.00 up to 300 MHz?

Currently it drops down to 45 Ohm at 300 MHz.

When you say usable, I am not sure if you are talking about the effect of that SWR on the error corrected measurement, or just the SWR of the port itself.
SWR of 1.03 is 30dB RL, which is outstandingly good and will have a very minor effect. In the doc I posted they are talking about improving 18dB RL for the VNA port - which is about 1.3 SWR. And remember that was an HP document, so a high value instrument, and we are talking about a $50 device here.

The OP posted earlier about his 'range extender' and showed an S11 measurement on port 1 and he has posted before about a transfer switch.
I don't know exactly what he has there, but it is pretty interesting. If it still permits capturing S11 on port 0, then a full 2 port cal is possible which does correct for load match.

There may be other mathematical approaches, such as 1 port 2 path, which might be able to cancel out some or all of that error, I don't know for sure if they do.
Here is an implementation, which is part of the lib I have been using. It does say '...can be fully corrected...'
https://scikit-rf.readthedocs.io/en/latest/api/calibration/generated/skrf.calibration.calibration.TwoPortOnePath.html#skrf.calibration.calibration.TwoPortOnePath
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 06, 2019, 12:02:53 am
Is it possible to calculate chart like this from S1P data (magnitude and phase per frequency)?

[attachimg=1]

What is the math behind it?
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 06, 2019, 12:11:58 am
When you say usable, I am not sure if you are talking about the effect of that SWR on the error corrected measurement, or just the SWR of the port itself.
SWR of 1.03 is 30dB RL, which is outstandingly good and will have a very minor effect. In the doc I posted they are talking about improving 18dB RL for the VNA port - which is about 1.3 SWR. And remember that was an HP document, so a high value instrument, and we are talking about a $50 device here.

I'm not sure what SWR for VNA input port is acceptable. But as I know it may affect filter response measurement, because filter is intended for 50 Ohm termination.

My primary interest in the frequency range 1...500 MHz. My NanoVNA CH1 (second port for S21) has RL = 23 dB at 500 MHz (SWR = 1.15). Is it acceptable for filters measurement? What error level it may cause? (for filter measurement S11, S21)
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 06, 2019, 12:34:31 am
Is it possible to calculate chart like this from S1P data (magnitude and phase per frequency)?

[attachimg=1]

What is the math behind it?

The maths is an inverse FFT.

rhb is a guru in that subject. I'm not, I just use a library. That makes it a one line operation. Example here:
https://github.com/hendorog/nanovna_test/blob/master/NanoVNA%20TDR.ipynb

One line at a time:
Code: [Select]
#Load a directory full of s1p files
duts = rf.read_all('data/measured/')

#Select one of them
s11 = duts['nano calibrated attenuator attempt 2']

#Convert from freq domain to time domain
s11_gated = s11.time_gate(center=0, span=100)

# Plot frequency and time-domain
figure(figsize=(8,4))
subplot(121)
s11.plot_s_db()
s11_gated.plot_s_db()
title('Frequency Domain')

subplot(122)
s11.plot_s_db_time()
s11_gated.plot_s_db_time()
title('Time Domain')
tight_layout()


When you say usable, I am not sure if you are talking about the effect of that SWR on the error corrected measurement, or just the SWR of the port itself.
SWR of 1.03 is 30dB RL, which is outstandingly good and will have a very minor effect. In the doc I posted they are talking about improving 18dB RL for the VNA port - which is about 1.3 SWR. And remember that was an HP document, so a high value instrument, and we are talking about a $50 device here.

I'm not sure what SWR for VNA input port is acceptable. But as I know it may affect filter response measurement, because filter is intended for 50 Ohm termination.

My primary interest in the frequency range 1...500 MHz. My NanoVNA CH1 (second port for S21) has RL = 23 dB at 500 MHz (SWR = 1.15). Is it acceptable for filters measurement? What error level it may cause? (for filter measurement S11, S21)

See the app note I attached earlier, it shows examples of measuring a filter, and shows roughly what your uncertainties will be. Your CH1 RL is a bit better than what they use in their example, but you are in the ball park.

I am not 100% sure on this, but I think that the built in NanoVNA transmission calibration is just a normalisation - i.e 'Response Calibration'.

Using a PC and the library I used in the examples above, you could improve that by doing an Enhanced Response Cal. That corrects for source match error (which is mismatch on Port 0). Mismatch on Port 1 remains uncorrected.

Then you could improve on that further using an attenuator to improve the Port 1 load match, but you sacrifice a bit of dynamic range as you know.

To improve further on that you need a two port calibration.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 06, 2019, 01:09:48 am
I had mentioned in the last video I made about the limited resolution (distance) when making TDR measurements.    I talked a bit about how you may be able improve it but with it being a $50 unit, I don't see much of a point.   Well except for the pure fun of it.....

So I talked it over with a friend of mine and we had a good laugh about the whole project.  He offered one idea that should help improve the setup but it's all a guess if the Nano can actually be used this way and get any useful information from it.   Of course, cost will need to be ignored which is part of the humor.... 
 
First baby step,  modify my software to support the range extender.   It may not look like anything is going on in the attached plot, but what you see the Nano using Channel 1 for S11.  That's not a misprint.   Granted, it's only 100MHz.    :-DD   Like I said, baby step.   

***
Should mention, yes, it is indeed a 100 ohm resistor.


A distance resolution of 1 mm requires timing to 5 ps, 10 ps for a reflection.  At 900 MHz 1 degree is 3 ps.  So if the nanoVNA reads phase to even 10 bits of accuracy, 1 mm resolution for a broadband reflection is not a problem.  Just do a linear fit to the phase in the frequency domain.

It gets more complicated if there are multiple reflections of different bandwidths, however, a sparse L1 aka basis pursuit can reliably solve that.  Though it might take a fairly powerful desktop to do that in less than several minutes.

I'm trying to squeeze TDR into the nanoVNA MCU with a swap out for an STM32F303CCT6 part with 48 KB of RAM and 256 KB of flash.  That's a completely different can of worms.

BTW What do you mean by "range extender"  is this frequency or time?

Reg

Frequency (with a lot of issues).  It would be for a very narrow band experiment if I do anything with it. 

Starting on page 29:
http://literature.cdn.keysight.com/litweb/pdf/5989-5723EN.pdf (http://literature.cdn.keysight.com/litweb/pdf/5989-5723EN.pdf)
Title: Re: NanoVNA Custom Software
Post by: rhb on September 06, 2019, 03:03:19 am
That's the Raleigh criterion for separating two events.  I was referring to identifying the location of a discontinuity.  Very different problems.

I've viewed the TDR aspect as "Where is the bad spot in my cable?"  and "Where is the impedance discontinuity in my PCB trace?" 

Once you want to look at the reflection from the the SMA side of an SMA to N connector separately from the N side, you have to have 20 GHz or more BW.  And even at 20 GHz in the time domain, it's not easy.  I've been doing a lot of it testing RF connectors using a Tek 11801 & SD-24.

However, I'm fairly certain that, if you have a well defined problem such as the mismatch at either end of an SMA to N adapter, you can solve the problem of the timing to better than the Rayleigh criterion using basis pursuit. However, doing this would require mastering the ugliest and most complex math I ever came across in my life.  It's simple to do in practice, but the logic of how and why it works is painful.  David Donoho has a  proof of a single theorem which takes 15 pages!

I'd like to note that I have serious technical issues with that application note.  It poses a lot of "problems" which are trivial to solve, but presented as proprietary to HPAK despite being sufficiently well known to be basic DSP 101 examples and homework.  I've not read all of it, but much of it is in Dunsmore's book which I *have* studied very closely.  At present I don't know if the issue is terminology and notational conventions, substantive errors or marketing FUD.    While the reflection seismology community has been doing DSP for 20 years longer than the EE community, the EE community chose not use the mathematics community lexicon adopted in geophysics.  Same words, but *very* different meanings.  Having worked in several seismic processing shops, my experience is that it takes about 6 months to map the words people use at lunch to the correct equations.  If it's that difficult in geophysics, going between that and electronics engineering is *much* worse.

In sum, this quickly turns into a major communications problem.  I've seen a lot of arguments which amounted to nothing more than different meanings for the same words.

Have Fun!
Reg

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 06, 2019, 03:47:32 am
Have Fun!
With no fear of doing something so bad that I would need to mortgage the house to recover, it opens the doors for a major fun fest. 

Playing with the Nano now, up converting to 5GHz  and back down.  Oddly enough, it seems to sort of do something.    Using the home made standards to run the SOL, then attaching the 100ohm load.   

I can't see it being useful in anyway outside of the fun factor. 

Have fun with your soldering and coding.   It sounds like a fun project as well.   
Title: Re: NanoVNA Custom Software
Post by: Bud on September 06, 2019, 03:53:05 am
I'm not sure what SWR for VNA input port is acceptable. But as I know it may affect filter response measurement, because filter is intended for 50 Ohm termination.

My primary interest in the frequency range 1...500 MHz. My NanoVNA CH1 (second port for S21) has RL = 23 dB at 500 MHz (SWR = 1.15). Is it acceptable for filters measurement? What error level it may cause? (for filter measurement S11, S21)

Google for "mismatch uncertainty".
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 06, 2019, 05:10:13 am
The maths is an inverse FFT.

rhb is a guru in that subject. I'm not, I just use a library. That makes it a one line operation. Example here:
https://github.com/hendorog/nanovna_test/blob/master/NanoVNA%20TDR.ipynb

One line at a time:
Code: [Select]
#Convert from freq domain to time domain
s11_gated = s11.time_gate(center=0, span=100)

Is this python? Unfortunately I don't familiar with this language.  :(
Could you please give me the link to the source of that s11.time_gate() function?
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 06, 2019, 06:02:31 am
The maths is an inverse FFT.

rhb is a guru in that subject. I'm not, I just use a library. That makes it a one line operation. Example here:
https://github.com/hendorog/nanovna_test/blob/master/NanoVNA%20TDR.ipynb

One line at a time:
Code: [Select]
#Convert from freq domain to time domain
s11_gated = s11.time_gate(center=0, span=100)

Is this python? Unfortunately I don't familiar with this language.  :(
Could you please give me the link to the source of that s11.time_gate() function?

I don't know much python either. Its pretty simple to get started, and the few lines of code you see on my repository is all that you need.

That function is built into the scikit-rf package, so its free and the source is on github if you really want to go there.

Just install the latest Python (3.7) and tick the box to add to your PATH. That will also install pip.
Then install Jupyter notebook, which is a nice GUI and just makes it easy.
https://jupyter.readthedocs.io/en/latest/install.html

I think it is simpler to use pip instead of conda as it is one less thing to wrangle.

So something like this should get you started:
Code: [Select]
pip3 install --upgrade pip
pip3 install jupyter
pip3 install scikit-rf

# Now start it up, this will run it and display it in a browser.
jupyter notebook

There are other options, e.g. Matlab, or Octave or Labview, but this is as flexible, or more flexible and not really any more difficult.

Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 06, 2019, 07:02:13 am
Google for "mismatch uncertainty".

I found this article: https://www.microwavejournal.com/articles/6166-calculating-mismatch-uncertainty (https://www.microwavejournal.com/articles/6166-calculating-mismatch-uncertainty)

But I'm not sure... If I understand correctly, mismatch uncertainty depends on VSWR source and VSWR load.

Does it means that when any of these VSWR is 1, then mismatch uncertainty also will be zero?

For exampel:

Source VSWR=1,
Load VSWR=1.32 (this is what NanoVNA CH1 have at 900 MHz).

ρload = 0.1379
ρsource = 0

Does it means that mismatch uncertainty is zero?
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 06, 2019, 10:28:04 am
Google for "mismatch uncertainty".

I found this article: https://www.microwavejournal.com/articles/6166-calculating-mismatch-uncertainty (https://www.microwavejournal.com/articles/6166-calculating-mismatch-uncertainty)

But I'm not sure... If I understand correctly, mismatch uncertainty depends on VSWR source and VSWR load.

Does it means that when any of these VSWR is 1, then mismatch uncertainty also will be zero?

For exampel:

Source VSWR=1,
Load VSWR=1.32 (this is what NanoVNA CH1 have at 900 MHz).

ρload = 0.1379
ρsource = 0

Does it means that mismatch uncertainty is zero?

Mismatch uncertainty can be corrected in a VNA - the exact details depend upon the calibration and that is documented in the AN 1287-3 I referenced.
That is one of the advantages of a Vector Network Analyser as opposed to a Scalar Network Analyser - such as a Spec An + TG + Bridge.

The VNA is able to correct for its own inadequacies. The SNA cannot, and so the SNA's analog performance must be much better to get the same performance.

Hence this device we are talking about - a very cheap VNA - actually has quite respectable performance - particularly if you extract the data to a PC - because of the error corrections which can be applied.
Title: Re: NanoVNA Custom Software
Post by: Flynt on September 06, 2019, 05:21:04 pm
:'( :'( :'(

joeqsmith, I apologize, for what you call "SPAM", but I didn't get any of your Rejection messages, and as I wrote you, I don't read English well and I can't program ... I just needed your software, to work and I was even willing to give you a donation.

I can't use a Translator to convert 10 pages of trhead ...

Okay it does nothing, I will use the original software. :-\ :-\ :-\

Thanks anyway, even if it didn't cost you anything send it to me ...

I just assumed from your acknowledgment to _Wim_ that you understood what they wrote and did not require any further response from me.

Hello Flynt, for the moment ;) this software is not available for download. It was developed by joeqsmith to show what is possible with the Nanovna, to make some educational youtube video's about the NanoVNA and to inspire others to make apps of their own (which has worked already, thanks to 5q5r)

I do not ask for donations, do not enable ads,  have no Pateron's, nor do I beg people to join my channel.   

Suggesting that my making the software available to you wouldn't cost me anything is a naive view.   Considering that you required a personal response from me even though someone else had provided you with an answer, I doubt that by handing you the software that your questions would subside.   Even if I made it free, with no support implied, I suspect you and others would request support.   I would hope you are not suggesting that my time is worth nothing.     

Again, I suggest you support the people who are willing to invest their time to to create an open source platform.

Joeqsmith, you didn't understand anything ...
I HAVE NEVER THOUGHT THAT YOUR TIME DOES NOT APPLY, I ONLY REQUEST THE INSTALLER OF A PROGRAM YOU DEVELOPED ...

I think you didn't understand my intentions, and I'm not able to program.
However, not but nothing, the Gentile helped me
Radioman ...

On the other hand, these are the Americans ... We in Italy, among radio amateurs, help each other.

Bye Bye :( :( :(
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 06, 2019, 06:04:08 pm
Joeqsmith, you didn't understand anything ...
I HAVE NEVER THOUGHT THAT YOUR TIME DOES NOT APPLY, I ONLY REQUEST THE INSTALLER OF A PROGRAM YOU DEVELOPED ...

I think you didn't understand my intentions, and I'm not able to program.
However, not but nothing, the Gentile helped me
Radioman ...

On the other hand, these are the Americans ... We in Italy, among radio amateurs, help each other.

Bye Bye :( :( :(

I'm glad we finally understand one another.    It's too bad that your not getting my work for free upsets you to the point you feel the need to make such ignorant comment about an entire country but it speaks of your character.     

You do bring up a valid point that what I have been doing is of no help to you.  Others have posted similar comments,  which is something I can live with. 

Take care. 
Title: Re: NanoVNA Custom Software
Post by: KD0CAC John on September 06, 2019, 07:01:48 pm
joeqsmith ,
I may have missed it , but do you provide a PAID service .
I have not picked up any computer language / and no programing .
So would be interested in paying for programing .
If I understand normal , similar to this , a one time fee for a program to run the nanoVNA , and then any future service is separate fees , or a package of services & fees ? 
Or your not interested in any of the above ;)

I'm a free-market / libertarian type , kinda [ I have not found answers to all questions from the libertarian perspective , but agree with lots ] .

I can not work for free either , picking up electronic repair as [ maybe ] the last trade at 65 disabled from pervious trades construction , auto repair , welding , machining / gun-smithing , and now electronics repair / ham radio , most trades started as hobbies & can not seem to just buy off the shelf ;)
A tool-jones forces me into building , repairing everything I own .
Even if I occasionally buy something new - I have to open it up and look under the hood , more fun .
Title: Re: NanoVNA Custom Software
Post by: rhb on September 06, 2019, 11:56:28 pm
I have no connection with @joeqsmith.  I've never even watched his YouTube videos.  I just wandered in here because I bought a nanoVNA and have been sucked into a black hole.  I have 20+ years of software support experience.

Badgering him like this is completely unreasonable. 

If you want the sort of software that @joeqsmith is playing around with, buy a VNWA or learn to program.  Tom Baier spends a *lot* of time providing support for his software.  You only need to read the VNWA mailing list to see how much work it is.  A staggering amount of the traffic on the VNWA list is trying to help people who did not read the manual, do not know anything about using a VNA and often very little about RF.  Yes, it is 10x the price, but it's also more capable.  However, very little of that is the hardware.  It's mostly the cost of the software support.

There are plenty of people working on open source programs for the nanoVNA.  As @joeqsmith suggested, give them some money.  Or learn to program and help out.  Join  nanovna-users@groups.io.

In any case, @joeqsmith is not responsible for your lack of ability.  He chose to invest his time and money in learning how to do something.  Those who are able are not the slaves of those who are not able.

Reg
Title: Re: NanoVNA Custom Software
Post by: tautech on September 07, 2019, 12:02:03 am
I have no connection with @joeqsmith.  I've never even watched his YouTube videos.  I just wandered in here because I bought a nanoVNA and have been sucked into a black hole.  I have 20+ years of software support experience.

Badgering him like this is completely unreasonable. 

If you want the sort of software that @joeqsmith is playing around with, buy a VNWA or learn to program.  Tom Baier spends a *lot* of time providing support for his software.  You only need to read the VNWA mailing list to see how much work it is.  A staggering amount of the traffic on the VNWA list is trying to help people who did not read the manual, do not know anything about using a VNA and often very little about RF.  Yes, it is 10x the price, but it's also more capable.  However, very little of that is the hardware.  It's mostly the cost of the software support.

There are plenty of people working on open source programs for the nanoVNA.  As @joeqsmith suggested, give them some money.  Or learn to program and help out.  Join  nanovna-users@groups.io.

In any case, @joeqsmith is not responsible for your lack of ability.  He chose to invest his time and money in learning how to do something.  Those who are able are not the slaves of those who are not able.

Reg
Well put Reg.  :-+

Joe's IP is his to do with as he pleases and if he chooses not to share it, tough titty.
He's developed these skills over many years and presumably his bike console is not shared either so to not give competitors an even footing when Joe races.
Nothing at all wrong with that.
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 07, 2019, 12:54:56 am
I have no connection with @joeqsmith.  I've never even watched his YouTube videos.  I just wandered in here because I bought a nanoVNA and have been sucked into a black hole.  I have 20+ years of software support experience.

Badgering him like this is completely unreasonable. 

If you want the sort of software that @joeqsmith is playing around with, buy a VNWA or learn to program.  Tom Baier spends a *lot* of time providing support for his software.  You only need to read the VNWA mailing list to see how much work it is.  A staggering amount of the traffic on the VNWA list is trying to help people who did not read the manual, do not know anything about using a VNA and often very little about RF.  Yes, it is 10x the price, but it's also more capable.  However, very little of that is the hardware.  It's mostly the cost of the software support.

There are plenty of people working on open source programs for the nanoVNA.  As @joeqsmith suggested, give them some money.  Or learn to program and help out.  Join  nanovna-users@groups.io.

In any case, @joeqsmith is not responsible for your lack of ability.  He chose to invest his time and money in learning how to do something.  Those who are able are not the slaves of those who are not able.

Reg
Well put Reg.  :-+

Joe's IP is his to do with as he pleases and if he chooses not to share it, tough titty.
He's developed these skills over many years and presumably his bike console is not shared either so to not give competitors an even footing when Joe races.
Nothing at all wrong with that.

Seconded. Motion carried.  :clap:

There is a heap of free and/or open software and lots of information  for the nano and vna's in general.

All the info is out there now, whereas only a few years ago it was not.
Title: Re: NanoVNA Custom Software
Post by: KD0CAC John on September 07, 2019, 01:28:03 am
Are you saying asking to pay for service is " Badgering " ?
Title: Re: NanoVNA Custom Software
Post by: N2CUA on September 07, 2019, 01:34:40 am
Are you saying asking to pay for service is " Badgering " ?

More importantly, its a waste of your time to even try .. lol
 :-DD
Title: Re: NanoVNA Custom Software
Post by: rhb on September 07, 2019, 01:37:42 am
I'm quite in awe of the nanoVNA.  @erik on the groups.io list has added an arbitrary scan function that will return a series of samples of arbitrary length and sampling via the console.  So a piece of cake to write a simple script to pull data off the nanoVNA, correct it and plot it with gnuplot.  Gnuplot will produce publication quality figures, so that's not shabby even if it's not the instant gratification that so many demand today.

A GUI such a @joeqsmith wrote is a *lot* of work.  Just designing the window layout takes weeks of work. But reading a bunch of numbers from the serial port and graphing them is not much trouble.  If someone is not willing to learn to do that I don't have much sympathy.

The audio codec chip has a unique 96 bit ID.  So it would be easy to sell 3rd party software for the nanoVNA which was locked to a particular device.  Of course, if your device dies, then so does your software license.  And realistically, such SW would cost more than the HW.  Is it likely that a $200 software package for a $35 device is a viable commercial venture?  I very much doubt it.  But once you have sold *one* copy you're stuck with the support problem or a lot of bad mouthing for not working for pennies per hour.

After putting $100K in labor into developing a seismic processing program I abandoned attempting to sell it because it because it quickly became apparent I was going to have to do $10K in free consulting to do an on site demo.  No guarantee of a sale and no way to get paid for configuring a Beowulf cluster for the demo  in 1999 when not many people knew how.

Personally, I think that the nanoVNA should be pure OSSW/OSHW.  If I were to develop the sort of software @joeqsmith has, I'd design HW with more dynamic range once I had the software done.  If you do the HW first, you risk it being obsolete before you finish the SW.  Over 90% of the software is completely HW agnostic.

Reg
Title: Re: NanoVNA Custom Software
Post by: Bud on September 07, 2019, 02:29:16 am
I have no connection with @joeqsmith.  I've never even watched his YouTube videos.  I just wandered in here because I bought a nanoVNA and have been sucked into a black hole.  I have 20+ years of software support experience.

Badgering him like this is completely unreasonable. 

If you want the sort of software that @joeqsmith is playing around with, buy a VNWA or learn to program.  Tom Baier spends a *lot* of time providing support for his software.  You only need to read the VNWA mailing list to see how much work it is.  A staggering amount of the traffic on the VNWA list is trying to help people who did not read the manual, do not know anything about using a VNA and often very little about RF.  Yes, it is 10x the price, but it's also more capable.  However, very little of that is the hardware.  It's mostly the cost of the software support.

There are plenty of people working on open source programs for the nanoVNA.  As @joeqsmith suggested, give them some money.  Or learn to program and help out.  Join  nanovna-users@groups.io.

In any case, @joeqsmith is not responsible for your lack of ability.  He chose to invest his time and money in learning how to do something.  Those who are able are not the slaves of those who are not able.

Reg

Sorry what is the point of posting about a software but not making it available? I genuinely do not understand, can someone explain.
Title: Re: NanoVNA Custom Software
Post by: amspire on September 07, 2019, 02:50:03 am
Sorry what is the point of posting about a software but not making it available? I genuinely do not understand, can someone explain.
Have I been following a different thread? I have never done much RF and I did get myself a nanoVNA and I have been finding joeqsmith's posts absolutely brilliant.

The graphics stuff is the glitzy fluff. The principal thing is the nanoVNA is a measurement device that outputs a list of measurements via USB serial interface. joeqsmith has shown us what you can do with the measurements that the nanoVNA is capable of. An incredible series of posts.

You do not even need to build your own graphical program - you can do anything joeqsmith did with fairly simple python scripts and you could output to a csv file or similar. Perhaps then number crunch in a spreadsheet if you want.
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 07, 2019, 03:10:59 am
Just another option for those that might prefer Java to hack on.  It is a hack job, but it works on Linux for me.  It should also work on Windows, Mac.
https://github.com/tvelliott/jNanoVNA
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 07, 2019, 05:05:14 am
Sorry about the drama.   

With a lack of torque wrench data and it being fairly common for me to see suggestions that torquing is not required, I thought I would have some fun.   My goal was to see how repeatable I could hand tighten an SMA.    As it turns out, I just don't have the knack and was unable to fool the $50 Nano.   Well, not at 4.75 to 5.0GHz anyway.    :-DD

The first 1200 or so sweeps where I am not moving anything,  it seems to be fairly stable. 

If you look at the second set of data, this is 2X 1206 resistors, of course the cal was done with the home made standards that use 1206 parts.  There are a slew of other problems.  So, just to be clear, I am not even remotely suggesting that the data has any meaning or that there is any point to what I am doing beyond my own amusement.

While sorting out some of my junk to put this test together, I came across my old transfer relay I mentioned.   I'm fairly certain that this came from the test set for my old HP VNA.   
Title: Re: NanoVNA Custom Software
Post by: OwO on September 07, 2019, 05:15:46 am
There is a good open source VNA GUI here that I will be porting to the NanoVNA (most likely only NanoVNA V2 which will have a more capable command interface): https://github.com/xaxaxa-dev/vna/tree/master/vna_qt

I have also fed back the tip about the STM32F303 and most likely V2 will come with a F303CCT6 by default (most likely a GD32).

EDIT: fix typo
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 07, 2019, 05:20:52 am
joeqsmith ,
I may have missed it , but do you provide a PAID service .

I do not.   Anything I offer in the way of videos, test data and other information is for free as my way of giving back to the community and promoting the hobby.   

If you were serious about hiring me, in all honestly I would suggest you pick out what ever top of the line Keysight, RS or any other brand you like.  Don't hold back.   The sky's the limit.  In the end you will have a very nice system, and be much further ahead.   
Title: Re: NanoVNA Custom Software
Post by: 5q5r on September 07, 2019, 06:18:15 am
Just to reiterate, for those who might not have seen it: Myself and others have made a Python program for doing a number of the same things as Joe's software, fully open source and available to use and modify. It's available here: https://github.com/mihtjel/nanovna-saver

There are pre-built releases for Windows - for other platforms, download the code and run it using Python.

All potential contributors are very welcome to contact me directly, and requested features are pushed onto the project TODO list, from which I grab items to work on.

I hope this provides some use for members of the community.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 07, 2019, 06:40:47 am
if I understand correctly, TDR can be obtained by make IFFT applied to S1P. Is it correct?

It seems that it works, but the most confusing thing here is how to calculate proper time for points.  ???

Here is 0.5 meters RG316 with open end, measured with NanoVNA (it's real back and forth delay is about 0.495 ns):
[attach=1]

Here is 10 meters RG316 with open end, measured with NanoVNA (don't know it's real delay, but 98.4 ns looks very close to velocity factor 0.66):
[attach=2]

It shows signal magnitude after IFFT. Don't take attention to ST/ED/BW values on screenshot, these are rudiments from debugging :)

Is it correct way?  :phew:

Is it possible to calculate impedance instead of this unknown unit magnitude?
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 07, 2019, 08:29:00 am
Here is more interesting measurement :)

SMA => 0.5 meters RG316 => SMA to PL adaptor => 1 meter LMR195 => PL to BNC adaptor => 1 meter RG58 => BNC to SMA adaptor => OPEN:

Red = magnitude
Green = re
Blue = im

[attach=1]

The same with 50 Ohm load at the end:

[attach=2]

It seems that these Chinese SMA-PL and PL-BNC adapters are crap  :D


Any idea on how to convert this magnitude into impedance value?
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 07, 2019, 11:11:32 am
Hi,

Yesterday I had a bit time and started my "VMA NanoVNA Tool".

At this point it does not much and is of little use, except that it allows to export the data to Excel as a *.CSV file.

It may have bugs and does not look nice at all, but you can just run the executable and get your CSV file. No installation, no garbage files and no garbage on the Registry.

The reason I am uploading it here is to get some feedback on this eternal question of mine: "What is wrong with the supplied NanoVNASharp software?"

To me that software looks just fine and implements all graphs (mine does not do it correctly at this moment). The only thing it does not do, is to export data in CSV format for further Excel work. Would adding this feature solve the demand for alternative software (at least for most people)?

I understand that joeqsmith did his software because he did not like the graphics and refresh rate of NanoVNASharp. Plus he is free to do whatever he likes! :)

But what I really would like to understand and I have asked and got no reply (I know, I am dumb): what other functionalities do you guys want/need?

Also, the issue I have in further developing my software is that I simply have not understood VNA measurements: what do you read out of the charts and why and what else you would want to calculate based on the data. I only figured out the tuning of antennas. Reading the posts leaves me with many questions and, shame on me, I have not fully watched/rewatched joeqsmith great videos, due to total lack of time (I have been busy implementing a full error map compensation algorithm to my "VMA Simple Spectrum Analyzer" software).

Regarding the much discussed open source, freeware, shareware, what so ever:

1) If I was to develop my software further up to a level where no doubts you would prefer it over NanoVNASharp, then I would apply the same kind of licensing scheme as I have currently on my "VMA Simple Spectrum Analyzer" software. It will never be open source and not freeware, either. Except these initial versions which really don't add much to what already exists.
2) I don't believe in giving away work for free. Work done for free is, in my opinion and as the name implies, worthless. My work has a value, at least to me.
3) There is a lot of work and time involved in any of these developments. Based on my "VMA Simple Spectrum Analyzer", I can confirm that there are literally hundreds if not thousands of hours spent in development. Note that development is not only time spent typing code, but countless hours thinking on how to solve a particular problem. Add to this the years spent learning how to program, how to use (in this example) spectrum analyzers, development of actually new measurements and functionality. On top of this the money spent in equipment: in order for me to develop a spectrum analyzer software, I have actually purchased different spectrum analyzers (SSA3021X, R&S CMU200, R&S CRTU, HP8594E, HackRF One, ADALM Pluto, SMA, D6, LTDZ, ...)! So, indeed, there is a lot of investment involved, even if this is a non-profit hobby. Other than Flynt said "It would have cost you nothing" - it DID COST A LOT!!! Of course, replicating an executable on a computer does not cost much. But then, why doesn't Microsoft give free copies of their software? THAT would not cost anything, right: just making the software available for download? Or, wait a moment: it would cost them all the ROY and profit! Not being able to recognize the COST of software development is indeed a problem and I fully support joeqsmith's decision.
4) The much discussed software of joeqsmith has a problem (to those asking for it - certainly not for him), by the way: It was developed with the HOME version of LabVIEW. This version, while affordable for hobby use, does explicitly not allow to use the resulting applications for any commercial use. Independently if joeqsmith is worried about this or not: if it was me, I would not make the software public, for the following reasons:
a) I could not prevent any organisation to download and use the software for commercial purposes, thus not complying with the LabVIEW terms. I *think* it would not be a problem for me, but anyhow, why risk something when there is no personal gain at all?
b) I could not sell or accept donations for the software, as this is against the LabVIEW terms. It means that I would have to give out the software for free.
c) This would mean that I would get no return for my work, but instead, Chinese sellers of cloned NanoVNA would include my software (without even asking) and make profit, while I would be left as the dummy handling all support issues - for free.

Kind regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 07, 2019, 11:17:51 am
Here is an example CSV file, generated with my software.

Regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 07, 2019, 11:22:19 am
Here two pictures:

One of the software and one of Excel showing the graphs (not formatted, just a quick test).

Vitor
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 07, 2019, 02:07:51 pm
Bicurico, S1P file already compatible with Excel. Just copy-paste. :)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 07, 2019, 02:53:01 pm
Hi,

....
The reason I am uploading it here is to get some feedback on this eternal question of mine: "What is wrong with the supplied NanoVNASharp software?"

To me that software looks just fine and implements all graphs (mine does not do it correctly at this moment). The only thing it does not do, is to export data in CSV format for further Excel work. Would adding this feature solve the demand for alternative software (at least for most people)?

I understand that joeqsmith did his software because he did not like the graphics and refresh rate of NanoVNASharp. Plus he is free to do whatever he likes! :)

But what I really would like to understand and I have asked and got no reply (I know, I am dumb): what other functionalities do you guys want/need?

My only problem with the Sharp software was what I had shown with the cursors being unusable.  This was really the catalyst for where I am now.   

While my software has many basic features that you will find on most VNAs, these are a few that my current software supports that you may not find with Sharp:

  Support control of external bias power supply
  Support for an external transfer relay
  Full 2-port calibration
  Automatic T-check
  Automatically collect all four S-parameters
  Create full 2-port Touchstone files
  Segmented sweeps (both log and linear are supported)
  Record data for post processing over extended periods and there is some built-in post processing capability (3-D viewing, histograms, scatter....) 
  Supports external mixers and directional couplers using CH1 for S11
  Basic TDR measurements (time, distance, impedance, Beatty standard....)

I would like to point out that member RHB's posts did not fall on deaf ears.  It's an interesting topic.
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2668785/#msg2668785 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2668785/#msg2668785)

...

4) The much discussed software of joeqsmith has a problem (to those asking for it - certainly not for him), by the way: It was developed with the HOME version of LabVIEW. This version, while affordable for hobby use, does explicitly not allow to use the resulting applications for any commercial use. Independently if joeqsmith is worried about this or not: if it was me, I would not make the software public, for the following reasons:

...

Kind regards,
Vitor

You had asked about this before:
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2599500/#msg2599500 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2599500/#msg2599500)

I did not develop my software with the Home edition as you have stated.  If you look at screen shots or videos I have posted, the lack of a watermark should have been the tell tail.   There is nothing from a legal aspect that would prevent me from providing the software for profit as again, I have a professional license.    The software will indeed run on the Home edition.   It could be built into an EXE with an installer like any other application using the Home edition but using this for profit would be a licensing problem as you suggest.   

A pro license doesn't cost too much.  Somewhere around $3000.  If I were planing to use it for profit, I would just sort out the license costs as part of the sale price.   I wouldn't try and sell 3001 copies at $1.00 USD to make $1 in profit.   :-DD   Hope this clears things up. 
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 07, 2019, 03:23:36 pm
@joeqsmith: Sorry, I thought you were using the HOME version.

Anyway, I guess my thoughts still apply regarding the development of such software (or software to support other devices) using the HOME version of LabVIEW, which was discussed in a different thread.

But to stay on topic: I will now continue to monitor this thread and see if I can learn something about VNA measurements and see if this motivates me to continue developing the software.

@radiolistener: Thanks! It did not occur to me to verify that S1P files are actually just CSV files...
 
Regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 07, 2019, 04:51:19 pm
@joeqsmith: Sorry, I thought you were using the HOME version.

I did buy the $50 Home edition and am using it but not to develop the code for the Nano.  At $50, with the application builder it was a very good deal for anyone wanting to learn the tools or in my case, hobbyist looking for a low cost upgrade.  Sure, it's not designed to be a cheap tool for people to profit from but they do offer licenses for that.  I wonder just how much they have invested in that tool.   It's really advanced over the years. 
Title: Re: NanoVNA Custom Software
Post by: OwO on September 07, 2019, 05:06:37 pm
FYI to anyone working on alternative software for the NanoVNA: it's a good idea to abstract out the hardware interfacing part of your code and separate it from your UI code because the command interface is going to be completely reworked in V2. It will be a more simple low level (and binary rather than text) protocol to improve performance and sweep rate. The other thing I know about V2 is it will cover at least 1 to 2500 MHz (without harmonic tricks). V1 is very noisy above 300MHz because of the use of the third harmonic and the SA612 mixer which both mean a very weak signal.
Title: Re: NanoVNA Custom Software
Post by: edigi on September 07, 2019, 06:23:02 pm
What is the confidence level of this information?
Any expected date?

Actually harmonic usage is not that a bad idea, in fact I've checked with SA till 1.5 GHz and maybe even that could be used (at least for S11).
Mixer is definitely limiting (500 MHz by the spec if I remember correctly).
Also due to overdrive of the clock chip stability around 300 MHz is not the best, low battery is one issue but I could provoke it also with hair dryer (so summer high temperature can be also an issue; the 800 MHz code version is not there by accident...).

A more efficient data transfer is definitely a good idea even if it breaks compatibility with other devices (not an issue for me and probably for many but I heavily suspect that joeqsmith has not developed his SW only because of NanoVNA but probably same SW is used with other devices). A good compromise could be that the VNA could be forced back to the slower but more compatible mode but by default it could use a more efficient one.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 07, 2019, 07:38:00 pm
It will be a more simple low level (and binary rather than text) protocol to improve performance and sweep rate. The other thing I know about V2 is it will cover at least 1 to 2500 MHz (without harmonic tricks).

Very nice!!  I was very surprised to see them sending ASCII.   2.4GHz without the harmonics would be a very welcome addition as well.  Currently, I limit the sweep to 300MHz while playing around with mixing the signals.

A more efficient data transfer is definitely a good idea even if it breaks compatibility with other devices (not an issue for me and probably for many but I heavily suspect that joeqsmith has not developed his SW only because of NanoVNA but probably same SW is used with other devices).

I started out thinking I could port the code I wrote for my old HP but there were two problems.   First, I wrote the program many years ago and have learned better techniques over the years.   The other problem was the data format.   That HP has clear plastic overlays that attach to the CRT with the various scales, like polar and smith.  You would mark on these with your grease pencil with the data you collect  (primitive storage).    The data had to be translated through three different systems.  It was a real nightmare.    I did like the look and feel of the software and decided to follow that same sort of scheme.  I reused my graphics and the techniques I came up with for plotting the data but that's about it.   One day I would like to replace the old HP with something less than 20 years old  :-DD

https://www.amazon.com/COLOR-MARKERS-PEEL-OFF-GREASE-PENCIL/dp/B00XJ1FRRI?ref_=fsclp_pl_dp_7 (https://www.amazon.com/COLOR-MARKERS-PEEL-OFF-GREASE-PENCIL/dp/B00XJ1FRRI?ref_=fsclp_pl_dp_7)

Pictures of the 50 ohm home made standard with mixers drifting a bit.  Also shown is a 3.4GHz low pass, both compliments of the $50 Nano.    My confidence is about at that $50 level...  Maybe lower.

****

Playing with the scatter plot, 3.4GHz LP filter....

https://www.youtube.com/watch?v=F8bUZMEElyk&feature=youtu.be (https://www.youtube.com/watch?v=F8bUZMEElyk&feature=youtu.be)
Title: Re: NanoVNA Custom Software
Post by: rhb on September 07, 2019, 08:02:55 pm
if I understand correctly, TDR can be obtained by make IFFT applied to S1P. Is it correct?

It seems that it works, but the most confusing thing here is how to calculate proper time for points.  ???

Here is 0.5 meters RG316 with open end, measured with NanoVNA (it's real back and forth delay is about 0.495 ns):
[attach=1]

Here is 10 meters RG316 with open end, measured with NanoVNA (don't know it's real delay, but 98.4 ns looks very close to velocity factor 0.66):
[attach=2]

It shows signal magnitude after IFFT. Don't take attention to ST/ED/BW values on screenshot, these are rudiments from debugging :)

Is it correct way?  :phew:

Is it possible to calculate impedance instead of this unknown unit magnitude?

The frequency spacing determines how long the time domain trace is.  The Nyquist frequency determines the sampling.  If you sweep to 900 MHz at 1 MHz spacing you have data for 1 microsecond.  If you pad the end of the frequency series to raise Nyquist to 2 GHz you will have 250 ps sampling.

Doing an FFT from time to frequency, padding with zeros and inverse transforming is the standard way to resample data to finer sampling rates.  There are other ways of doing it, but the FFT is the fastest.

I wrote an arbitrary resampling routine which would resample any sample rate to any other sample rate by FFT  around 20 years ago.  You have to pad the series so that m*dtT1 = n*dT2.  If you don't you will get a phase error near the end.  That cost me 2 weeks of misery to figure out.  It's clearly stated, "The DFT is defined on the semi-closed interval from [-Pi:Pi)."  But it's easy to overlook that little detail.

I've presented  some time domain connector testing here:

https://www.eevblog.com/forum/rf-microwave/testing-rf-connectors-and-cables/msg2640531/#msg2640531 (https://www.eevblog.com/forum/rf-microwave/testing-rf-connectors-and-cables/msg2640531/#msg2640531)

using a Tek 11801 and 20 GHz SD-24 TDR head.

Chinese  SMA and N connectors are OK to about 1 GHz.  BNC males are often completely useless.  It's really a function of the tolerances on the make collar.

Have Fun!
Reg
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 07, 2019, 09:31:51 pm
Hi,

I have the following question, which is probably obvious for you all, but not for me:

1) Port S11: Is it correct to assume that this port internally combines a TG, RF IN, DUT with a SWR bridge?
2) Port S21: Is it correct to assume that this port internally acts just as a TG?
3) Both TG and RF IN are synchronized, allowing for phase measurements, as opposed to SWR measurements carried out with a spectrum analyzer and SWR bridge, where no phase information is available?

If I am am measuring with S21, where I connect S21->DUT->S11, will the device internally "switch off" the SWR bridge, which would (in my opinion) no longer be needed?
If so, what would happen if I configure a S21 measurement, but then only connect DUT->S11, without using S21 at all? Wouldn't the result be similar to a regular spectrum analyzer?

Thanks,
Vitor

PS: Am I correct to assume that UK English writes "spectrum analySer" and USA English writes "spectrum analyZer"?
 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 07, 2019, 11:00:01 pm
Hi,

I have the following question, which is probably obvious for you all, but not for me:

1) Port S11: Is it correct to assume that this port internally combines a TG, RF IN, DUT with a SWR bridge?
2) Port S21: Is it correct to assume that this port internally acts just as a TG?
3) Both TG and RF IN are synchronized, allowing for phase measurements, as opposed to SWR measurements carried out with a spectrum analyzer and SWR bridge, where no phase information is available?

If I am am measuring with S21, where I connect S21->DUT->S11, will the device internally "switch off" the SWR bridge, which would (in my opinion) no longer be needed?
If so, what would happen if I configure a S21 measurement, but then only connect DUT->S11, without using S21 at all? Wouldn't the result be similar to a regular spectrum analyzer?

Thanks,
Vitor

PS: Am I correct to assume that UK English writes "spectrum analySer" and USA English writes "spectrum analyZer"?

I have always written Z (unless I would make a mistake, which I often do)  All of my test equipment use Z on their markings.   

Yes, channel 0 has two ADCs for the reference and return (S11) while channel 1 has one ADC for the thru (S21).   Phase relative to the reference is available from both channels. 

This gets a bit odd when you consider using channel 1 for S11 while up and down converting the signal from channel 0.  While I am mixing it with a signal that is asynchronous to the reference, once it it down converted everything is back to normal.  The calibration handles the phase errors. 

There is no switching off. The signals are hardwired.   It's up to you to decide what to do with the data.   You can pull just the channel 0 or the channel 1 data.  For example, when I collect S11, there is no reason to read channel 1 and there is certainly no reason to read the frequency.  This is why my software runs so much faster as the Sharp software pulls everything down.  (no, not at 9600 BAUD.  I thought I had drove the final spike in that coffin).

Your last question is a bit tricky.  I understand what you are asking and the basic answer is yes!!!   If I connect my RF generator to channel 1, set the analyzer to read S21, with nothing on channel 0, you can see this sort of spectrum analyzer result in the attached graph.  Everything is asynchronous so the phase is nothing but noise but you can clearly see the magnitude peak at the frequency the RF generator is set to which in this case is 20MHz. 

But there's a catch which I talked about in that very first video I made.   You only have 101 samples to work with.  Say you have an RF generator with VERY low phase noise set to CW.   Would you be able to see it using a wide band sweep?  Most likely not.  You will need to know what you are looking for and zoom in around that area.
Think about it, what's 900MHz / 101.   Try looking a 7.968MHz oscillator with that.   

While you could calibrate out the errors in amplitude, I doubt you would be happy with the performance.   The graph shows what happens when I use a 20MHz center frequency and 100KHz span.   Someone may look at that and say, that Joe Smith has one really poor excuse for an RF generator.     Of course, attaching it to something other than a $50 instrument tells a whole different story. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 07, 2019, 11:17:56 pm
The frequency spacing determines how long the time domain trace is.  The Nyquist frequency determines the sampling.  If you sweep to 900 MHz at 1 MHz spacing you have data for 1 microsecond.  If you pad the end of the frequency series to raise Nyquist to 2 GHz you will have 250 ps sampling.

So, the time interval after IFFT is from 0 to 1/[frequency step] is it correct?


I'm looking at scikit-rf library (https://github.com/scikit-rf/scikit-rf) for python, and there is also interesting function delay(d, unit,...) in network.py [line 2514] (https://github.com/scikit-rf/scikit-rf/blob/master/skrf/network.py):

Code: [Select]
def delay(self, d, unit='deg', port=0, media=None,**kw):
        '''
        Add phase delay to a given port.
        This will cascade a matched line of length `d/2` from a given `media`
        in front of `port`. If `media==None`, then freespace is used.
        Parameters
        ----------
        d : number
                the length of transmissin line (see unit argument)
        unit : ['deg','rad','m','cm','um','in','mil','s','us','ns','ps']
                the units of d.  See :func:`Media.to_meters`, for details
        port : int
            port to add delay to.
        media: skrf.media.Media
            media object to use for generating delay. If None, this will
            default to freespace.
        '''
        if d ==0:
            return self
        d=d/2.
        if self.nports >2:
            raise NotImplementedError('only implemented for 1 and 2 ports')
        if media is None:
            from .media import Freespace
            media = Freespace(frequency=self.frequency,z0=self.z0[:,port])

        l =media.line(d=d, unit=unit,**kw)
        return l**self

But I don't understand python syntax well, so I cannot understand what happens here? Especially at these 3 lines:
Code: [Select]
            media = Freespace(frequency=self.frequency,z0=self.z0[:,port])

        l =media.line(d=d, unit=unit,**kw)
        return l**self

If I understand correctly, "l =media.line(..." represents impedance transformation of transmission line. And it someway applied to S11 parameters. And result represents S11 parameters at the end of transmission line. Is it correct?

What means "**" operator in python? According to google, this is power operator (2^3=8 equals to 2**3=8 in python), but the second argument is S11 matrix... What means power operator for matrix?  ???

Tried to google such operation (S11 matrix correction for specific electronic delay in transmission line), but didn't find anything... Can someone suggest some literature, where such operation for S11 matrix is explained?
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 08, 2019, 12:08:45 am
There are some quite good docs.

https://scikit-rf.readthedocs.io/en/latest/tutorials/Introduction.html

"Element-wise mathematical operations on the s-parameters are accessible through overloaded operators."
"Cascading and de-embeding 2-port Networks can also be done though operators. Cascading is done through the power operator, **."



Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 08, 2019, 12:30:13 am
hendorog, thanks. But what it means still is not clean for me. Needs reverse engineering of skrf source code, because python syntax very tricky. For example, it is not clean where IF statement ends... Also, algorithms are smeared through different classes and overloaded operators and it's hard to understand what is going on here with no need to diving into the rest of the code  :)

Any literature about math which is used under the hood in skrf?
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 08, 2019, 07:36:12 am
joeqsmith - May I abuse your patience and ask:

When using the DATA command I always get X and Y values. Are you doing it differently?
Yes, the frequency list is not necessary - one can compute it without having to download it. It is just (Fend-Fstart)/samples*step
What does X and Y really represent. This is the toughest question and possibly the most annoying to you. Sorry - I am still a noob in terms of VNA.
Regarding the low sample rate of just 101 samples per sweep, I have not tested if the SWEEP command accepts the sample number different than 101 as the third parameter.
If not my plan is to increase the sweep to 500 samples by just dividing the frequency span by 5 and getting the 101 samples for each of the 5 frequency segments.
Of course this will slow down the sweep rate by a factor of 5 but I have learned that refresh rate is not everything and there are quite expensive professional test equipment with rather slow sweep rates (a joke in my opinion - but that is another story).
It is not yet clear to me how to software-wise configure the NanoVNA to do S21 measurement so that I just hook the DUT on Port 0 and get a spectrum reading.

Regards
Vitor
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 08, 2019, 08:16:09 am
What does X and Y really represent. This is the toughest question and possibly the most annoying to you. Sorry - I am still a noob in terms of VNA.

These X and Y are real and imaginary parts of S11 value (for CH1 S21). It is represented in complex form (https://en.wikipedia.org/wiki/Complex_number).

For exampel:
Code: [Select]
1.000334382 -0.012819038

means:
re (real part) = 1.000334382
im (imaginary part) = -0.012819038

So, it means that S11 = 1.000334382 - j0.012819038.

If you want, you can translate it to polar coordinate system (https://en.wikipedia.org/wiki/Polar_coordinate_system) in the following way:

magnitude = sqrt(re * re + im * im);
angle = 180 * atan2(im, re) / pi;

atan2(im, re) calculates angle, but the result represented in radians, so you're needs to convert it to degree by multiplying it with 180 / pi

S11 is very useful value, for exampel you can calculate VSWR value:

Code: [Select]
rr = re * re + im * im;

if (rr >= 1) then VSWR = infinite;

else VSWR = (1 + sqrt(rr)) / (1 - sqrt(rr));


Regarding the low sample rate of just 101 samples per sweep, I have not tested if the SWEEP command accepts the sample number different than 101 as the third parameter.

you can pass any number in sweep command. NanoVNA just ignore it. It always works with 101 points and there is no way to change it. I think this is memory limit of this microcontroller.

It is not yet clear to me how to software-wise configure the NanoVNA to do S21 measurement so that I just hook the DUT on Port 0 and get a spectrum reading.

Do you mean console commands? Just use data command:
data <channel>

for exampel, this command will get data for CH0:
data 0

and this command will get data for CH1:
data 1

it's pretty easy  :)

In order to setup frequencies, you can use sweep command:
sweep <start> <stop>

for exampel, this command will setup sweep range from 1 MHz to 150 MHz:
sweep 1000000 150000000

You can download PUTTY (https://www.putty.org/) (this is terminal, it allows to connect to Serial port) and play with it. It's pretty easy. You're needs to specify Serial port for connection and com port name.  Here is putty session for exampel:
Code: [Select]
help
Commands: help exit info echo systime threads reset freq offset time dac saveconfig clearconfig data dump frequencies port stat sweep test touchcal touchtest pause resume cal save recall trace marker edelay
ch> info
Kernel:       4.0.0
Compiler:     GCC 5.4.1 20160919
Architecture: ARMv6-M
Core Variant: Cortex-M0
Port Info:    Preemption through NMI
Platform:     STM32F072xB Entry Level Medium Density devices
Board:        NanoVNA
Build time:   Jul 22 2019 - 16:26:51
ch> sweep 1000000 30000000
ch> sweep
1000000 30000000 101
ch> data 0
1.000334382 -0.012819038
1.000619411 -0.014043334
1.000123381 -0.015157566
1.000514984 -0.016093827
1.000436782 -0.017410092
1.000501394 -0.018344996
1.000151395 -0.019588120
1.000253081 -0.020322881
0.999891698 -0.021273871
0.999914824 -0.022288246
0.999868750 -0.023332940
0.999770462 -0.024202115
0.999884128 -0.025404103
0.999833703 -0.026232335
0.999632596 -0.027013938
0.999499559 -0.028223698
0.999637365 -0.028801376
0.999387919 -0.029435977
0.999631226 -0.029972538
1.002218246 -0.029391391
1.004171252 -0.032068528
1.001608490 -0.034094724
1.000858068 -0.035458635
1.000560522 -0.036200754
1.000125050 -0.037087496
1.000095486 -0.038230843
1.000262737 -0.039139334
0.999750494 -0.039976678
0.999891042 -0.041104275
0.999784827 -0.042336892
0.999971687 -0.043484516
0.999799907 -0.045150741
0.999982059 -0.046216718
0.999493658 -0.047426808
0.999777674 -0.048748057
0.999688148 -0.049898017
0.999597012 -0.051182426
0.999525427 -0.052349578
0.999216139 -0.053816296
0.999178647 -0.054883997
0.999005794 -0.056154955
0.998820781 -0.057684507
0.999015092 -0.058685358
0.998871505 -0.059900578
0.998757004 -0.061241392
0.998712182 -0.062616705
0.998695135 -0.063646942
0.998613953 -0.064931072
0.998556375 -0.066254936
0.998585581 -0.067580714
0.998366594 -0.068778082
0.998310446 -0.070160925
0.998090565 -0.071184404
0.998218178 -0.072452932
0.998082041 -0.073820449
0.997873008 -0.075051650
0.997672736 -0.076362192
0.997864961 -0.077377557
0.997722983 -0.078763738
0.997510135 -0.080164059
0.997572302 -0.081403687
0.997310221 -0.082679249
0.997066974 -0.083944469
0.997346639 -0.085386037
0.997254550 -0.086459428
0.997277498 -0.087772250
0.997081696 -0.088958740
0.997002899 -0.090456649
0.996815264 -0.091620504
0.996773242 -0.092930428
0.996567785 -0.094331786
0.996562242 -0.095199465
0.996507167 -0.097060345
0.996266543 -0.097908206
0.996095418 -0.099269963
0.996342182 -0.100541479
0.995806276 -0.101831674
0.995640277 -0.103128492
0.995647966 -0.104465112
0.995308578 -0.105523049
0.995393931 -0.106829814
0.995034158 -0.108262822
0.995196044 -0.109290048
0.994729876 -0.110772430
0.995051443 -0.112008184
0.994862079 -0.113100029
0.994484126 -0.114403992
0.994411051 -0.116048157
0.994243025 -0.117027558
0.994225263 -0.118228457
0.994016349 -0.119506403
0.993956506 -0.120835222
0.993702173 -0.122295558
0.993651926 -0.123540185
0.993369281 -0.124662227
0.993133306 -0.125806242
0.992927193 -0.127351313
0.992799878 -0.128284811
0.992875814 -0.129809200
0.992461144 -0.130973890
0.992346584 -0.132136657
ch> data 1
0.000022881 -0.000034072
-0.000044930 -0.000003006
0.000001353 -0.000019715
-0.000053841 -0.000043194
-0.000004344 -0.000006963
0.000001772 -0.000007370
-0.000000086 -0.000014207
-0.000005251 0.000030388
0.000011967 -0.000017351
-0.000020198 0.000030180
-0.000004857 -0.000045057
-0.000020909 0.000002008
0.000010476 -0.000008191
0.000004981 -0.000037762
-0.000053258 0.000006323
-0.000023624 0.000023545
-0.000021935 -0.000011593
-0.000025896 -0.000000449
-0.000039536 -0.000018117
0.000018417 0.000040691
-0.000015518 -0.000064735
-0.000022360 -0.000048622
-0.000014705 0.000005838
0.000012554 -0.000030298
-0.000035040 -0.000004715
0.000017032 -0.000023722
-0.000012310 -0.000016603
0.000024222 -0.000042020
-0.000050025 -0.000037519
-0.000024725 -0.000024864
0.000012915 -0.000024808
0.000015194 -0.000008572
0.000012409 -0.000028297
0.000032538 0.000017843
0.000026463 -0.000013021
-0.000001025 -0.000037424
-0.000019795 -0.000044200
-0.000013177 -0.000036966
-0.000016448 -0.000019061
0.000003270 0.000000127
0.000045834 -0.000063594
-0.000008657 -0.000003194
0.000010901 0.000005717
0.000023127 -0.000009332
-0.000012275 0.000016109
0.000015946 -0.000023457
0.000012786 0.000031161
0.000002111 0.000011889
0.000023851 0.000024347
-0.000001895 0.000019804
0.000021308 0.000006177
0.000027474 -0.000015023
-0.000020845 -0.000027184
-0.000019241 -0.000042736
0.000046159 -0.000022540
-0.000023773 -0.000018934
0.000017447 0.000030827
0.000032983 -0.000004683
0.000000493 -0.000022111
-0.000006937 0.000028902
0.000043825 -0.000022563
0.000062209 0.000005554
0.000046276 -0.000050153
-0.000017177 -0.000012213
0.000033449 -0.000046718
-0.000002024 0.000019626
0.000041615 -0.000019849
0.000026992 -0.000000219
0.000014502 -0.000004934
0.000015049 0.000002597
-0.000033414 0.000004811
-0.000033238 -0.000052053
0.000026538 0.000015010
0.000009085 -0.000022117
-0.000025025 -0.000017477
-0.000002855 -0.000049975
-0.000008924 -0.000026126
-0.000000627 -0.000041066
0.000014821 0.000012632
0.000008421 0.000025136
0.000020770 -0.000022932
0.000021408 0.000012013
-0.000002280 -0.000019163
-0.000031954 0.000019613
-0.000012588 0.000018006
0.000011647 0.000022847
0.000030014 0.000008953
-0.000044193 0.000000472
0.000014898 -0.000047376
0.000015692 -0.000035619
-0.000000117 -0.000035395
0.000010286 -0.000003112
-0.000038924 -0.000028851
-0.000023267 -0.000004298
-0.000060468 -0.000020690
-0.000024815 0.000003858
-0.000012520 -0.000020648
-0.000003775 -0.000013356
-0.000001176 -0.000004715
-0.000015004 -0.000030841
-0.000015286 -0.000069948
ch>
Title: Re: NanoVNA Custom Software
Post by: Flynt on September 08, 2019, 11:51:29 am
Joeqsmith, you didn't understand anything ...
I HAVE NEVER THOUGHT THAT YOUR TIME DOES NOT APPLY, I ONLY REQUEST THE INSTALLER OF A PROGRAM YOU DEVELOPED ...

I think you didn't understand my intentions, and I'm not able to program.
However, not but nothing, the Gentile helped me
Radioman ...

On the other hand, these are the Americans ... We in Italy, among radio amateurs, help each other.

Bye Bye :( :( :(

I'm glad we finally understand one another.    It's too bad that your not getting my work for free upsets you to the point you feel the need to make such ignorant comment about an entire country but it speaks of your character.     

You do bring up a valid point that what I have been doing is of no help to you.  Others have posted similar comments,  which is something I can live with. 

Take care.

(TAKE CARE):Pay attention to what ?? To you'??? Should I be Afraid ???
 :-DD :-DD :-DD

I didn't want your job, for free, I also wrote you that I was ready to give you a Donation ...

We ITALIANS, we are not like that and among Radio Amateurs & Makers we help each other Free ...

And then a private reply message, you could send it !!!  :=\ :=\ :=\

Don't worry, thanks to the lovely RADIOLISTENEN User, I Solved ...

GOODBYE  :-X :-X :-X
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 08, 2019, 02:35:08 pm
Joeqsmith, you didn't understand anything ...
I HAVE NEVER THOUGHT THAT YOUR TIME DOES NOT APPLY, I ONLY REQUEST THE INSTALLER OF A PROGRAM YOU DEVELOPED ...

I think you didn't understand my intentions, and I'm not able to program.
However, not but nothing, the Gentile helped me
Radioman ...

On the other hand, these are the Americans ... We in Italy, among radio amateurs, help each other.

Bye Bye :( :( :(

I'm glad we finally understand one another.    It's too bad that your not getting my work for free upsets you to the point you feel the need to make such ignorant comment about an entire country but it speaks of your character.     

You do bring up a valid point that what I have been doing is of no help to you.  Others have posted similar comments,  which is something I can live with. 

Take care.

(TAKE CARE):Pay attention to what ?? To you'??? Should I be Afraid ???
 :-DD :-DD :-DD

I didn't want your job, for free, I also wrote you that I was ready to give you a Donation ...

We ITALIANS, we are not like that and among Radio Amateurs & Makers we help each other Free ...

And then a private reply message, you could send it !!!  :=\ :=\ :=\

Don't worry, thanks to the lovely RADIOLISTENEN User, I Solved ...

GOODBYE  :-X :-X :-X


https://dictionary.cambridge.org/dictionary/english/take-care-of-yourself (https://dictionary.cambridge.org/dictionary/english/take-care-of-yourself)
https://www.fluentu.com/blog/english/say-goodbye-english/ (https://www.fluentu.com/blog/english/say-goodbye-english/)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 08, 2019, 03:44:39 pm
joeqsmith - May I abuse your patience and ask:

...

Of course this will slow down the sweep rate by a factor of 5 but I have learned that refresh rate is not everything and there are quite expensive professional test equipment with rather slow sweep rates (a joke in my opinion - but that is another story).
It is not yet clear to me how to software-wise configure the NanoVNA to do S21 measurement so that I just hook the DUT on Port 0 and get a spectrum reading.

Regards
Vitor
Interesting you say that about the speed.  I have a very old Tektronix SA that still uses analog filters that is very slow.    The old HP shown in the picture that I am using to compare with the Nano uses digital IF filtering.   From the plot you could see with a 100KHz span and RBW of 580Hz using the swept spectrum mode requires 154ms.

If I were to adjust the RBW to something lower, say 73 Hz, it would take 1880  seconds.  At the lowest RBW (1.1 Hz) it would require 1,720,000 seconds to sweep.   This analyzer has a narrow band mode that can improve the sweep time.   For example using the same 100KHz span and a 360Hz resolution it requires 10mSec.   

The HP uses 401 samples for all modes compared with the 101 of the Nano.   Looking at the same signal with the Signal Hound using the sweep mode requires 70mSec but it collects 5243 samples. 

As far as setting up the Nano,  CH1 would be set to thru, then LogMag.  In the case of this demo, the Stimulus is set to a Center of 20MHz and the Span set to 100K.  With it being a relative measurement,  just ignore the calibration.   Based on the bit of testing I did, keep the power below 0dBm to avoid compression and you should be fine.   

****

Forgot to mention that the old HP uses GPIB which is fairly slow where the Signal Hound is using USB3.   The Signal Hound can spit data out fast enough that they have a note in the manual that talks about if you plan to write your own software that you will need to keep up.     With the HP, I don't think that would ever be a concern.   
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 08, 2019, 03:52:05 pm
@radiolistener: Thanks for your valuable explanations.

If you notice my previous posts, I do know some parts of it, like the DATA command, but I did not know that I could use the 0/1 argument to get only the required data. That is great and now I understand what joeqsmith meant.

Also, while I do understand that the X/Y data that is received with the DATA command represent a complex number, with real and imaginary component.

What I do NOT understand at this point is for instance how to calculate the dB figure that the NanoVNA shows on the LCD for CH1.

Finally, one of the things I want to achieve is to use the NanoVNA as a spectrum analyzer. I understand it was not designed for this, but I got the impression that it would be a possible thing to do. It is here where I need help!

The communication part is already working, as can be tested with my tool, though it is an initial draft implementation.

I will bear in mind to separate communication from processing, as suggested by OwO.

@Owo: Do you know further details, like retail price, LCD size and resolution, additional functionality (like spectrum analyzer)?

Kind regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 08, 2019, 04:38:18 pm
The HP uses 401 samples for all modes compared with the 101 of the Nano.   Looking at the same signal with the Signal Hound using the sweep mode requires 70mSec but it collects 5243 samples. 
...
Forgot to mention that the old HP uses GPIB which is fairly slow where the Signal Hound is using USB3.

I own a HP8594E (actually I own three units, but two are lacking a working PSU).

I made a special version of my "VMA Simple Spectrum Analyser" software for this series (HP/Agilent 859x) and indeed they use 401 samples per sweep and you are right, using GPIB to transfer these samples takes quite some time, compared for instance with the R&S CMU200/CRTU.

Feel free to take a look at my blog and download the software, in case your HP is of the 859x series. You will require a free license.

I am considering adapting this software for the NanoVNA, in order to use it as a spectrum analyzer (first goal) and then eventually add VNA measurements to my software. So that is the big picture.

And once again, because VNA is totally new to me, I might be wrong about what I imagine is possible to do, but unless I understand that it is indeed impossible, I will try as time allows.

Also note, that hobby-wise I come from TV/CATV/SAT, reception, multiplexing, broadcasting and of course field meters, got into spectrum analysis and am now looking at VNA, which is a bit of a different field to what I am used to.

regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 08, 2019, 05:09:46 pm
What I do NOT understand at this point is for instance how to calculate the dB figure that the NanoVNA shows on the LCD for CH1.

dB figure is a just magnitude of that complex number in logarithmic scale:

magnitude = sqrt(re*re + im*im);

dB = 20 * log10( magnitude );

magnitude value is a Linear S11 plot
dB value is a Logmag S11 plot

The same for S21.
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 08, 2019, 05:57:38 pm
Thanks!

I was being stupid - I somehow was thinking in dBm and not dB.

Anyway, I was doing some hacking and indeed the stitched sweep works!

My software now uses 500 samples (505 to be exact), by running the sweep/data commands 5 times in sequence to cover the selected frequency range.

Speed wise it is OKish - right now I am doing one sweep on every button click. For a continuous mode, I would optimize my code, so that the trace is updated with each individual segment, which would give the illusion of higher sweep rate (much like my VMA Simple Spectrum Analyser software does it for the cheap ADF4351 devices).

Note how the curves are much smoother on the graph and please ignore the rudeness and wrongness of the graph!

Regards,
Vitor

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 08, 2019, 06:58:55 pm
The HP uses 401 samples for all modes compared with the 101 of the Nano.   Looking at the same signal with the Signal Hound using the sweep mode requires 70mSec but it collects 5243 samples. 
...
Forgot to mention that the old HP uses GPIB which is fairly slow where the Signal Hound is using USB3.

I own a HP8594E (actually I own three units, but two are lacking a working PSU).

I made a special version of my "VMA Simple Spectrum Analyser" software for this series (HP/Agilent 859x) and indeed they use 401 samples per sweep and you are right, using GPIB to transfer these samples takes quite some time, compared for instance with the R&S CMU200/CRTU.

Feel free to take a look at my blog and download the software, in case your HP is of the 859x series. You will require a free license.

I am considering adapting this software for the NanoVNA, in order to use it as a spectrum analyzer (first goal) and then eventually add VNA measurements to my software. So that is the big picture.

And once again, because VNA is totally new to me, I might be wrong about what I imagine is possible to do, but unless I understand that it is indeed impossible, I will try as time allows.

Also note, that hobby-wise I come from TV/CATV/SAT, reception, multiplexing, broadcasting and of course field meters, got into spectrum analysis and am now looking at VNA, which is a bit of a different field to what I am used to.

regards,
Vitor

That's a nice setup with the tracking generator.    The HP shown is a 3589A.  Where you have 2.9GHz to play with, this one is limited to 150MHz.  HP calls it a spectrum/network analyzer.  It's a bit of a hybrid.  You can use it with an external coupler and it has software to support down conversion.   

Pictures showing my home made 50 ohm standard with Mini-Circuits coupler.  They did offer a test set for this instrument.

Also shown for fun is two signal generators connected to a splitter and to the 3589A.   The generators are set to 10MHz, separated by 100Hz and 10dBm.     Using the swept mode, you can see it requires 104.86 seconds to sweep.   Using the narrow mode requires 1.28 seconds.   Note the resolution does change but its never caused me a problem.   

For my electronics hobby, I really can't justify the cost of new TE in most cases.  I do a fair amount of projects below 100MHz into the KHz and this system works really well for this.
Title: Re: NanoVNA Custom Software
Post by: rhb on September 08, 2019, 11:58:26 pm
Would you mind explaining the calibrator?  The short, open, load and thru are obvious, but I don't understand the 5th.  There appears to be a "pi" network of some type.  Is that an attenuator?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 09, 2019, 12:09:37 am
Yes, 10dBish. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 09, 2019, 12:35:06 pm
joeqsmith, could you please explain some details about your cal kit design?

The distance between ground and signal wire is not the same along signal wire path. For example, there is too small gap between resistors and the ground on the left side (according to photo orientation). It definitely should affect impedance, isn't it?

Also, there is too small gap between signal wire on PCB and ground on SMA connector...
Title: Re: NanoVNA Custom Software
Post by: N2CUA on September 09, 2019, 03:43:27 pm
Hey Rune .. can you clear some items from your inbox on here so I can send you that list?  ;)

( Sorry for this being kind off topic, but the list does relate to the nanovna software being developed in python )
Title: Re: NanoVNA Custom Software
Post by: rhb on September 09, 2019, 04:06:44 pm
The frequency spacing determines how long the time domain trace is.  The Nyquist frequency determines the sampling.  If you sweep to 900 MHz at 1 MHz spacing you have data for 1 microsecond.  If you pad the end of the frequency series to raise Nyquist to 2 GHz you will have 250 ps sampling.

So, the time interval after IFFT is from 0 to 1/[frequency step] is it correct?


If by "time interval" you mean Tzero to Tmax, yes. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 09, 2019, 04:59:47 pm
joeqsmith, could you please explain some details about your cal kit design?
Depends

The distance between ground and signal wire is not the same along signal wire path. For example, there is too small gap between resistors and the ground on the left side (according to photo orientation). It definitely should affect impedance, isn't it?
Yes

Also, there is too small gap between signal wire on PCB and ground on SMA connector...

A better question is, does any of this cause a problem in the frequency range I use them at.   The board was designed using Sana many years ago.  There was a tradeoff staying with this geometry.   The goal was to use the boards at 1G max, which they have been fine for.  I've used them a little over this.  I would never suggest they would perform at the higher frequencies I have been showing, which is why I posted that disclaimer a few times.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 09, 2019, 05:05:27 pm
I have been thinking about the Nano TDR and if there is a way to combine the phase information.   I think the problem is going to be noise.   In all but a worst case condition where we have a lot of signal being returned, I'm not sure there would be enough information in the phase to use it.   I have yet to try any sort of experiment but my later post showing the RF signal generator attached to channel 1 gives me an idea that it wouldn't work very well.   

Maybe I am missing something, which would be the norm. 
Title: Re: NanoVNA Custom Software
Post by: rhb on September 09, 2019, 06:26:10 pm
Depends on the nature of the noise.  If it is random, it's not a problem.  You can significantly increase the dynamic range by summing measurements.  It the noise is not random it gets more complex, but if you can accurately characterize the noise you can suppress it.  The reflection seismic community has a vast array of tricks for suppressing noise in multichannel data.

I once walked a Scripps PhD candidate through suppressing noise which was probably 40-60 dB *greater* than the signal.  I was quite blown away by his final result as all I had done was demonstrate the rudiments of the process.  Once he grasped the concept, he did an exquisitely meticulous  job of it.

I'm jammed up with an HVAC repair today, so not sure I'll have time to play.  First order test is to do a cal, attach a cable and read the magnitude and phase for S & O.   In theory they should be 180 degrees out of phase, but with a linear delay equal to twice the electrical length of the cable.

Then try some loads which are not 50 ohms and see how small a reflection it can detect.

I *think* that if the test cable has an adjustable attenuator in series, that by placing a S & O at the end and adjusting the attenuator one can directly measure the dynamic range for TDR.  It should be 2x the attenuator setting as the reflection passes through the attenuator twice.

I'm a seismic guy, so at times I bungle the translation from elastic to electromagnetic waves.  Also I'm used to going from time to frequency rather than from frequency to time.  So I generally take a time case, transform to frequency and then transform back.  That way I start with the answer I'm looking for.

Have Fun!
Reg
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 10, 2019, 02:48:46 am
This is my TDR results taken with NanoVNA :)

SHORT and LOAD terminators from cal-kit
[attach=1][attach=2]

500 Ohm and 5 Ohm terminators through SMA-SMA adaptor (adaptor delay is 0.247 ns):
[attach=3][attach=4]

This is CH0 => cable => T adaptor with 50 Ohm terminator => cable => CH1. I'm used two 0.32 meter cables which came with NanoVNA. So, in total we have 25 Ohm in the middle of transmission line. This result may be affected with CH1 input impedance, which drops down to 40 Ohm at 900 MHz, so needs to perform it again with good 50R terminator at the end of line.
[attach=5]

Now let's try more complex transmission line, here is a sequence:
1) 0.5 meters RG316 (SMA-SMA)
2) SMA to SO239 adaptor
3) 1 meter LMR195 (PL259-PL259)
4) SO239 to SMA adaptor

And this is how it works with open end. And with 50R terminator on the end:
[attach=6][attach=7]

Here is zoomed and commented last image (50R at the end of sequence):
[attach=8]
Title: Re: NanoVNA Custom Software
Post by: rhb on September 10, 2019, 03:12:33 am
It's late, I've had a couple of drinks and am headed for bed, but that looks very reasonable.

A triangle window in frequency will suppress the sinc(t) sidelobes a lot, so I suggest trying that.  Squaring the sidelobes makes them rather small.  All window functions have side effects.  At the moment, I prefer a triangular aka Bartlett window as being the best compromise, at least for TDR work.

I'd also suggest preserving the sign of the time domain amplitude so that it's easy to tell capacitive and inductive discontinuities apart.

Have Fun!
Reg
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 10, 2019, 03:53:56 am
A triangle window in frequency will suppress the sinc(t) sidelobes a lot, so I suggest trying that.  Squaring the sidelobes makes them rather small.  All window functions have side effects.  At the moment, I prefer a triangular aka Bartlett window as being the best compromise, at least for TDR work.

This is comparison for Rectangular, Triangular, Blackman and Blackman-Harris-7 window functions:
[attach=1][attach=2][attach=3][attach=4]

This picture shows complex components with Blackman window
[attach=5]

It seems that the Blackman window is the best choice here, because all other window function have high side lobe distortions.

Note: all these pictures are the same reflections from connectors and adapters between different pieces of cables connected together in a line with 50 Ohm load on the end (taken from the last test, see my previous post).

I'd also suggest preserving the sign of the time domain amplitude so that it's easy to tell capacitive and inductive discontinuities apart.

If I understand correctly, in time domain we have reflection coefficient Γ in complex representation. So, I just calculated VSWR in the following way:

VSWR  = (1 + |Γ|) / (1 - |Γ|)

And it works pretty good. But I'm not sure, is it correct?

If you're talking about |Γ| it is always have positive sign. So I'm not sure what did you mean with "time domain amplitude"?


I want to get a chart with absolute impedance along the transmission line. Something like this:

[attach=6]

Is it possible?
Title: Re: NanoVNA Custom Software
Post by: rhb on September 10, 2019, 07:41:19 pm
That's a very nice comparison.  The price for the Blackman window is the inability to separate adjacent reflections.  There are a great many different windows, each having particular strengths and weaknesses.  I thought I knew *all* the windows until I looked at the wikipedia entry.

The Fourier transform of the last figure exists.  So all that is needed to do it is to acquire that data in the frequency domain and find a good heuristic for the DC component.  A sparse L1 (aka basis) pursuit should do an excellent job of solving for DC.

If you compare a TDR trace for an open and short you will see what I mean about preserving the sign of the reflection coefficient.  Knowing that the impulse response is a series of impulses of alternating sign tells you that one discontinuity is inductive and one is capacitive.   This makes it possible to measure the values of the discontinuities.

Have Fun!
Reg

BTW I'd like to suggest using inline full size figures for things like the window comparison.  That would let people see all of them by scrolling up and down.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 11, 2019, 05:14:05 pm
The data shown seems about right for time/length.  If you wanted to compare software with others,  you may want to consider using a standard test file that you could then share with other to compare your results,  rather than using the Nano and cables.  Or maybe stay with the bits included with the Nano.

As far as the windows,  currently I have everything fixed in my software for the Nano but it's not problem to overlay the standard ones in LabView.    Shown with the data I had taken off that small section of coax I used to make my Beatty standard for that last video.   

I haven't tried to do anything more with the Nano.  I have no doubt that the phase would be very sensitive to an open/short and I am sure if you wanted to do a relative long cable measurement for an open cable it would be fairly simple.  But measuring a mm on a 10meter cable is an interesting problem to try and tackle. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 11, 2019, 07:46:22 pm
joeqsmith, how did you calculated that figure?

S1P => apply window => IFFT => ? ? ? => plot


Here is my test S1P file for pictures above:
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 12, 2019, 02:27:46 am
pad to ifft to lp to plot

**
That's LP impulse.  For step, its the integral.  Found most of this in HP app notes.  Still could be wrong.

   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 12, 2019, 03:03:43 am
The frequency spacing determines how long the time domain trace is.  The Nyquist frequency determines the sampling.  If you sweep to 900 MHz at 1 MHz spacing you have data for 1 microsecond.  If you pad the end of the frequency series to raise Nyquist to 2 GHz you will have 250 ps sampling.

Doing an FFT from time to frequency, padding with zeros and inverse transforming is the standard way to resample data to finer sampling rates.  There are other ways of doing it, but the FFT is the fastest.

.......

Have Fun!
Reg

I need to say, I owe you a big thanks for posting this little bread crumb.  This technique was shown in those last couple of plots.  I added it to my Nano program as well and tried it out with hardware.  The is a really nice improvement.  Google came through with the linked article.   
     
https://dspguru.com/dsp/howtos/how-to-interpolate-in-time-domain-by-zero-padding-in-frequency-domain/
Title: Re: NanoVNA Custom Software
Post by: rhb on September 12, 2019, 03:07:43 am
The key to high quality scientific software is identifying cases for which a precise analytic answer is available.  Actually doing that can be staggeringly difficult.

I have spent many days wracking my brain looking for even one.  And I can think of many cases where none is known.  Wave propagation in anisotropic media is staggeringly difficult to verify correctness.

If you cannot solve the analytic equation, why should you trust the numerical solution?  This problem dominated my career in the oil industry.  Once in a great while you wake up in the morning and realize that there is a problem with a known answer that you can use to test a numerical simulation.  But such mornings are depressingly rare.  This is very seriously difficult.  A complete novice can pose a test case that an expert with many years of experience never thought of.

If you're trying to validate the results from a program on which a $100 million decision is going to be made it will drive you crazy.

Reg

BTW Joe,  that was a very basic breadcrumb.  I had the good fortune to be abused by several old men into learning it ;-)
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 12, 2019, 03:37:34 am
pad to ifft to lp to plot

I know that, but my question is what you're doing with data after IFFT?

This is just a sum of real and imaginary part?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 12, 2019, 03:53:04 am
I have no problem with it being basic for you.  Its still a very nice bit of information, at least for me.  So a big thanks for that one.    The only down side is that I didn't have it implement it before making any videos.     

Test jig for trying out some of these bones you're tossing out.

***
Resolution should be sub 0.001". 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 12, 2019, 03:55:00 am
pad to ifft to lp to plot

I know that, but my question is what you're doing with data after IFFT?

This is just a sum of real and imaginary part?

Note, it's backwards from what you had posted.    After LP, I just plot it.   
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 12, 2019, 07:19:02 am
After LP, I just plot it.   

Could you please share S1P file for this screenshot (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2682558/#msg2682558)?

Or just another S1P and screenshot with TDR impedance for this S1P...

For step, its the integral.  Found most of this in HP app notes.  Still could be wrong.
what HP app note exactly you're talking about?
Title: Re: NanoVNA Custom Software
Post by: in3otd on September 12, 2019, 07:28:38 am
I know that, but my question is what you're doing with data after IFFT?
This is just a sum of real and imaginary part?

After the IFFT you should have a purely real response, i.e. the imaginary part should be zero - so you will need to plot just the real part.
Your frequency-domain data (S-parameters) are complex data and when you do an IFFT on them you need to input also the negative frequencies part, as the complex conjugate of the positive frequency data you have, so that the IFFT results will be real.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 12, 2019, 09:06:33 am
After the IFFT you should have a purely real response, i.e. the imaginary part should be zero - so you will need to plot just the real part.

Both input and output of FFT or IFFT are complex.

Your frequency-domain data (S-parameters) are complex data and when you do an IFFT on them you need to input also the negative frequencies part, as the complex conjugate of the positive frequency data you have, so that the IFFT results will be real.

The input (S-parameters) are complex, so the information about negative frequency is already present. And the output of IFFT is complex value with real and imaginary part.

Here is example of IFFT output for S1P that I shared here (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2682027/#msg2682027) (LMR195-RG31605-LMR195-RG58-LOAD.s1p). This is measurement of three different piece of coax cable connected together through adapters and terminated with 50 Ohm at the end of transmission line.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 12, 2019, 11:52:22 am
After LP, I just plot it.   

Could you please share S1P file for this screenshot (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2682558/#msg2682558)?

Or just another S1P and screenshot with TDR impedance for this S1P...

For step, its the integral.  Found most of this in HP app notes.  Still could be wrong.
what HP app note exactly you're talking about?

See attached
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 12, 2019, 12:16:54 pm
You may find this app note of interest as well. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 12, 2019, 12:26:51 pm
See attached

Thanks, but I'm failed to get the same result, I cannot get such picture like your from this s1p  ???

Could you please show also picture with IFFT result (before LPF and other processing) for this s1p file?  Just a plot of real and imaginary parts...

Also what is units along X axis on your picture? If these are nanoseconds, it seems that they are multiplied by two for some reason.

I see that the pulses in provided S1P file are located at 13.762 ns and 18.679 ns. Isn't it?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 12, 2019, 04:41:41 pm
There are many possible reasons for this.  There could be bugs on both sides and miscommunications on both sides....   Certainly what I am showing shouldn't be considered a gold standard.   We almost need someone with a known working setup to provide some test cases that people could then use to validate their math. 

The Touchstone file I provided was from the current setup which is different from the previous plots.  There is a phase trimmer between the Beatty standard and the Nano.  The Beatty standard was terminated to 50 ohms.   I assumed you just wanted to see the 50-25-50 ohm transitions which this file would have, assuming there isn't a bug.   

On previous plots, the X-axis is in samples or inches.  I'm not sure where the phase was set for the file I sent but is is not so long as to be outside of the window.  The Beatty is about 22ish inches of 25 ohm. 
Title: Re: NanoVNA Custom Software
Post by: rhb on September 12, 2019, 06:03:10 pm
Real to complex and complex to real in place FFTs are very popular because the negative frequencies are the complex conjugate of the positive frequencies.  Back when  room size computer had 4 MB of memory and multiple users, these were essential to seismic processing.  But there are lots of FFTs which do *not* fill in the complex conjugate part.  So it matters what algorithm you use.

I'll post TDR to 20 GHz BW using an 11801 & SD-24 later.  Setup will be SMA-M to BNC-F cable open, same with Chinese 50 ohm BNC-M terminator, then SMA-F to BNC-F cable  to BNC-M to SMA-M cable to SMA-F to N-F adapter and Anritsu 50 ohm N-M calibrator load.  The cables are very high quality made for me by a friend.  So it will be a canonical test case.  I can also sweep them to 3 GHz on an 8560A w/ TG option in addition to my nanoVNA results.

The SMA to BNC cables are about 10-12" so it gives good separation in the time domain.

For testing software,  multiply a complex series with a real part of 1.0 and an imaginary part of 0.0 by exp(j*2*pi*f*t) for t equal to 1/2 the reciprocal of the frequency spacing.  Do this with the DC part [0,0]  and with the DC part [1.0,0].  In both cases you should get a spike in the middle of the TDR trace.  Without the DC, the base of the spike will be offset from zero.

Another canonical test is a cosine in frequency.  That will be a pure real spike in time.  A sine wave will be a pure imaginary spike in time.

I've got some headaches to take care of, so it might be a day or two before I have time to do the physical tests.

Attached below are a few pages from Bracewell with pictures of important transforms in both domains.  Most of these are excellent test cases as both domains are obvious.  Some are more complex, but I thought I'd leave them.

What matters are impulse, sine, cosine, "boxcar" (sinc) and some of the variations.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 12, 2019, 06:30:16 pm
Ran a quick check to try out the stage with the added math.   showing 0.1" increments and a total travel of 2.0".   It may be basic but it sure is impressive. 
Title: Re: NanoVNA Custom Software
Post by: jluu on September 12, 2019, 11:27:01 pm
Another article on TRL calibration: https://coppermountaintech.com/design-calibration-of-a-trl-calibration-kit/
Title: Re: NanoVNA Custom Software
Post by: jluu on September 12, 2019, 11:29:15 pm
Another article on TRL calibration: https://coppermountaintech.com/design-calibration-of-a-trl-calibration-kit/

One more, same source: https://coppermountaintech.com/trl-calibration/
Title: Re: NanoVNA Custom Software
Post by: rhb on September 13, 2019, 01:43:16 am
Ran a quick check to try out the stage with the added math.   showing 0.1" increments and a total travel of 2.0".   It may be basic but it sure is impressive.

Very nice.  That's the way to do it.  I'm planning on making  a picosecond level stage once I get all my machine tools set up for such work.  Rather fiddly if you want a clean response.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 13, 2019, 03:06:59 am
I'm not too concerned with the absolute numbers.  40 steps, 0.050" per step.  The top is showing the histogram.   It moves around a bit too much but certainly proves the concept.   
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 13, 2019, 10:01:53 am
joeqsmith, it's better to use nanoseconds. It doesn't depends on cable type :)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 13, 2019, 11:57:07 am
joeqsmith, it's better to use nanoseconds. It doesn't depends on cable type :)
No doubt people have their opinions.       

Currently my software supports metric, English, time and samples for the graphing units.  Most likely it will include phase as well.  Much like the filter settings,  the units are hard coded and changed depending on the test I am running.  In this case, I am working with a stage where I am dealing with distance.  Being from the USA where we can't seem to make the leap to metric, I normally work in English.     

If I had a desire to make the software public, it would include a way to change the units and also store the default settings.  At the present time, I'm more interested in experimenting with the Nano than making polished bit of software for public use.   The software evolves as my requirements change.

That said, the time/distance will have the same profiles.  No matter what units you like, the error is still the same.
Title: Re: NanoVNA Custom Software
Post by: jMachina on September 13, 2019, 07:20:57 pm
I know this thread is for complaining about not getting free software when there is free software and complaining about not having your questions answered even though they are answered  :-DD, I thought I'd add this interesting write-up that takes pains to explain some of the math that I found to be a useful refresher.

https://mightydevices.com/index.php/2019/08/complex-impedance-matching-using-scalar-measurements-math-and-resistors/ (https://mightydevices.com/index.php/2019/08/complex-impedance-matching-using-scalar-measurements-math-and-resistors/)

I have ordered both the least expensive and most expensive nanoVNA clones on Amazon and will post some photos of the PCBs, etc. at a later date.

Thank you Joe for your videos, I am watching my way through all of them and learning a lot!

- Joshua
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 14, 2019, 03:52:54 am
I know this thread is for complaining about not getting free software when there is free software and complaining about not having your questions answered even though they are answered  :-DD,
....
It does seem like this from time to time.   


I thought I'd add this interesting write-up that takes pains to explain some of the math that I found to be a useful refresher.

https://mightydevices.com/index.php/2019/08/complex-impedance-matching-using-scalar-measurements-math-and-resistors/ (https://mightydevices.com/index.php/2019/08/complex-impedance-matching-using-scalar-measurements-math-and-resistors/)

I have ordered both the least expensive and most expensive nanoVNA clones on Amazon and will post some photos of the PCBs, etc. at a later date.

Thank you Joe for your videos, I am watching my way through all of them and learning a lot!

- Joshua

You are very welcome.  I'm glad to hear a few people have found them helpful.

I still only have the one Nano.  If they produce the gen 2 unit that's been mentioned, I may pick one up to help quench my thirst. 

Looking at the error, I discovered a major problem (race condition) with my software design that I have now corrected.  This could cause the data to be corrupt.  Sadly, it didn't help with the error.  What's interesting is plotting the change in distance during the test, we get this sort of U shape.  This is reproducible. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 14, 2019, 03:56:46 am
Using the same setup but not moving the stage, the signal is very stable.   I suspect the home made phase trimmer is the cause of the majority of my problems.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 14, 2019, 04:24:13 am
Replacing the home made trimmer with a commercial one made by Sage and manually adjusting it. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 14, 2019, 04:42:46 am
Going back to the home made phase trimmer with the Beatty cable I show with the Sage, and using roughly the same step size.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 14, 2019, 04:57:46 am
Definition of insanity

1 dated : a severely disordered state of the mind usually occurring as a specific disorder
2 law : unsoundness of mind or lack of the ability to understand that prevents one from having the mental capacity required by law to enter into a particular relationship, status, or transaction or that releases one from criminal or civil responsibility
3a : extreme folly or unreasonableness the insanity of violence His comments were pure insanity.
b : something utterly foolish or unreasonable the insanities of modern life


Let's see, I'm looking at a $50 Chinese VNA with a $1000 phase trimmer attached to it with a $200 torque wrench.  Why?  Because a $500 stage with the $30 home made phase trimmer wouldn't let me play with some basic algorithm.   
Title: Re: NanoVNA Custom Software
Post by: Efcis on September 14, 2019, 10:29:45 am
Hi

Quote
If they produce the gen 2 unit that's been mentioned, I may pick one up to help quench my thirst. 

It may be this one : https://www.aliexpress.com/wholesale?SearchText=nanovna-f (https://www.aliexpress.com/wholesale?SearchText=nanovna-f)

Rgds
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 14, 2019, 11:00:41 am
It may be this one : https://www.aliexpress.com/wholesale?SearchText=nanovna-f (https://www.aliexpress.com/wholesale?SearchText=nanovna-f)


this is the same NanoVNA, but pcb redesigned for large IPS display, more powerful MCU and large 5000 mAh battery.  :)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 14, 2019, 08:53:19 pm
Someone was posting about a 2.4GHz version without using  harmonics and at the same cost, plus improved communications.     I've been using the Nano headless for the most part but have tried it with my 8" tablet.

I made an attempt to improve the home made delay line.  Stepping 0.01"ish  for 150 steps or  1.5"ish total travel.  Shown also is the absolute phase and distance.
Title: Re: NanoVNA Custom Software
Post by: rhb on September 14, 2019, 10:25:16 pm
I'd really appreciate more construction details of your phase shifter as I intend to build at least one and possibly more.  I can resolve delays to picosecond levels on the 11801 & SD-24 combination.

I actually need 8 short (~10-20 ps maximum) phase shifters to phase match the cables from an FPGA board to my Tek 11801 w/ four 2 channel SD-26 sampling heads.  That's for measuring adder-multiplier bit skew for various DSP topologies for use in a FOSS DSO based on Zynq 7010 or 7020 FPGAs.

Making stuff like that is the justification for having a lathe and mill.  I have a Chinese 7" x 14" mini-lathe completely disassembled awaiting new bearings and scraping to make a precision toolmaker's lathe out of it.  As sold they are just a set of parts assembled at the factory to make sure they don't leave any parts out of the kit.

I'm confused by the axis labels on your displays, particularly the Y axes on the display with 3 plots.   In an earlier post you showed the sidelobes of the sinc(x) changing.  It would be helpful to know more about that data.  I spent my career doing oil industry DSP.  My instincts are that your "error" is actually exactly what you should be getting, but I need to know more about the data.

The best test of your software is to construct synthetic test cases.  For example, to test solving for the length, create  several series which are exactly exp(j*2*pi*t) for various values of t.  If t is not an integer multiple of the sample interval dT, then you'll see a sinc(x) for dT = 1/(2*Fn).  If dT is a small faction of that you will always see the sinc(x).  When it is exactly at Nyquist, the time samples all fall at the zero crossings in sinc(x).

Have Fun!
Reg
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 14, 2019, 11:19:14 pm
Consider the very top graph of the set of three, where I use the terms Amplitude, Distance and Length to describe the vertical axis.   This is showing the change in distance per step.  For example, looking at post 333, I an moving the stage in 0.1" increments.  The Nano is showing it from 0.101" down to 0.042".   That was using the home made phase trimmer.     

Looking at post 334, where the stage is not moving, the change is +/-0.002". 

Looking at post 335, where the home made trimmer was replaced with the Sage commercial part where I am adjusting it by hand, it shows between 0.224 and 0.271"   

Post 336 was an attempt to do an A/B compare between the home made trimmer and the commercial part by stepping roughly the same amount.   The was between 0.174
 and 0.280".

Post 340, the stage is incremented  by 0.01" (its really 0.01000976... as it is not an even divisor).  The software reports a mean of 0.0103".  The stage moves 150 steps and show move 1.501465" compared with the reported 1.5314".   I zoomed into the side lobes to show the spacing and we can see they are not uniform.   

The middle graph is just the histogram of the step sizes.  Or how many times the step size falls into a bucket.   

The trimmer is brass.  Your local hobby shop should have all sorts of shapes and sizes to choose from.  There is also McMaster Carr.   
Title: Re: NanoVNA Custom Software
Post by: rhb on September 15, 2019, 12:51:54 am
My question about the phase trimmer was about dimensional and construction details.  The photos I looked at looked like copper pipe with SMA-F to N-F connectors at the end.  I'd expect tube on tube and tube on wire for the line.  I was wondering what the dimensions you chose were and what the measured and calculated impedances were.  What's the reflection at the SMA-F/N-F adapter to adjustable air line look like?

The vertical axes in the first PNG of #340 are "Length" ,"Score" and "Impedance".  The horizontal axes are "Samples", "Length" and "Length".  I know from inspection that the bottom figure is reflection coefficient vs time.  If you take magnitude and phase, convert to a complex series and Fourier transform you get the band limited reflection coefficient on the Y axis and the travel time on the X axis.

In the 2nd PNG of #340, "angle" only has meaning at a single frequency.  If you are comparing change in  line length and the time domain relationship that is time change, "dT".  As a consequence, I have no idea what it describes.

Your work is very interesting, but you've omitted so many details that I am unable to evaluate it.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 15, 2019, 01:46:57 am
The vertical axes in the first PNG of #340 are "Length" ,"Score" and "Impedance".  The horizontal axes are "Samples", "Length" and "Length".  I know from inspection that the bottom figure is reflection coefficient vs time.  If you take magnitude and phase, convert to a complex series and Fourier transform you get the band limited reflection coefficient on the Y axis and the travel time on the X axis.

Length is inches, not time.  Peak is at roughly 20 inches. 

In the 2nd PNG of #340, "angle" only has meaning at a single frequency.  If you are comparing change in  line length and the time domain relationship that is time change, "dT".  As a consequence, I have no idea what it describes.

Angle data was collected at 900MHz for each step.   Samples refers to the number of steps, which was 150 for both PNG1&2.  Trimmer moved from 19.8" to 21.3" in 150 steps.

My question about the phase trimmer was about dimensional and construction details.  The photos I looked at looked like copper pipe with SMA-F to N-F connectors at the end.  I'd expect tube on tube and tube on wire for the line.  I was wondering what the dimensions you chose were and what the measured and calculated impedances were.  What's the reflection at the SMA-F/N-F adapter to adjustable air line look like?

There is no wire as you expect.  55.7 ohms, 18.2pf / 56.7nH per meter.   

Title: Re: NanoVNA Custom Software
Post by: rhb on September 15, 2019, 03:17:52 am

My question about the phase trimmer was about dimensional and construction details.  The photos I looked at looked like copper pipe with SMA-F to N-F connectors at the end.  I'd expect tube on tube and tube on wire for the line.  I was wondering what the dimensions you chose were and what the measured and calculated impedances were.  What's the reflection at the SMA-F/N-F adapter to adjustable air line look like?

There is no wire as you expect.  55.7 ohms, 18.2pf / 56.7nH per meter.

Calculated or measured?  You are either a *very*  poor communicator or  being deliberately obtuse.  I asked for physical dimensions and construction details.  You furnished *nothing* useful.

I asked a simple question about the construction of your delay line.  A linear adjustable length air dielectric delay line must of necessity have inner and outer conductors which telescope.  One *might* get acceptable results by sliding an inner conductor through an end termination, but I'm doubtful.  I'd expect significant issues with stray capacitance and inductance if you did that. You are being willfully mysterious.

Sadly, I'm forced to conclude this thread is a waste of time.  It's just joeqsmith pimping his ego.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 15, 2019, 02:43:19 pm

My question about the phase trimmer was about dimensional and construction details.  The photos I looked at looked like copper pipe with SMA-F to N-F connectors at the end.  I'd expect tube on tube and tube on wire for the line.  I was wondering what the dimensions you chose were and what the measured and calculated impedances were.  What's the reflection at the SMA-F/N-F adapter to adjustable air line look like?

There is no wire as you expect.  55.7 ohms, 18.2pf / 56.7nH per meter.

Calculated or measured?  You are either a *very*  poor communicator or  being deliberately obtuse.  I asked for physical dimensions and construction details.  You furnished *nothing* useful.

I asked a simple question about the construction of your delay line.  A linear adjustable length air dielectric delay line must of necessity have inner and outer conductors which telescope.  One *might* get acceptable results by sliding an inner conductor through an end termination, but I'm doubtful.  I'd expect significant issues with stray capacitance and inductance if you did that. You are being willfully mysterious.

Sadly, I'm forced to conclude this thread is a waste of time.  It's just joeqsmith pimping his ego.

These values were calculated based on the telescoping brass tubes that were used.

https://www.eevblog.com/forum/rf-microwave/sma-phase-adjuster-construction/msg2315619/#msg2315619 (https://www.eevblog.com/forum/rf-microwave/sma-phase-adjuster-construction/msg2315619/#msg2315619)
Your original post on the trimmers was from back in April and it seems you have not made any headway. 

https://www.eevblog.com/forum/rf-microwave/testing-rf-connectors-and-cables/msg2640531/#msg2640531 (https://www.eevblog.com/forum/rf-microwave/testing-rf-connectors-and-cables/msg2640531/#msg2640531)
You had mentioned having ADD and I wonder if your last comment is from your frustrations with your own personal lack of progress. 

You may find the following article helpful.
https://hackaday.io/project/162998-the-rise-and-fall-of-pulses (https://hackaday.io/project/162998-the-rise-and-fall-of-pulses)

Personally, I would have just ordered up some tubing and started trying some things out rather than lashing out at others.   
Title: Re: NanoVNA Custom Software
Post by: OA4LDR on September 15, 2019, 09:58:16 pm
Dear friend, I congratulate you for the work you did with that software. It makes it easier for us radio amateurs that we like to experience every day with all kinds of antennas!  In particular I like to manufacture HF and VHF antennas for me qth!  I wanted to ask you a question?  Do you have the software you made?  Or do you share it experimentally for radio amateurs?  why I wish I could have it installed on my PC!  I have the new version of NanoVNA-F 4: 3 inch screen!  Best regards from Lima Peru I leave my email to see if you can send me the software there!  oa4ldr@gmail.com a hug and greetings to all!  73s atte OA4LDR
Title: Re: NanoVNA Custom Software
Post by: OA4LDR on September 15, 2019, 10:00:36 pm
Dear friend, I congratulate you for the work you did with that software. It makes it easier for us radio amateurs that we like to experience every day with all kinds of antennas!  In particular I like to manufacture HF and VHF antennas for me qth!  I wanted to ask you a question?  Do you have the software you made?  Or do you share it experimentally for radio amateurs?  why I wish I could have it installed on my PC!  I have the new version of NanoVNA-F 4: 3 inch screen!  Best regards from Lima Peru I leave my email to see if you can send me the software there!  oa4ldr@gmail.com a hug and greetings to all!  73s atte OA4LDR
Title: Re: NanoVNA Custom Software
Post by: rhb on September 15, 2019, 11:04:07 pm

These values were calculated based on the telescoping brass tubes that were used.

For which you provided *no* information.  There is not much burden in stating what size tubing you used and other basic construction details.  Not handing out software I fully understand.  Not providing the dimensions of the airline I don't.

Quote

https://www.eevblog.com/forum/rf-microwave/sma-phase-adjuster-construction/msg2315619/#msg2315619 (https://www.eevblog.com/forum/rf-microwave/sma-phase-adjuster-construction/msg2315619/#msg2315619)
Your original post on the trimmers was from back in April and it seems you have not made any headway.

Well, if you don't work on a project, nothing happens.  Tuesday I replaced a A/C condensor fan motor.  Friday I had to deal with replacing a 5 ton compressor and condensor and evaporator coil.  Today I investigated the linearity of the timebase interpolation of my 11801 for which the factory cal constants were lost.  If they actually existed.  In light of the results, I question whether they might not be mythical.

Quote

https://www.eevblog.com/forum/rf-microwave/testing-rf-connectors-and-cables/msg2640531/#msg2640531 (https://www.eevblog.com/forum/rf-microwave/testing-rf-connectors-and-cables/msg2640531/#msg2640531)
You had mentioned having ADD and I wonder if your last comment is from your frustrations with your own personal lack of progress. 


I have more projects than I have time left on this earth.  In most cases I also have no reason to prefer one over the other.  Things like HVAC repairs for tenants do take priority.

I had planned to write new FW for the nanoVNA today until a post on the 11801 showed up on TekScopes.  The 11801 was the smaller project, so I did that.

Quote
You may find the following article helpful.
https://hackaday.io/project/162998-the-rise-and-fall-of-pulses (https://hackaday.io/project/162998-the-rise-and-fall-of-pulses)

I did almost as well 25+ years ago without having a sampling scope and just using a generic prototype board.  Leo Bodnar does <40 ps with a BNC and less with better connectors.

Quote
Personally, I would have just ordered up some tubing and started trying some things out rather than lashing out at others.   

Actually, I'd have started by calculating the impedances for airlines made from stock components rather than engaging in random activity.  I'd been hoping to be spared that tedium.

As you are unwilling to state the relevant dimensions, I stand by my comment.  You're a waste of time.  But..

Have Fun!
Reg

I'm out of here.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 16, 2019, 10:06:57 am
For which you provided *no* information.  There is not much burden in stating what size tubing you used and other basic construction details.  Not handing out software I fully understand.  Not providing the dimensions of the airline I don't.

....
As you are unwilling to state the relevant dimensions, I stand by my comment.  You're a waste of time.  But..

Have Fun!
Reg

I'm out of here.

While I could pull apart the test setup, measure the parts, look up part numbers and suppliers and provide you with a BOM with simulation data, then reassemble the setup and get back to my projects.    Sure, maybe a half hour to sort all this out is all.    You may feel this time is not much burden on me and you deserve it but I value my time.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 16, 2019, 10:12:36 am
Dear friend, I congratulate you for the work you did with that software. It makes it easier for us radio amateurs that we like to experience every day with all kinds of antennas!  In particular I like to manufacture HF and VHF antennas for me qth!  I wanted to ask you a question?  Do you have the software you made?  Or do you share it experimentally for radio amateurs?  why I wish I could have it installed on my PC!  I have the new version of NanoVNA-F 4: 3 inch screen!  Best regards from Lima Peru I leave my email to see if you can send me the software there!  oa4ldr@gmail.com a hug and greetings to all!  73s atte OA4LDR

At this time I have not released any software but check out https://groups.io/g/nanovna-users
There are a few people there making open source programs for the Nano.  I am not sure if they are an improvement over what was offered with the Nano.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 16, 2019, 10:56:59 am

https://youtu.be/eMsdejYM-08
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 16, 2019, 03:34:17 pm
After all, I done it  :-DMM

Here is TDR from S1P file that joeqsmith shared here (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2683290/#msg2683290):
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 16, 2019, 05:56:22 pm
Nice.  Looking at the shape of the 25ohm section,  it seems right except that the width appears to be about 2X wider than I would expect.   It looks like you show a FWHH of about 5ns where I was thinking it should be about 2.5.   The start at 14ns also seems like it's double.    Keep in mind, this could very well be a problem on my side.  If you don't find anything obvious, let me know and I will double check my work. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 16, 2019, 06:27:30 pm
I tested time axis by compare with Group Delay, it shows correct time.

Here is picture with better resolution for 25 ohm section.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 16, 2019, 07:31:56 pm
My guess is that you are looking at the round trip where I am trying to find the distance to the disturbance, so half that.   If that makes sense, I think we have the same numbers.  Of course, we both could be wrong.    :-DD
Title: Re: NanoVNA Custom Software
Post by: ted572 on September 20, 2019, 07:58:36 pm
Please, is this the latest NanoVNA Firmware?  Kernel: 4.0.0, Build time: May  5 2019 - 08:54:38
If not, I would appreciate knowing what the latest is.
Thank you in advance for any assistance, Ted
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 20, 2019, 08:04:04 pm
no, this is outdated version. You can find the latest version here: https://drive.google.com/drive/folders/1IRz6E1wlkRyV0u7sbqj0lhWST-GV1szY
Title: Re: NanoVNA Custom Software
Post by: ted572 on September 20, 2019, 08:35:23 pm
no, this is outdated version. You can find the latest version here: https://drive.google.com/drive/folders/1IRz6E1wlkRyV0u7sbqj0lhWST-GV1szY
Thank you very much, Ted

Edit: Can you please advise which file here is for the latest NanoVNA Firmware.  I assume that it is NanoVNA_edy555_0.1.1.9.zip ???
With my firmware being dated May  5 2019 - 08:54:38, is it likely that the Hardware is the latest and/or also compactable with the current Firmware.  I'm asking because I just ordered this VNA and received it yesterday.  The first thing that I noticed is that the LEDs are Green, and NOT Blue.  So this was my motivation for checking on the current Firmware.

Thanks again for any assistance or advice, Ted
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 20, 2019, 10:18:02 pm
Edit: Can you please advise which file here is for the latest NanoVNA Firmware.  I assume that it is

There are two ways to update firmware: DFU and ST-LINK. So, it depends on what method you're want to use.

1) DFU update. This is simple but not reliable way. If something will going wrong, you may brick your NanoVNA with this method and the only way to restore it is to update firmware with the second method. DFU method doesn't requires any special hardware and you can update it just through USB.

For DFU method, you will need the file with DFU extension: nanoVNA_900_ch_20190920.dfu

In order to upload it into NanoVNA you will need DfuSe software (https://www.st.com/en/development-tools/stsw-stm32080.html).

You will need to power-off your NanoVNA, connect USB to PC, short BOOT jumper with tweezers and power on NanoVNA. It will be booted in DFU mode. The display will be white. Now you can release BOOT jumper and then use DfuSE Demo tool to upload firmware file into NanoVNA.

2) ST-LINK update. This is native and reliable way. But it requires ST-LINKv2 dongle (https://www.aliexpress.com/item/32839270086.html). This dongle allows to flash even bricked device and also allows to use in-circuit debugging.

For ST-LINK update, you will need the file with HEX or BIN (any of these) extension:  nanoVNA_900_ch_20190920.hex

In order to upload it into NanoVNA you will need ST-LINK Utility software (https://www.st.com/en/development-tools/stsw-link004.html).

You will need to connect ST-LINK to NanoVNA with 4 wires:
- 3.3V to VDD,
- GND to GND,
- SWDIO to SWDIO,
- SWCLK to SWCLK

There is no need to solder, you can just connect wires to the pads and press it with finger during upload. Then you will need to use ST-LINK Utility tool with the following memory parameters:
- Address: 0x08000000
- Size: 0x20000
- Data Width: 8 bits

I strongly recommend to save your current firmware before update. Just in case. Both software tools allows it.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 20, 2019, 10:30:27 pm
With my firmware being dated May  5 2019 - 08:54:38, is it likely that the Hardware is the latest and/or also compactable with the current Firmware.

All existing hardware for NanoVNA is compatible with firmware. The LED color may be random, it depends on what LED color is installed by manufacturer.

For a new firmware you may need to install diode on the pcb in order to get working battery indicator. With no diode the battery indicator will always show empty battery.
[attachimg=1]
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 20, 2019, 11:16:15 pm
Hello radiolistener:  I sent a message to my EBay seller telling him that I want to return it for either a full refund, or a current replacement unit.  Because this one has obsolete Firmware, Green LEDs where they are normally Blue, and only 2 Traces are available where as it should be 4.

1) All devices that you may buy on the market has outdated firmware. If you want fresh firmware you're needs to update it by self. You cannot find device with fresh firmware on the market. The update process is pretty easy. Just click on the button "Choose" at the upgrade section of DfuSE Demo tool. And select file with firmware. That's it. Two mouse clicks and your firmware is updated.

2) All devices on the market have different LED color, there is no standard color. You can find exactly the same NanoVNA with red, blue or green LED. They all the same. Just random color of LED.

3) two traces come with old firmware. Just update it and you will have 4 traces. It takes for about 1-2 minutes. Nothing difficult.
Title: Re: NanoVNA Custom Software
Post by: ted572 on September 20, 2019, 11:24:20 pm

1) All devices that you may buy on the market has outdated firmware. If you want fresh firmware you're needs to update it by self. You cannot find device with fresh firmware on the market. The update process is pretty easy. Just click on the button "Choose" at the upgrade section of DfuSE Demo tool. And select file with firmware. That's it. Two mouse clicks and your firmware is updated.

2) All devices on the market have different LED color, there is no standard color. You can find exactly the same NanoVNA with red, blue or green LED. They all the same. Just random color of LED.

3) two traces come with old firmware. Just update it and you will have 4 traces. It takes for about 1-2 minutes. Nothing difficult.
[/quote]
----------------------------------------------------------------------------------------------------------------------------------

OK Great, that is good news.  I will go ahead and update the FW.  Tnx again
Title: Re: NanoVNA Custom Software
Post by: xrunner on September 20, 2019, 11:31:17 pm

2) ST-LINK update. This is native and reliable way. But it requires ST-LINKv2 dongle (https://www.aliexpress.com/item/32839270086.html). This dongle allows to flash even bricked device and also allows to use in-circuit debugging.

For ST-LINK update, you will need the file with HEX or BIN (any of these) extension:  nanoVNA_900_ch_20190920.hex

Thanks for the tutorial radiolistener, I am getting a NanoVNA soon and I just ordered the ST-Link according to your instructions so I can get the firmware updated as needed.

 :-+
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 20, 2019, 11:53:50 pm
OK Great, that is good news.  I will go ahead and update the FW.  Tnx again

Before update, save your current firmware. Just in case if you will want to rollback to old one.
Title: Re: NanoVNA Custom Software
Post by: ted572 on September 21, 2019, 01:41:00 am
Hello radiolistener:  I just removed my NanoVNA's bottom cover to locate the 'Boot Jumper'.  I found it, although the label for it is under a white nylon plug for the Battery (that I haven't seen on any other unit's in the YouTubes(?)).  But the big thing I noticed is that there are no Internal Shields on my PCB as all the other units have (as shown here in the picture from a YouTube).  Again my unit has no shielding where you see it here.  This seems potentially serious(?).  What do you think?   Ted

Edit: I added a picture below of my unit without any shields.

So now of course I wonder if I have a  1. Older unit, 2. Newer unit,  3. Unfinished Older unit, or 4. Unfinished Newer unit?
Title: Re: NanoVNA Custom Software
Post by: amspire on September 21, 2019, 03:42:42 am
So now of course I wonder if I have a  1. Older unit, 2. Newer unit,  3. Unfinished Older unit, or 4. Unfinished Newer unit?
It is pretty close to the layout of the one I have.

The shielding problem is easily fixed.

Just buy some thin shim brass. You can cut it with scissors (as long as it is not someone's prized sewing scissors!) and it is pretty cheap. A dollar or two. Any machinist supply shop or ebay has it.

The bigger shield is in two parts - I have attached a photo.

Richard
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 21, 2019, 04:23:08 am
I had upgraded the firmware when I first received the Nano but it had a few problems.   One in particular was causing me some problem where every now an then, the data was corrupt.    When I wrote my software, I was seeing the problem more frequently than with their software.   

Basically, it seems the firmware could be running a sweep at the same time they were dumping the data and it would corrupt the packet.   Throttling the data rates helps which may be why they chose to run the supplied software so slow.    Even with slower rates, there were modes I could get the firmware into where it was very unreliable.   If I pushed it too hard, the screen would go white and require a power cycle. 

If seems that the person creating the firmware was aware of this problem and changed how the unit handles the messages.  I have spent several hours testing the new firmware and it has yet to glitch.  These tests were with my software running unimpeded.   The screen updates are faster now.  They also added some very nice features to the new firmware.   Well worth the time to upgrade.   

I'm not sure if they have added any new commands but it seems compatible with my software and I am guessing it's backwards compatible.    I wonder if they did not also correct the screen artifacts as I haven't noticed it since the upgrade.   

I also designed this simple driver to control that old Transco transfer relay I had.  The relay is a latching type that runs from 28V.   So the board is a DC-DC boost converter and a couple of one-shots made out of a hex inverter.   It just runs from the same FTDI TTL cable.  This relay works really well.   Isolation is no longer a problem.  They are fairly common in the used market for under $100.  PN is 700C70200.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 21, 2019, 11:41:03 am
There is fixed spike at 300 MHz for measurements in the latest firmware.

Also now it allows to measure up to 1500 MHz. It has higher error above 1200 MHz, but still can be used for antenna tuning.

Also added battery indicator. It shows empty battery, if you want to use it, you're needs to install diode on the pcb. See picture above.

Also I hear that there is added command which allows to get raw data with any desired point count, but with no calibration. It can be used for measurements on PC with custom calibration process. But I'm not sure if this command is present in this firmware (didn't test it yet), may be it will be available in the next release.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 21, 2019, 11:47:14 am
So now of course I wonder if I have a  1. Older unit, 2. Newer unit,  3. Unfinished Older unit, or 4. Unfinished Newer unit?

I know about this version. People install home made shielding and it works the same as other units. But no shielding may affect measurement results.

So, you can ask partial refund for missing shielding and make it self. This version even better, because it has continuous shielding pads around mixers area, while old units have just small pads (it leads to worse shielding).
Title: Re: NanoVNA Custom Software
Post by: ted572 on September 21, 2019, 12:37:18 pm
I received the following link from the seller of my NanoVNA: https://github.com/ttrftech/NanoVNA?tdsourcetag=s_pcqq_aiomsg
I don't see how he would think that this would be of any interest to me, but perhaps it is to a software guy(?).  Its a public post, so probably nothing new to those that follow this web site.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 21, 2019, 01:03:50 pm
I have yet to try running it above 900M.  The calibration would not be a problem as I do this with the PC.  Running a T-check above 500MHz even with the higher quality Transco relay doesn't yield good results.  I have a few filters that work in that 900M to 1.5G region that I'll try with it. 

I'll look into their higher resolution scanning.   I had just assumed this was a limit due to the hardware.  I assume it proportionally slows down the scans but it may be faster than my segmented scanning. 

For now I am more interested in seeing them fix some of the problems.   After watching the Nano's display, it appears the artifacts (left over segments from a previous scan) are still there.  However, the new firmware continues to be glitch free.   By far, this was the best change IMO they made to the firmware.     

The unit I have always had a problem at 300MHz.  Above 300 the results are pretty much what you would expect from a $50 unit.   

Showing data I had collected using the July firmware compared with with the Sep release.  The data was collected using the same cables and 50 ohm load.    Note that the instability around the 300MHz is reduced.   

   
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 21, 2019, 01:11:24 pm
I'll look into their higher resolution scanning.   I had just assumed this was a limit due to the hardware.  I assume it proportionally slows down the scans but it may be faster than my segmented scanning.

the new command doesn't apply calibration to the result. It returns just a raw measurements. You're needs to calculate calibration coefficients and apply it on the PC.

The unit I have always had a problem at 300MHz.  Above 300 the results are pretty much what you would expect from a $50 unit.   

My unit also had a high spike at 300 MHz. With the latest firmware from 20 september it is fixed.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 21, 2019, 01:38:03 pm
I'll look into their higher resolution scanning.   I had just assumed this was a limit due to the hardware.  I assume it proportionally slows down the scans but it may be faster than my segmented scanning.

the new command doesn't apply calibration to the result. It returns just a raw measurements. You're needs to calculate calibration coefficients and apply it on the PC.

From my previous post:
Quote
The calibration would not be a problem as I do this with the PC.

This is how I was able to use the transfer relay to perform full 2-port measurements.   As I stated, it's really no problem.   The attached pictures show an interdigital filter being swept above 900M.   Seems to work.  I'll play with it more later.

The unit I have always had a problem at 300MHz.  Above 300 the results are pretty much what you would expect from a $50 unit.   

My unit also had a high spike at 300 MHz. With the latest firmware from 20 september it is fixed.

From your previous post,
Quote
There is fixed spike at 300 MHz for measurements in the latest firmware.
I interpreted fixed to mean recurring or stationary at 300M, not meaning they improved it.    Good to know that your unit also shows improvements.

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 21, 2019, 03:51:39 pm
I made an attempt to try the Scan command using the comments below.  The Nano responds with a "?" which suggests that it does not understand the command or the syntax is invalid.   I've been avoiding looking at the firmware but it appears that this is really the only source of documentation for it.  Github seems to be down at the moment but I'll have another look later.   

 

Quote
I added one command to the eddy firmware to enable on demand scans of
arbitrary length (yes, you can scan with one million steps or much more if you want)

Usage:
First pause the continuous scanning with "pause" and the use the "scan" command
to scan [from frequency in Hz] [increment frequency in Hz] [number of steps]
The frequency increment step is for now an integer
The scan command outputs

start
frequency s11_real s11_imag s21_real s21_imag
done

during the scan the calibration is NOT used so the output are uncalibrated numbers
allowing alternative calibration strategies

Example:
ch> pause
ch> scan 5000000 20 5
ch> start
5000000 0.001503840 0.000420701 -0.306770563 0.018568072
5000020 0.000695601 0.000503197 -0.306792527 0.018579231
5000040 0.000532656 0.000520238 -0.306793421 0.018573865
5000060 0.000495833 0.000512704 -0.306819111 0.018593480
5000080 0.000520689 0.000523833 -0.306812644 0.018576323
done

ch>
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 21, 2019, 04:40:06 pm
Typing Help, Scan is not listed as a valid command.   Makes sense.   Github was back up so I downloaded the source and had a look at Main.c   

    { "gain", cmd_gain },
    { "power", cmd_power },
    { "sample", cmd_sample },
    //{ "gamma", cmd_gamma },
    //{ "scan", cmd_scan },
    { "sweep", cmd_sweep },
    { "test", cmd_test },
    { "touchcal", cmd_touchcal },

So while it looks like they may have considered adding this feature, it is not supported.   There may have been no benefit to something like this versus using my segmented approach.    Still, the upgrade is well worth it just for that one bug fix.   The system is now fairly stable. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 21, 2019, 04:42:37 pm
yeah, just tested, it is missing from the firmware 20-SEP-2019, so it will be added in the next release
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 21, 2019, 05:41:18 pm
After adding 900M-1.5G into the mix, the noise from 500M to 900M doesn't seem so bad.   :-DD

Video clip showing the scatter plot:
https://www.youtube.com/watch?v=1xzNyqJ1T30&feature=youtu.be (https://www.youtube.com/watch?v=1xzNyqJ1T30&feature=youtu.be)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 22, 2019, 06:00:34 pm
I have some abilities to filter the data.   Shown with a simple smoother.    There no penalty for the screen update rate as it ran across individual scans.   

https://www.microwaves101.com/encyclopedias/smoothing-is-cheating (https://www.microwaves101.com/encyclopedias/smoothing-is-cheating) 

I should mention that I have yet to try averaging the data.  The problem is how slow the Nano is.   Early on, I had tried a few things, like turning off all the traces to try and improve the sweep rates but it appeared to be fixed.   With the new firmware, it's slightly faster because I no longer have to throttle the data rate to keep the Nano from sending bad data.  Still, the improvements are not significant enough to try and average the data. 
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 22, 2019, 06:24:55 pm
"NANOVNASAVER SOFTWARE WALKTHROUGH + NANOVNA FIRMWARE UPDATES BRING 1.5 GHZ MAX RANGE"

https://www.rtl-sdr.com/nanovnasaver-software-walkthrough-nanovna-firmware-updates-bring-1-5-ghz-max-range/ (https://www.rtl-sdr.com/nanovnasaver-software-walkthrough-nanovna-firmware-updates-bring-1-5-ghz-max-range/)
https://github.com/mihtjel/nanovna-saver (https://github.com/mihtjel/nanovna-saver)
https://github.com/ttrftech/NanoVNA (https://github.com/ttrftech/NanoVNA)
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 22, 2019, 06:52:13 pm
I compiled the firmware - not tested, yet - and it does compile without errors.

Attached for everyone's convinience.

Update: Just noticed i can't flash this, as it is not a DFU file! The instructions are wrong for compiling/flashing this. Don't want to use the ST-LINK V2 right now... :(


The FW that was linked a few posts earlier already increases apparently up to 1500MHz - I just did not try.

Also, while compiling works, I end up with a *.bin file instead of a *.dfu file. The difference is of course that teh DFU mode expects a file with the the corresponding headers, which are not present in the *.bin file. How do I compile a DFU file?

Regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 22, 2019, 07:04:43 pm
People still ask for my LabView interface but I'm not sure why.  The open sourced Python seemed to really be what people were asking for and it certainly seems like they have made a progress with it.   Anytime I've asked what features they are missing, I never get a response.  They may just not be aware of the open source project.   
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 22, 2019, 07:11:20 pm
That's the point: I first saw people asking for feature and considered it an opportunity to write a donation-based software.

But then I looked at the existing applications and found them to be of a pretty high quality, so I asked people what they were unhappy with.

The only one responding was you, mentioning the not so nice screen refreshing. Other than that, I got no reply.

Then I thought I could implement the single feature I was not seeing: being able to sweep with more than 101 points. While I did implement that (slow), I noticed that this project I linked today, already does that, too! And there are FW forks to implement the sweep command you mentioned.

This is why I basically gave up on developing anything for this device: there are already too good alternatives!

Regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 22, 2019, 08:03:44 pm
I added that narrow band or what I now call segmented sweep to increase the number of data points when I was working with SPICE and trying to get a decent demo going for that third video.   It will be very interesting to see if this new high resolution sweep will improve things or is it going to be so slow it is useless (much like my segmented sweep).   

I noticed they appear to have information about building the source with Windows but I haven't tried it.  I did however get the screen to go white again today and had to power cycle the unit.  So it's more robust but still could use some improvements.   

Sigilent's website shows them taking orders for their new VNA.   $3400 or so USD, without the cal kit, no TDR and no VNA software included.  Look like you more into the $5K when it's all said and done.    Plus you still have the problem of it not being a full 2-port system.   Hoping this time around that they give the unit to people who can actually show the practical justification of the higher cost when compared with this $50 unit.   :-DD 

https://siglentna.com/spectrum-analyzers/sva1000x-spectrum-vector-analyzer/

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 22, 2019, 08:18:11 pm
TOKO America, PC# 4DFB-915E-10=P
Description   Value      
Maximum Insertion Loss   2.7 dB      
Cut-off/Nominal Frequency Upper Range   800 to 1000 MHz      
Cut-off/Nominal Frequency   915 MHz      
Impedance   50 Ohm      
Maximum Pass Band Ripple   1 dB      
Operating Temperature   -40 to 85 °C      
Category   Filter Misc      
Manufacturer   TOKO America

https://www.digchip.com/datasheets/parts/datasheet/484/TDFM2B-915E-10_P-pdf.php (https://www.digchip.com/datasheets/parts/datasheet/484/TDFM2B-915E-10_P-pdf.php)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 22, 2019, 09:13:21 pm
I spoke too soon.  While playing around with this filter, I had the screen once again turn white which required a power cycle to recover.   Worse, I am once again seeing corrupt data sets.   This is not just my software.  I see it happen on the Nano's screen as well.  Slowing it down does appear to help.    Maybe it has something to do with the span, or the fact I am straddling the 900MHz region. 

Oh well, I was being too optimistic.  Hopefully the people working on the firmware can get something robust.
Title: Re: NanoVNA Custom Software
Post by: ogden on September 22, 2019, 09:27:20 pm
Sigilent's website shows them taking orders for their new VNA.   $3400 or so USD, without the cal kit, no TDR and no VNA software included.  Look like you more into the $5K when it's all said and done.    Plus you still have the problem of it not being a full 2-port system.
You get what you pay for. Anyway standalone SA with S11+S21 3GHz VNA for $4000 is hellova good offer.

Quote
Hoping this time around that they give the unit to people who can actually show the practical justification of the higher cost when compared with this $50 unit.
Perhaps manufacturers which are looking for dependable instrument having better than 60 70dB dynamic range? ;) Not even mentioning freq range. Of course - many hobbyists are fine with nanoVNA, but not every buyer of VNA is hobbyist.

[edit] Comparison of $50 vs $50000 VNA: https://nuclearrambo.com/wordpress/comparing-nanovna-with-the-keysight-fieldfox-n9952a/ (https://nuclearrambo.com/wordpress/comparing-nanovna-with-the-keysight-fieldfox-n9952a/)
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 22, 2019, 09:28:37 pm


Sigilent's website shows them taking orders for their new VNA.   $3400 or so USD, without the cal kit, no TDR and no VNA software included.  Look like you more into the $5K when it's all said and done.    Plus you still have the problem of it not being a full 2-port system.   Hoping this time around that they give the unit to people who can actually show the practical justification of the higher cost when compared with this $50 unit.   :-DD 

https://siglentna.com/spectrum-analyzers/sva1000x-spectrum-vector-analyzer/

You are an optimistic man if you think the Nano will get to 3.2 GHz :)
The nano is a nice 300MHz device.

Also you might have missed this:
"Vector Network Analysis from 10 MHz – 1.5 GHz / 100 kHz – 3.2 GHz (Now included as standard)"
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 22, 2019, 10:59:47 pm
3.2 GHz is good. But 1.5 GHz for 50 USD is good enough for a radio amateurs
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 22, 2019, 11:20:15 pm

[edit] Comparison of $50 vs $50000 VNA: https://nuclearrambo.com/wordpress/comparing-nanovna-with-the-keysight-fieldfox-n9952a/ (https://nuclearrambo.com/wordpress/comparing-nanovna-with-the-keysight-fieldfox-n9952a/)

That review raises an interesting point. They observe that the nano performs worse when used in full span. I've noticed this as well.

A user on another forum explained it in SA terms. Where a narrow span on an SA has a lower noise floor due to a narrow RBW being used.

That theory makes no sense. There is no variable filtering in the nano and the sampling is the same regardless of span as far as I can tell.

However wider spans with the same number of points take larger frequency steps. I wonder if the Si chip needs a longer time to settle when making larger frequency jumps? Maybe simply increasing the wait time prior to sampling will improve things in wide spans?
Title: Re: NanoVNA Custom Software
Post by: OwO on September 23, 2019, 03:45:44 am
Yes, all PLL synthesizers take longer to settle when the frequency jump is larger. And yes, the nanoVNA will eventually reach 3GHz (and at a similar price I've heard). I know definitely that it's going to be based on the adf4350 + si5351.
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 23, 2019, 03:50:29 am
Yes, all PLL synthesizers take longer to settle when the frequency jump is larger. And yes, the nanoVNA will eventually reach 3GHz (and at a similar price I've heard). I know definitely that it's going to be based on the adf4350 + si5351.

Good point - I was referring to the current hardware obviously.

I expect the adf4350 version will be far superior to the current one above 300MHz.
Edit: But still not in the same class as the SVA family.
Title: Re: NanoVNA Custom Software
Post by: ogden on September 23, 2019, 08:56:50 am
And yes, the nanoVNA will eventually reach 3GHz (and at a similar price I've heard). I know definitely that it's going to be based on the adf4350 + si5351.

To me "same price" seems to be way too optimistic. ADF4350 is expensive, VNA needs two. SA612 (3pcs) also have to be replaced with better mixers, like LT5560 or similar. Where we can follow information about next generation of nanoVNA? Any pointers?
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 23, 2019, 09:41:45 am
I wonder if the Si chip needs a longer time to settle when making larger frequency jumps?

yes, large frequency jump needs to reset PLL, it takes some time for PLL lock. But it works fast enough.
Title: Re: NanoVNA Custom Software
Post by: OwO on September 23, 2019, 09:59:15 am
ADF4350 costs about $0.4 each. I've seen the design and the 3 mixers are replaced with one higher spec mixer that is switched between the 3 channels. A variable gain amplifier is added at baseband using one opamp and switched feedback resistors for improved dynamic range. Audio codec is removed and the stm32 built in ADC is used instead. So overall there are quite a few components removed compared to V1 but I heard the performance should be comparable or better.

EDIT: mixer is probably going to be the ad8342.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 23, 2019, 10:31:50 am
Audio codec is removed and the stm32 built in ADC is used instead.

This change will reduce ADC dynamic range from 100 dB to 70 dB. So, it seems that the new NanoVNA will be worse...
Title: Re: NanoVNA Custom Software
Post by: ogden on September 23, 2019, 10:33:55 am
ADF4350 costs about $0.4 each.
Where exactly you can get (genuine & new) ADF4350 for 0.4$? AD web: $6.05 @1000+

Quote
I've seen the design and the 3 mixers are replaced with one higher spec mixer that is switched between the 3 channels.
Right, MiniVNA Tiny. Existence of such design does not mean it is good. Problem with such approach - leakage through switches. Search this forum to see how bad this VNA actually is.

Quote
A variable gain amplifier is added at baseband using one opamp and switched feedback resistors for improved dynamic range. Audio codec is removed and the stm32 built in ADC is used instead.
Again - do not agree to such design decision. ADC of stm32 have barely 11 bit ENOB and 69dB SNR. Such VGA-augmented ADC will have worse linearity and temperature stability comparing to literally any generic audio ADC. Not to mention that VGA acting as part of ADC may slow sampling speed down because some/many points needs to be sampled at least 2 times while correct VGA gain is found.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 23, 2019, 10:44:17 am
ogden, there is also nightmare to capture samples with proper sample rate and low jitter with integrated ADC.
Title: Re: NanoVNA Custom Software
Post by: ogden on September 23, 2019, 11:06:32 am
ogden, there is also nightmare to capture samples with proper sample rate and low jitter with integrated ADC.

This is not audio application, thus "right" sample rate is not required. Just pick closest to target number sample rate (round to ADC clock) and that's it. Yes, clock PLL of stm32 have inherent jitter which may ruin your day in high sample rate ADC applications, yet in this case it is low <= 50KSPS, ENOB of ADC is low. So ADC aperture jitter (https://www.maximintegrated.com/en/design/technical-documents/app-notes/4/4466.html) is not an issue. Yet anyway it is good idea to use new generation "stm32" IC's with improved clock jitter specs, rather than for example stm32l072 with it's +/- 600ps.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 23, 2019, 11:36:59 am
Sigilent's website shows them taking orders for their new VNA.   $3400 or so USD, without the cal kit, no TDR and no VNA software included.  Look like you more into the $5K when it's all said and done.    Plus you still have the problem of it not being a full 2-port system.
You get what you pay for. Anyway standalone SA with S11+S21 3GHz VNA for $4000 is hellova good offer.

Quote
Hoping this time around that they give the unit to people who can actually show the practical justification of the higher cost when compared with this $50 unit.
Perhaps manufacturers which are looking for dependable instrument having better than 60 70dB dynamic range? ;) Not even mentioning freq range. Of course - many hobbyists are fine with nanoVNA, but not every buyer of VNA is hobbyist.

[edit] Comparison of $50 vs $50000 VNA: https://nuclearrambo.com/wordpress/comparing-nanovna-with-the-keysight-fieldfox-n9952a/ (https://nuclearrambo.com/wordpress/comparing-nanovna-with-the-keysight-fieldfox-n9952a/)

For my hobby, I would most likely buy a used 8753.  Siglent isn't on the radar yet.     

I would have expected the people making reviews for the Siglent products to compare them against these low cost analyzers.   Instead, all the videos I saw for Siglent were fairly basic.   I am suggesting they up their game. 
Title: Re: NanoVNA Custom Software
Post by: ogden on September 23, 2019, 11:54:57 am
For my hobby, I would most likely buy a used 8753. Siglent isn't on the radar yet.     
Oh.. Fine choice indeed. I believe that you have to get extremely lucky to find such in working condition for a "hobbyist-friendly price".

Quote
I would have expected the people making reviews for the Siglent products to compare them against these low cost analyzers. Instead, all the videos I saw for Siglent were fairly basic.
Considering that Siglent is new kid in the VNA block, perhaps their reviewers are such as well :D
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 23, 2019, 11:59:25 am
3.2 GHz is good. But 1.5 GHz for 50 USD is good enough for a radio amateurs

It does seem that most people who have written me are indeed amateur radio operators.   I would have guessed 300MHz would have covered most of their needs.  No doubt that the Nano does seem to fill some void for that group.   When Dave made his Siglent review, he makes a point about the amateurs being a potential market.   

If Siglent wants to gain some of that market, they need to make videos showing practical reasons why an amateur would buy their product over a $50 Nano. 




Sigilent's website shows them taking orders for their new VNA.   $3400 or so USD, without the cal kit, no TDR and no VNA software included.  Look like you more into the $5K when it's all said and done.    Plus you still have the problem of it not being a full 2-port system.   Hoping this time around that they give the unit to people who can actually show the practical justification of the higher cost when compared with this $50 unit.   :-DD 

https://siglentna.com/spectrum-analyzers/sva1000x-spectrum-vector-analyzer/

You are an optimistic man if you think the Nano will get to 3.2 GHz :)
The nano is a nice 300MHz device.

Also you might have missed this:
"Vector Network Analysis from 10 MHz – 1.5 GHz / 100 kHz – 3.2 GHz (Now included as standard)"

I didn't notice that they now include the VNA software.   

I'm not sure where they are heading with the Nano or next generation.  My friend bought these just for learning.  From my own home use, I would more than likely pull the trigger on a used HP to replace my 1970s one.   3GHz would not be a problem.   

Quote
However wider spans with the same number of points take larger frequency steps. I wonder if the Si chip needs a longer time to settle when making larger frequency jumps? Maybe simply increasing the wait time prior to sampling will improve things in wide spans?

I wonder if this is part of the problem I saw with that last test.  I would assume most noticed that that data was always corrupt in the area leading up to 900MHz.  Once it reached 900, the data was stable.   Hopefully the people putting the firmware together are aware of these problems and are able to solve them.       
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 23, 2019, 12:13:37 pm
For my hobby, I would most likely buy a used 8753. Siglent isn't on the radar yet.     
Oh.. Fine choice indeed. I believe that you have to get extremely lucky to find such in working condition for a "hobbyist-friendly price".

Quote
I would have expected the people making reviews for the Siglent products to compare them against these low cost analyzers. Instead, all the videos I saw for Siglent were fairly basic.
Considering that Siglent is new kid in the VNA block, perhaps their reviewers are such as well :D

For my personal use,  the $5K USD spent on a Siglent would cover the cost of a used HP that would more than fit my needs.  But I am used to buying used TE and restoring it.  Actually, my antique HP still fits most of my needs which is why I have not replaced it. 

I would say that your last statement is spot on.   IMO, this is not how you want to market your new line of products. 
Title: Re: NanoVNA Custom Software
Post by: ogden on September 23, 2019, 12:39:35 pm
Quote
However wider spans with the same number of points take larger frequency steps. I wonder if the Si chip needs a longer time to settle when making larger frequency jumps? Maybe simply increasing the wait time prior to sampling will improve things in wide spans?
I wonder if this is part of the problem I saw with that last test.  I would assume most noticed that that data was always corrupt in the area leading up to 900MHz.  Once it reached 900, the data was stable.   Hopefully the people putting the firmware together are aware of these problems and are able to solve them.     
Possible explanation in nanovna-users@groups.io post:

Quote
hugen@...Aug 5   #719 
The si5351 manual shows that the internal VCO operates at a maximum of 900MHz and a 4-divide-frequency output with a maximum frequency of 225MHz. In order to output a frequency of 300MHz, the internal VCO needs to be overclocked to 1200MHz. Not every si5351 can be stably overclocked to 1200MHz. As the temperature increases, the internal VCO operating limit frequency of the si5351 will decrease. If you notice a significant spike(>0dB) in your nanoVNA at 300 MHz or 900 MHz, I recommend that you use the 800MHz firmware.
Title: Re: NanoVNA Custom Software
Post by: OwO on September 23, 2019, 02:18:26 pm
This change will reduce ADC dynamic range from 100 dB to 70 dB. So, it seems that the new NanoVNA will be worse...
No, the VGA will extend dynamic range to 100dB, plus ADC dynamic range is nowhere near being the bottleneck anyway.

Where exactly you can get (genuine & new) ADF4350 for 0.4$? AD web: $6.05 @1000+
Not my decision. I just heard this from the internal chat group.

Right, MiniVNA Tiny. Existence of such design does not mean it is good. Problem with such approach - leakage through switches. Search this forum to see how bad this VNA actually is.
Please do not jump to conclusions before you've seen the design. There are 3 stages of switches between the reflection path and the receiver, for a total switch isolation of 90dB.

The bottleneck of the dynamic range is actually the common mode inductance of the two edge mount SMA connectors, and this can't be improved much other than separating the two ports as far as possible. All low cost USB VNAs on the market currently suffers from this problem and is why they are all limited to a dynamic range of around 70dB < 1GHz and 50dB at 3GHz.

Again - do not agree to such design decision. ADC of stm32 have barely 11 bit ENOB and 69dB SNR. Such VGA-augmented ADC will have worse linearity and temperature stability comparing to literally any generic audio ADC. Not to mention that VGA acting as part of ADC may slow sampling speed down because some/many points needs to be sampled at least 2 times while correct VGA gain is found.
See above - ADC dynamic range is far from being the bottleneck. If the ADC is sampling at 1Msps and the VBW is 1kHz, a 60dB ADC dynamic range leads to a 90dB measurement dynamic range, which is more than sufficient. What makes you think autoranging is slow? A typical measured transfer function is fairly smooth and in practice you likely won't ever see more than 5 to 10 autoranging events per sweep, which is equivalent to adding 10 points to a 100 point sweep.
Title: Re: NanoVNA Custom Software
Post by: OwO on September 23, 2019, 02:21:00 pm
And before you jump in and say RF switches are expensive - https://item.szlcsc.com/270817.html
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 23, 2019, 02:26:45 pm
If the ADC is sampling at 1Msps and the VBW is 1kHz, a 60dB ADC dynamic range leads to a 90dB measurement dynamic range, which is more than sufficient.

Oversampling cannot eliminate non-linear distortions of a cheap ADC. If you will be able to get good results with integrated ADC it will be nice win, none can do it. This is why all using external codec.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 23, 2019, 02:30:49 pm
Where exactly you can get (genuine & new) ADF4350 for 0.4$? AD web: $6.05 @1000+

Chinese clones are much cheaper :)
Title: Re: NanoVNA Custom Software
Post by: OwO on September 23, 2019, 02:38:21 pm
I have a prototype of a NanoVNA variant using the built in ADC on the stm32. The measurements using it are nearly identical to the audio codec variant. The reason all NanoVNAs on the market do not use this version is because of software compatibility.
Title: Re: NanoVNA Custom Software
Post by: OwO on September 23, 2019, 02:46:37 pm
I just got more info about the baseband VGA design; a RFIC switch is used to switch the shunt resistor in the feedback path. The switch is basically "transparent" because the off state capacitance is in the femtofarad range (it is an RF switch) which is negligible at the IF frequency. The on state resistance is small compared to the resistors being switched in. Since the amplifier gain is mainly dictated by the feedback network, and the switch is "transparent", there is nothing other than the tempco of the physical resistors that can cause a temperature dependence. The RFIC used is the same as for the receiver RF switch, and it turns out all the maxscend switches do not have the shunt diode problem (most RF switch ICs have parasitic diodes from RF input to ground which will start to conduct at lower frequencies), so it has no theoretical lower frequency limit and can be applied at the IF frequency. This is a big improvement over using normal analog switch ICs which have capacitance in the pF range.

EDIT: also asked about linearity. The answer is that the code will perform a calibration of each VGA step on boot up. Since there is no temperature dependence the calibration only needs to happen once.
Title: Re: NanoVNA Custom Software
Post by: OwO on September 23, 2019, 04:31:59 pm
Here is a preliminary block diagram of the design:

(https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/?action=dlattach;attach=841782;image)
Title: Re: NanoVNA Custom Software
Post by: ogden on September 23, 2019, 04:34:51 pm
The bottleneck of the dynamic range is actually the common mode inductance of the two edge mount SMA connectors, and this can't be improved much other than separating the two ports as far as possible.
I am not sure about this one, but whatever... as you they say. At least put connectors on the long edge of the device.

Quote
All low cost USB VNAs on the market currently suffers from this problem and is why they are all limited to a dynamic range of around 70dB < 1GHz and 50dB at 3GHz.
Not all. Here's one with 90dB dynamic range with close enough connectors, thou those do not seem like edge mount:  https://www.sdr-kits.net/introducing-DG8SAQ-VNWA3 (https://www.sdr-kits.net/introducing-DG8SAQ-VNWA3) 95dB: https://www.megiq.com/products/vna-0440 (https://www.megiq.com/products/vna-0440)

If the ADC is sampling at 1Msps and the VBW is 1kHz, a 60dB ADC dynamic range leads to a 90dB measurement dynamic range, which is more than sufficient.
Oversampling is solution, agreed. Thou at 1Msps you run into ADC aperture jitter problems that adds phase noise to measurements unless you run all stm32 clocks from XO, let's say at 24MHz w/o any PLL.

[edit] I do not buy "common mode inductance of SMA connectors". Most likely they blame connectors while actual problem is internal leakage/reflections. Look how close are connectors for Keysight P5008A which have 140dB dynamic range and better than 140dB crosstalk figures up-to 26GHz.

Where do we sign-up for beta testing?
Title: Re: NanoVNA Custom Software
Post by: OwO on September 23, 2019, 05:11:44 pm
Quote
All low cost USB VNAs on the market currently suffers from this problem and is why they are all limited to a dynamic range of around 70dB < 1GHz and 50dB at 3GHz.
Not all. Here's one with 90dB dynamic range with close enough connectors, thou those do not seem like edge mount:  https://www.sdr-kits.net/introducing-DG8SAQ-VNWA3 (https://www.sdr-kits.net/introducing-DG8SAQ-VNWA3)

Quote
Covering 1 kHz to 1.3 GHz and powered from a PC USB-bus, the VNWA 3 offers a dynamic range of 90dB up to 500 MHz and better than 50dB above 500 MHz.

That sounds about right. It's either common mode inductance or radiated leakage from the exposed center pin depending on your point of view (they are two sides of the same phenomenon which is that E fields wander to the outer face of the coaxial shield). It's pretty well known to anyone designing network analyzers. IIRC the xaVNA full two port version had some solder between the SMA connector body and a shield can to reduce this leakage path, but even then it only got to something like 60-70dB dynamic range at 3GHz. Below 1GHz it's easy to hit 90-100dB dynamic range. The solution is a specific kind of surface mount SMA connector where the center conductor is fully enclosed.
Title: Re: NanoVNA Custom Software
Post by: OwO on September 23, 2019, 05:20:55 pm
I had a play with a certain full two port VNA prototype once, and was surprised how much of the leakage I can remove just by grabbing the outer body of the SMA connector. The leakage floor can go down by 20dB (to 90dB dynamic range) at >3GHz if you grab both connectors. OTOH if you touch both connectors to a piece of metal (just the outer body - the center pin is unconnected) you can see the leakage shoot up 10-20dB. From that it's pretty obvious the leakage path has to do with currents travelling on the outer face of the coax structure.
Title: Re: NanoVNA Custom Software
Post by: ogden on September 23, 2019, 05:28:33 pm
Quote
All low cost USB VNAs on the market currently suffers from this problem and is why they are all limited to a dynamic range of around 70dB < 1GHz and 50dB at 3GHz.
Not all. Here's one with 90dB dynamic range with close enough connectors, thou those do not seem like edge mount:  https://www.sdr-kits.net/introducing-DG8SAQ-VNWA3 (https://www.sdr-kits.net/introducing-DG8SAQ-VNWA3)

Quote
Covering 1 kHz to 1.3 GHz and powered from a PC USB-bus, the VNWA 3 offers a dynamic range of 90dB up to 500 MHz and better than 50dB above 500 MHz.

That sounds about right. It's either common mode inductance or radiated leakage from the exposed center pin depending on your point of view (they are two sides of the same phenomenon which is that E fields wander to the outer face of the coaxial shield).

No. Mainly it's because of harmonics mode above 500Mhz because signal source is DDS. Of course leakage could be contributor as well. Main problem of those "DIY" or "commercial low cost" VNA's that can't reach 90dB isolation - insufficient shielding and failure to follow even basic RF design/layout rules. Screaming example of how not to design VNA is already mentioned MiniVNA Tiny. I really hope design of next gen nanoVNA will not fall into same traps.
Title: Re: NanoVNA Custom Software
Post by: ogden on September 23, 2019, 06:46:31 pm
I had a play with a certain full two port VNA prototype once, and was surprised how much of the leakage I can remove just by grabbing the outer body of the SMA connector. The leakage floor can go down by 20dB (to 90dB dynamic range) at >3GHz if you grab both connectors. OTOH if you touch both connectors to a piece of metal (just the outer body - the center pin is unconnected) you can see the leakage shoot up 10-20dB. From that it's pretty obvious the leakage path has to do with currents travelling on the outer face of the coax structure.

 That's PCB design (layout/shielding), not connector "common mode" problem. Get access to proper VNA like Keysight or R&S to see that touching connectors do not change ANYTHING. Also you are advised to check  Signal Path youtube episodes of VNA teardowns (https://youtu.be/665-hwI8reQ?t=1268) - those instruments are riddled with connectors and cables, yet still reach significant dynamic range.
Title: Re: NanoVNA Custom Software
Post by: OwO on September 23, 2019, 07:16:03 pm
No, I do not need to spend $$$ to see what is easily shown with a simple test board. The professional test equipment do not use this style of edge mount SMA connector, and that is exactly why low cost network analyzers have trouble reaching high dynamic range. I have prototypes and test boards that show plain evidence of connector leakage, and I can assure you the NanoVNA team know what they are doing.
EDIT: V2 has far better PCB layout design compared to V1, and I can guarantee you the bottleneck is not going to be internal leakage.
Title: Re: NanoVNA Custom Software
Post by: OwO on September 23, 2019, 07:23:39 pm
See here:
Notice the mounting of the connector. Details like this do matter and with just one bad leakage path you are not going to get >50dB dynamic range at 3GHz no matter how good your PCB design is. The xaVNA full two port is a testament to this as it has very little internal leakage (proven by removing all connectors) but the dynamic range with connectors and inside its enclosure is not that great. Ironically the dynamic range is improved when you remove the board from the aluminum enclosure (the creators even admit this); do you know why this is?
Title: Re: NanoVNA Custom Software
Post by: ogden on September 23, 2019, 08:25:00 pm
The professional test equipment do not use this style of edge mount SMA connector, and that is exactly why low cost network analyzers have trouble reaching high dynamic range.
They mostly use flange mount connectors for internal modules, yet performance of those do not differ from edge-mount/edge-launch SMA connectors when latter are properly shielded. Manufacturers obviously just pick right connector and do not invent shielding transition for connector which is not made for such. Whatever. - Why don't use angled trough hole mount connectors then?

Quote
I have prototypes and test boards that show plain evidence of connector leakage
Nah. I see plain evidence that horizon is flat, so what? [kidding] - Unlikely you have chamber and equipment for leakage measurements.

Quote
EDIT: V2 has far better PCB layout design compared to V1, and I can guarantee you the bottleneck is not going to be internal leakage.
Good to hear that. How many PCB layers? Where do we sign for beta testing? :)
Title: Re: NanoVNA Custom Software
Post by: ogden on September 23, 2019, 08:38:27 pm
The xaVNA full two port is a testament to this as it has very little internal leakage (proven by removing all connectors) but the dynamic range with connectors and inside its enclosure is not that great.
Indeed. It is clear that he missed to put (legs of) connectors in the shield. Port1 and port2 have connector center legs, some components and quite a transmission line length in common cavity which is main enclosure. That is "no no". I will say it last time - shielding can of particular channel shall cover everything including legs of the connector. [edit] Unfortunately xaVNA is also example of how not to design VNA.

Quote
Ironically the dynamic range is improved when you remove the board from the aluminum enclosure (the creators even admit this); do you know why this is?
Reflections. They forgot to put RF/microwave absorber foam inside aluminium enclosure.

(https://xaxaxa-dev.com/images/vna_tr_2.jpg)
Title: Re: NanoVNA Custom Software
Post by: ogden on September 23, 2019, 09:02:42 pm
Commercial VNA's do not have any TX or RX component or trace or even connector leg exposed into enclosure or outside world. RF PCB is covered by CNC-machined shield of many submodule cavities from both sides.

https://youtu.be/HxBcQDooAYs?t=1333 (https://youtu.be/HxBcQDooAYs?t=1333)

Relevant article:
https://www.edn.com/electronics-blogs/the-practicing-instrumentation-engineer/4418080/Shields-are-your-friend--except-when- (https://www.edn.com/electronics-blogs/the-practicing-instrumentation-engineer/4418080/Shields-are-your-friend--except-when-)
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 23, 2019, 09:15:03 pm
Hi,

I am still new to VNA measurements and started yesterday to do a calibration of my device.

I have the latest FW installed and I can understand some of the steps in calibration, but not all:

OPEN --> connect open header to CH0
SHORT --> connect storted header to CH0
LOAD --> connect 50 Ohmn terminator header to CH0
ISOLN --> what do I have to do here?
THRU --> my guess is I straight connect CH1 to CH0?
DONE --> finish!

Why do I have to do a RESET first? So that measurements are done without any previous calibration? Makes sense, I guess...

Am I correct that CAL should be performed using the same cables that will be used for measurement? Makes sense, because the length will/can determine phase shifts, right?

If these questions are too basic for this thread, I can ask them in a separate topic - I don't want to hijack this nice thread, but I thought that it does generally fit in here.

Thanks,
Vitor
Title: Re: NanoVNA Custom Software
Post by: hendorog on September 23, 2019, 10:01:40 pm
Hi,

I am still new to VNA measurements and started yesterday to do a calibration of my device.

I have the latest FW installed and I can understand some of the steps in calibration, but not all:

OPEN --> connect open header to CH0
SHORT --> connect storted header to CH0
LOAD --> connect 50 Ohmn terminator header to CH0
ISOLN --> what do I have to do here?
THRU --> my guess is I straight connect CH1 to CH0?
DONE --> finish!

Why do I have to do a RESET first? So that measurements are done without any previous calibration? Makes sense, I guess...

Am I correct that CAL should be performed using the same cables that will be used for measurement? Makes sense, because the length will/can determine phase shifts, right?


Yes always try and calibrate at the end of the test cable _and adapters_ you will connect to the DUT. Not always possible of course - if you don't have cal kits for Male and Female you will need to use an adapter. Then you are exposed to any phase and amplitude effects of the adapter. It is possible to correct for that and different methods can be used which have different levels of accuracy.

The Reset clears the data arrays on the device. It's generally a good idea as the firmware isn't perfect, and it also allows you to ignore the ISOLN step if you want to. Otherwise it would probably apply the ISOLN correction from the last cal you did.

For ISOLN you are supposed to put a terminator (load) on both ports. That correction is only applied to the thru measurements - S21.

For a 1 port measurement (CH0) you only need to do Short, Open and Load then Done.

If using the original NanoVNA app _on a PC_, then it is important to do it in the sequence Short Open Load for the best accuracy. Because the Short button also does a Reset. So if you do the Open first and the Short second, then the Open sweep is discarded. This results in a 0.3 dB error approximately.
Middle chart in this link shows this issue: https://github.com/hendorog/nanovna_test/blob/master/NanoVNA%20test.ipynb
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 24, 2019, 01:45:26 am
Ok,  dumb question (but serious).  I've never owned or used state-of-the-art equipment, but what kind of application requires the ability to measure better than 50dB of return loss?  Best I've used is probably 70dB.  If I can achieve 20 dB S11 over a wide operating frequency,  I'm pretty happy.  I can understand if you are doing some kind of advanced science experiment, that you would need >90dB of measurement range, but aside from that,  what practical use is it?  Examples?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 24, 2019, 01:55:33 am
Quote
However wider spans with the same number of points take larger frequency steps. I wonder if the Si chip needs a longer time to settle when making larger frequency jumps? Maybe simply increasing the wait time prior to sampling will improve things in wide spans?
I wonder if this is part of the problem I saw with that last test.  I would assume most noticed that that data was always corrupt in the area leading up to 900MHz.  Once it reached 900, the data was stable.   Hopefully the people putting the firmware together are aware of these problems and are able to solve them.     
Possible explanation in nanovna-users@groups.io post:

Quote
hugen@...Aug 5   #719 
The si5351 manual shows that the internal VCO operates at a maximum of 900MHz and a 4-divide-frequency output with a maximum frequency of 225MHz. In order to output a frequency of 300MHz, the internal VCO needs to be overclocked to 1200MHz. Not every si5351 can be stably overclocked to 1200MHz. As the temperature increases, the internal VCO operating limit frequency of the si5351 will decrease. If you notice a significant spike(>0dB) in your nanoVNA at 300 MHz or 900 MHz, I recommend that you use the 800MHz firmware.

If you look at the data it's not a spike at 300/900 as this person describes.    It appears more like random noise leading up to 900MHz, then it clears up once it goes beyond 900MHz.  Considering the amount of time I ran below 900MHz without a problem,  I suspect it has something to do with the frequency range being swept  but I haven't had time to look into it further.   

I made an attempt to get the Windows tools setup, unsuccessfully. 
Title: Re: NanoVNA Custom Software
Post by: OwO on September 24, 2019, 03:07:17 am
They mostly use flange mount connectors for internal modules, yet performance of those do not differ from edge-mount/edge-launch SMA connectors when latter are properly shielded. Manufacturers obviously just pick right connector and do not invent shielding transition for connector which is not made for such. Whatever. - Why don't use angled trough hole mount connectors then?
Yes so that is my point too; with these common edge mount connectors there is NO way to fully shield it, but all low cost VNAs (under $500) on the market uses these. The through hole SMA connectors have a worse problem - the center pin is long and sticks out which creates an antenna.
Be realistic and don't suggest milled enclosures. You know that is a no-go at this price point. We have to work with commodity parts with reasonable cost, so specialized connectors designed for shielding are also a no-go. If you think you can do a better job then go design and sell your own VNA.

That picture you posted is not the full two port version; the only pictures that exist of it are in a few kickstarter updates. You can see the shielding that covers the two SMA connectors, but even that's insufficient entirely because of that tiny slot between the connector body and the shield can. That is where they added a blob of solder in production.
Title: Re: NanoVNA Custom Software
Post by: OwO on September 24, 2019, 03:10:30 am
The V2 PCB is 4 layers. The schematics will be posted soon, at the same time as the launch on taobao, but you can DM me if you want to see it right now.
Title: Re: NanoVNA Custom Software
Post by: OwO on September 24, 2019, 03:40:38 am
Indeed. It is clear that he missed to put (legs of) connectors in the shield. Port1 and port2 have connector center legs, some components and quite a transmission line length in common cavity which is main enclosure. That is "no no". I will say it last time - shielding can of particular channel shall cover everything including legs of the connector.
How exactly do you put those things inside a shield? As I said earlier simply putting the shield over the connector legs is not sufficient (found experimentally), and you actually have to form a connection between the connector body and shield can body. It's easy to say "you must achieve this" but have you actually tried designing a fully shielded VNA while keeping BOM cost below $100 and have it be manufacturable? Point me to a VNA below $500 that does it correctly as you say. Or are you saying all low cost network analyzers on the market are crap?

Edit: so we are arguing the same point, which is that leakage from the SMA connector center pin trace is significant (assuming the PCB is designed correctly and everything else is shielded). Where I disagree is I think none of the edge mount SMA connectors on the market are actually fully shieldable, and that is why high end test equipment do not use edge mount connectors. If you can find me a picture of a shielded edge mount connector on a PCB that would be great.
Title: Re: NanoVNA Custom Software
Post by: ogden on September 24, 2019, 08:08:27 am
Indeed. It is clear that he missed to put (legs of) connectors in the shield. Port1 and port2 have connector center legs, some components and quite a transmission line length in common cavity which is main enclosure. That is "no no". I will say it last time - shielding can of particular channel shall cover everything including legs of the connector.
How exactly do you put those things inside a shield?

For example - by using trough-hole mount angled connector (attach), mounting it from bottom side so legs can be fully covered by shield lid. If angled SMA for any reason cannot be used and you want to use ultracheap edge mount by all means - order shielding can lid with cutout for connector legs (read below).

The through hole SMA connectors have a worse problem - the center pin is long and sticks out which creates an antenna.

It is no concern considering that you put it's legs under shield. That 1mm does not do much for planned frequencies anyway, owner or naked nude virgins can cut it if any concerns. Siglent did not care about it in front connector board of VNA (picture you posted).

Quote
As I said earlier simply putting the shield over the connector legs is not sufficient (found experimentally), and you actually have to form a connection between the connector body and shield can body. It's easy to say "you must achieve this" but have you actually tried designing a fully shielded VNA while keeping BOM cost below $100 and have it be manufacturable? Point me to a VNA below $500 that does it correctly as you say.

NanoVNA-F. Only thing to improve - add EMI shielding braid between connector shield and can, or just generous amount of solder.
Title: Re: NanoVNA Custom Software
Post by: hwalker on September 24, 2019, 03:41:37 pm
OWO,
I haven't seen any info about what screen size the NanoVNA 2 will be using. Hugen has posted in the past about prototyping with a 3.5-inch LCD and I would expect something that size or larger to keep up with the nanoVNA-F that is now being sold.  Do you have any information you can share?

TKs, Herb
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 24, 2019, 05:34:57 pm
ISOLN --> what do I have to do here?

connect two 50 ohm terminators on both connectors.
If you don't have two, then connect one to CH1 and leave CH0 open.

THRU --> my guess is I straight connect CH1 to CH0?

yes

Why do I have to do a RESET first?

To clear old calibration and avoid mistake.

Am I correct that CAL should be performed using the same cables that will be used for measurement? Makes sense, because the length will/can determine phase shifts, right?

yes
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 26, 2019, 01:04:29 am
I had some time to play with the tool chain again.   I was able to rebuild Hugen79's source and program the image into the Nano using both a Windows 7 and Windows 10 system.  The VNA reports the same version and as expected has the same problems as the image I downloaded.   I was concerned about having a header with exposed pins hanging off the side and used these lower profile pins.   I thought about running it vertical and notching the case but decided to go this route instead.   

I spent some time reading the GNU license a few times along with the FAQ because I am sure that will come up at some point.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 26, 2019, 03:11:27 am
I tried several tests and it seems with my particular Nano,  it will always fail at the frequencies leading to 900MHz.  When sweeping below 900M, it seems to be VERY stable.   When sweeping above 900M, it appears I can change the start to any value and the data will become corrupt.   It seems to have nothing to do with my software (will happen stand alone).  It tried to straddle 300M, 600M and 800M with a 100M span and saw no problems.  It appears unique to 900M.   

It will be difficult to understand how they derived some of their code with the sparse comments.   It's also impossible for me to know if anyone else is seeing this problem.   I randomly tried a few things and it appears that the problem could be improved.   Shown with the original code (about 200 sweeps, several corrupt data sets) and last mods (roughly 1000 sweeps, first data set corrupt only.).     Note that I had replaced the filter with a thru and I am not using any sort of calibration.   Everything is set to the defaults with an 850 start and 950 stop.  If your's has this same problem it is easy to reproduce.  Just watch the screen for a few minutes.   

I'll see if I can narrow the problem down further so maybe the real firmware guys can correct it.  Then again, if it's just this one unit, it's hardly worth going after.   
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 26, 2019, 05:17:24 am
joeqsmith, I can suggest you to try the original NanoVNA firmware written by edy555:
https://github.com/ttrftech/NanoVNA

It works different. It seems that hugen79 removed some part of calibration calculations for some unknown reason. Also it uses different gain and frequency modes.

At a glance, original firmware from edy555 works with a much less noise. Also it seems more stable and has no flickering.
Title: Re: NanoVNA Custom Software
Post by: ogden on September 26, 2019, 06:24:10 am
Just looked at (original) nanovna PCB to find out that decoupling capacitor is way too far from power pin, connecting trace is thin. This is popular decoupling error of many hobby projects using particular chip. In this application it may be critical. I suggest to add decoupling capacitor (sideways standing) between two red dots marked in attachment pic. I can't promise any performance improvements, yet you can try - who knows. There are few more improvements regarding si5351 which I would rather tell only in PM.

[edit] In case you are soldering sharpshooter, you can try to put decoupling cap directly between power and ground pins, they are pin7 & pin8.
Title: Re: NanoVNA Custom Software
Post by: ogden on September 26, 2019, 06:49:18 am
I'll see if I can narrow the problem down further so maybe the real firmware guys can correct it.  Then again, if it's just this one unit, it's hardly worth going after.

It seems like hardware problem (that may be fixable in software or not). Noticeably there are many traces w/o glitch. Then suddenly one or more traces have huge noise. We see that problem occur above 800MHz only when there are huge VCO tuning jumps. Seems like PLL is struggling to lock for some reasons in overclocking freq range or software do not wait long enough for PLL to lock, continue with measurement disregarding unlocked PLL. I have not seen source code - are there any PLL lock checks at all? I say that huge VCO freq jumps shall be followed by direct PLL lock status polling and only small steps shall be done using timeouts.
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 26, 2019, 12:53:12 pm
https://e2e.ti.com/blogs_/b/analogwire/archive/2019/08/23/so-what-is-a-vna-anyway?eloquaCampaignId=2522&utm_campaign=asc-dc-hsc-adc12dj5200RF-articleseries-wwe&utm_medium=email&utm_source=Eloqua#
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 26, 2019, 01:14:42 pm
FWIW,  I just compiled the latest state of this repository  https://github.com/ttrftech/NanoVNA  .   I had to get rid of 32 bytes of "info" text to prevent overflow when compiling.  After installing the calibration was messed up.  I did a cal.   Looks great now.  No glitches.  I think the dynamic range @ 900 MHz might have improved.

[edit]  I've attached a binary if someone else wants to test this build.

[edit]  Forgot to mention a couple of other changes I made to compile the attached image:

Changed this:
Code: [Select]
static const I2SConfig i2sconfig = {
  NULL, // TX Buffer
  rx_buffer, // RX Buffer
  AUDIO_BUFFER_LEN * 2,
  NULL, // tx callback
  i2s_end_callback, // rx callback
  0, // i2scfgr
  2 // i2spr
};

To This:

Code: [Select]
static const I2SConfig i2sconfig = {
  NULL, // TX Buffer
  rx_buffer, // RX Buffer
  AUDIO_BUFFER_LEN * 2,
  i2s_end_callback, // rx callback
  0, // i2scfgr
  2 // i2spr
};

Also, in the Makefile:

Changed from:
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage
To This:
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16

And from:
USE_PROCESS_STACKSIZE = 0x200
To This:
USE_PROCESS_STACKSIZE = 0x1a0

[edit]   I found that I needed to add D2 diode to get the new battery status indicator (added to repository on Sept 9th)  in this firmware working.   

Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 26, 2019, 05:09:53 pm
radioactive, there is no need to make any changes in order to compile it with gcc. Probably you're using incorrect ChibiOS config
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 26, 2019, 05:28:25 pm
radioactive, there is no need to make any changes in order to compile it with gcc. Probably you're using incorrect ChibiOS config

That may be true.  I was just documenting what I did.  The firmware image I attached is definitely better on my device.  I haven't seen any glitchy traces with this image.   That could just be all the new changes that are in the repository.  Once thing I could not get to compile was the I2SConfig struct as is.   

Here is the error:
main.c:448:3: note: (near initialization for 'i2sconfig.i2scfgr')
main.c:448:3: error: initializer element is not computable at load time
main.c:448:3: note: (near initialization for 'i2sconfig.i2scfgr')
main.c:450:3: warning: excess elements in struct initializer

I'm using 'gcc-arm-none-eabi-7-2018-q2-update' toolchain.

[edit]
The change I made to the struct was based on looking at the definition for that struct.   I'm not saying it definitely makes a difference or fixed any issues or even that it is correct.  I needed to change it to get it to compile though.

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 26, 2019, 05:40:52 pm
I'll see if I can narrow the problem down further so maybe the real firmware guys can correct it.  Then again, if it's just this one unit, it's hardly worth going after.

It seems like hardware problem (that may be fixable in software or not). Noticeably there are many traces w/o glitch. Then suddenly one or more traces have huge noise. We see that problem occur above 800MHz only when there are huge VCO tuning jumps. Seems like PLL is struggling to lock for some reasons in overclocking freq range or software do not wait long enough for PLL to lock, continue with measurement disregarding unlocked PLL. I have not seen source code - are there any PLL lock checks at all? I say that huge VCO freq jumps shall be followed by direct PLL lock status polling and only small steps shall be done using timeouts.

I believe this is the case.  There is a lock flag but they do not appear to use it.  Instead they appear to sprinkle delays in the code.  How these delays were calculated does not appear in the comments.   My simple view is that they should leverage that status bit but they may have some reason not to use it.  With the code not being well documented,  it's just a pure guess.

Looking  at the data I show where the unit starts to settle down, I am playing with the delays.

radioactive, there is no need to make any changes in order to compile it with gcc. Probably you're using incorrect ChibiOS config

This seems to be the case.  I just downloaded and it appears to build as is.  I have it running in the Nano now with no changes.   

Title: Re: NanoVNA Custom Software
Post by: radioactive on September 26, 2019, 05:50:45 pm
From:  ChibiOS/os/hal/templates/hal_i2s_lld.h

Code: [Select]
/**
 * @brief   Driver configuration structure.
 * @note    It could be empty on some architectures.
 */
typedef struct {
  /**
   * @brief   Transmission buffer pointer.
   * @note    Can be @p NULL if TX is not required.
   */
  const void                *tx_buffer;
  /**
   * @brief   Receive buffer pointer.
   * @note    Can be @p NULL if RX is not required.
   */
  void                      *rx_buffer;
  /**
   * @brief   TX and RX buffers size as number of samples.
   */
  size_t                    size;
  /**
   * @brief   Callback function called during streaming.
   */
  i2scallback_t             end_cb;
  /* End of the mandatory fields.*/
} I2SConfig;


Code in the main.c  in the repository:
Quote
static const I2SConfig i2sconfig = {
  NULL, // TX Buffer
  rx_buffer, // RX Buffer
  AUDIO_BUFFER_LEN * 2,
  NULL, // tx callback    This appears to be wrong to me
  i2s_end_callback, // rx callback
  0, // i2scfgr
  2 // i2spr
};

Again, it may not make any difference.  My thinking is that the version of gcc I'm using might be catching an error here.   What versions of gcc are you guys compiling with?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 26, 2019, 06:09:47 pm
Lastest firmware from edy555, showing 1700 sweeps, not a single glitch.     I have no idea if the software has other problems or improvements as I am only looking at this one test case.    I'll play around with this version of code as time permits.   

From the change log:

### v8.2.1-1.7.1 (2019-05-24)


 
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 26, 2019, 06:25:42 pm

The reason I reverted back to using gcc-arm-none-eabi-7-2018-q2-update:
https://community.arm.com/developer/tools-software/oss-platforms/f/gnu-toolchain-forum/13503/gcc-g-version-8-very-slow-to-compile

Version 8 was painfully slow for a project I'm working on.  They say it will be fixed in the next release.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 26, 2019, 06:54:57 pm
The change I made to the struct was based on looking at the definition for that struct.   I'm not saying it definitely makes a difference or fixed any issues or even that it is correct.  I needed to change it to get it to compile though.

it seems that you're used SPIv1 instead of SPIv2
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 26, 2019, 06:58:04 pm
From:  ChibiOS/os/hal/templates/hal_i2s_lld.h

you're needs to use ChibiOS\os\hal\ports\STM32\LLD\SPIv2\hal_i2s_lld.h
Title: Re: NanoVNA Custom Software
Post by: ogden on September 26, 2019, 07:09:29 pm
Lastest firmware from edy555, showing 1700 sweeps, not a single glitch.     I have no idea if the software has other problems or improvements as I am only looking at this one test case.    I'll play around with this version of code as time permits.   

Is it possible to rotate graph such a way to properly read vertical scale? Seems like it is more than 0dB at around 880MHz.. What is this? Measurement of bandpass filter or just noise floor? If noise floor then I'll pass on such VNA ;)
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 26, 2019, 07:45:12 pm
From:  ChibiOS/os/hal/templates/hal_i2s_lld.h

you're needs to use ChibiOS\os\hal\ports\STM32\LLD\SPIv2\hal_i2s_lld.h

Sorry,  the file I posted before was not the one I was using.  I am using ChibiOS\os\hal\ports\STM32\LLD\SPIv2\hal_i2s_lld.h,   but the problem I'm describing is still the same:

Trying to fit this from main.c :
Code: [Select]
static const I2SConfig i2sconfig = {
  NULL, // TX Buffer                  //(1)    tx pointer
  rx_buffer, // RX Buffer            //(2)    rx pointer
  AUDIO_BUFFER_LEN * 2,        //(3)    size_t
  NULL, // tx callback                //(4)    tx pointer   (this looks wrong)
  i2s_end_callback, // i2s callback    //(5)    i2s_end_callback pointer
  0, // i2scfgr                 //(6)      int16
  2 // i2spr                    //(7)         int16
};

Into this:  (original comments removed to make it easier to see the types)
ChibiOS\os\hal\ports\STM32\LLD\SPIv2\hal_i2s_lld.h

Quote
typedef struct {
  const void                *tx_buffer;       //(1)    tx pointer
  void                      *rx_buffer;          //(2)     rx pointer
  size_t                    size;                   //(3)      size_t
  i2scallback_t             end_cb;      //(4)      i2scallback   end_cb  pointer
  int16_t                   i2scfgr;             //(5)      i2scfgr  int16
  int16_t                   i2spr;               //(6)       i2spr   int16
} I2SConfig;

It might work anyway.  Or it might compile, but not be what was intended being stuffed in there.  I haven't tried to analyze it much more than that.   This is why I got the compiler error.   There are 7 elements in the initializer,  but the struct definition only has 6 elements.   Am I missing something here?

Anyway,  I'll leave it at that.   I reverted all the changes I made from previous versions of the repository (when I first got the device).   Everything from the current repository state compiles (I haven't tested an image this way yet) with gcc 7.xx, but not this error.


Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 26, 2019, 07:58:15 pm
How do I flash these BIN files?

It should be a DFY file...

When I compiled the sources I got the BIN myself, but was not able to flash it?

Thanks,
Vitor
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 26, 2019, 08:11:50 pm
How do I flash these BIN files?

with ST-LINK
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 26, 2019, 08:19:22 pm
Into this:  (original comments removed to make it easier to see the types)

you're looking wrong file. Here is struct definition from ChibiOS\os\hal\ports\STM32\LLD\SPIv2\hal_i2s_lld.h
(I removed comments):
Code: [Select]
typedef struct {
  const void                *tx_buffer;
  void                      *rx_buffer;
  size_t                    size;
  i2scallback_t             tx_end_cb;
  i2scallback_t             rx_end_cb;
  int16_t                   i2scfgr;
  int16_t                   i2spr;
} I2SConfig;

here is init in the main.c:
Code: [Select]
static const I2SConfig i2sconfig = {
  NULL, // TX Buffer
  rx_buffer, // RX Buffer
  AUDIO_BUFFER_LEN * 2,
  NULL, // tx callback
  i2s_end_callback, // rx callback
  0, // i2scfgr
  2 // i2spr
};

This is original code with no changes and initialization fit with struct declaration.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 26, 2019, 08:35:49 pm

Sorry,  the file I posted before was not the one I was using.  I am using ChibiOS\os\hal\ports\STM32\LLD\SPIv2\hal_i2s_lld.h,   but the problem I'm describing is still the same:

Trying to fit this from main.c :
...

Into this:  (original comments removed to make it easier to see the types)
ChibiOS\os\hal\ports\STM32\LLD\SPIv2\hal_i2s_lld.h

Quote
typedef struct {
  const void                *tx_buffer;       //(1)    tx pointer
  void                      *rx_buffer;          //(2)     rx pointer
  size_t                    size;                   //(3)      size_t
  i2scallback_t             end_cb;      //(4)      i2scallback   end_cb  pointer
  int16_t                   i2scfgr;             //(5)      i2scfgr  int16
  int16_t                   i2spr;               //(6)       i2spr   int16
} I2SConfig;

It might work anyway.  Or it might compile, but not be what was intended being stuffed in there.  I haven't tried to analyze it much more than that.   This is why I got the compiler error.   There are 7 elements in the initializer,  but the struct definition only has 6 elements.   Am I missing something here?

Anyway,  I'll leave it at that.   I reverted all the changes I made from previous versions of the repository (when I first got the device).   Everything from the current repository state compiles (I haven't tested an image this way yet) with gcc 7.xx, but not this error.


Your .h file and the .h file I have are not the same or I am looking at the wrong file, which is possible. 

typedef struct {
  /**
   * @brief   Transmission buffer pointer.
   * @note    Can be @p NULL if TX is not required.
   */
  const void                *tx_buffer;
  /**
   * @brief   Receive buffer pointer.
   * @note    Can be @p NULL if RX is not required.
   */
  void                      *rx_buffer;
  /**
   * @brief   TX and RX buffers size as number of samples.
   */
  size_t                    size;
  /**
   * @brief   Callback function called during streaming of TX.
   */
  i2scallback_t             tx_end_cb;
  /**
   * @brief   Callback function called during streaming of RX.
   */
  i2scallback_t             rx_end_cb;
  /* End of the mandatory fields.*/
  /**
   * @brief   Configuration of the I2SCFGR register.
   * @details See the STM32 reference manual, this register is used for
   *          the I2S configuration, the following bits must not be
   *          specified because handled directly by the driver:
   *          - I2SMOD
   *          - I2SE
   *          - I2SCFG
   *          .
   */
  int16_t                   i2scfgr;
  /**
   * @brief   Configuration of the I2SPR register.
   * @details See the STM32 reference manual, this register is used for
   *          the I2S clock setup.
   */
  int16_t                   i2spr;
} I2SConfig;


Lastest firmware from edy555, showing 1700 sweeps, not a single glitch.     I have no idea if the software has other problems or improvements as I am only looking at this one test case.    I'll play around with this version of code as time permits.   

Is it possible to rotate graph such a way to properly read vertical scale? Seems like it is more than 0dB at around 880MHz.. What is this? Measurement of bandpass filter or just noise floor? If noise floor then I'll pass on such VNA ;)

Sure I can rotate to show the scale.   You are correct, this is indeed a BP filter.  I'm really just looking for the Nano to send up some corrupt data.   I'll try running a few other tests with it.   This version does appear a little slower (I am not currently measuring the Nano's response time)  which I guess would make some sense if they are slowing down the scan to make it more stable.     
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 26, 2019, 09:35:51 pm
Quote
Your .h file and the .h file I have are not the same or I am looking at the wrong file, which is possible. 

I see what is going on.  I'm using the master branch for ChibiOS sub-module.
https://github.com/edy555/ChibiOS/blob/master/os/hal/ports/STM32/LLD/SPIv2/hal_i2s_lld.h

You are probably using this one:
https://github.com/edy555/ChibiOS/blob/669d4bbc8da1ee0e4ccdf93a472b06d183922320/os/hal/ports/STM32/LLD/SPIv2/hal_i2s_lld.h

Thanks.  That explains that.   I'll try that out.    When I pulled the NanoVNA --recursive for the submodules,  I got an error.  I just cloned the referred ChibiOS manually.


[edit]
That was it.  I can compile the latest source without any issues now.  I've attached a binary of that.   However,  after testing it for a bit,  I noticed that the traces did not look near as good as the binary I created from the older ChibiOS source earlier today.   I'll do some more testing, but if someone else can compare the two images, it would be appreciated. 
Title: Re: NanoVNA Custom Software
Post by: hwalker on September 26, 2019, 11:17:26 pm
Bicurico,
If you are using the DfuSeDemo program on Windows to change firmware, then you have to first convert the "BIN" file to a "DFU" file.  The "BIN" format is useable on LINUX and Apple systems  using a command-line utility.  Both formats are released together by some Moders as a convenience.  I believe the DfuFileMgr program can be used to perform the conversion but I'm not certain.

Herb
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 26, 2019, 11:53:58 pm
Quote
Your .h file and the .h file I have are not the same or I am looking at the wrong file, which is possible. 

I see what is going on.  I'm using the master branch for ChibiOS sub-module.
https://github.com/edy555/ChibiOS/blob/master/os/hal/ports/STM32/LLD/SPIv2/hal_i2s_lld.h

You are probably using this one:
https://github.com/edy555/ChibiOS/blob/669d4bbc8da1ee0e4ccdf93a472b06d183922320/os/hal/ports/STM32/LLD/SPIv2/hal_i2s_lld.h

Thanks.  That explains that.   I'll try that out.    When I pulled the NanoVNA --recursive for the submodules,  I got an error.  I just cloned the referred ChibiOS manually.


[edit]
That was it.  I can compile the latest source without any issues now.  I've attached a binary of that.   However,  after testing it for a bit,  I noticed that the traces did not look near as good as the binary I created from the older ChibiOS source earlier today.   I'll do some more testing, but if someone else can compare the two images, it would be appreciated.

Good to hear we are now on the same page. 

If I compare the hugen firmware with the edy555, I do see a difference in the data.   The edy firmware appears to be less stable overall with more noise.  The transition over the 900MHz crossover point it not as smooth.    However, it doesn't seem to send corrupt data like the hugen firmware. 

Both firmware shown with latest build.  Both are stock, just clean builds from Git.   Both are shown with the same 10dB attenuator being swept from 850 - 950MHz.   Note that I only ran about half as many sweeps with the hugen firmware.  You can also see the hugen firmware glitching as before as the frequency is be swept to the 900MHz switch point and then recovering.   You can also see that the edy firmware once again is glitch free.   
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 27, 2019, 05:28:24 am
joeqsmith,

Would you mind comparing the results from this firmware image to the plots you just posted?
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2709596/#msg2709596 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2709596/#msg2709596)   (latest edy555 source with older ChibiOS)

Quote
If I compare the hugen firmware with the edy555, I do see a difference in the data.   The edy firmware appears to be less stable overall with more noise.  The transition over the 900MHz crossover point it not as smooth.    However, it doesn't seem to send corrupt data like the hugen firmware. 

I would describe what I've observed about the same.  The image with the older ChibiOS (above link) appears to have cleared up the glitchy traces as seen in the hugen image (I assume was shipped with my device), but looks like it is better data than either the current edy555 image (latest ChibiOS) or image that shipped with the unit I'm testing as it was shipped.  Unfortunately, I accidentally deleted the firmware image that it shipped with even though I had backed it up.  I have no idea what version, etc it was now.

[edit]
After more testing, no doubt about it for me now.  The latest edy555 firmware, but with old ChibiOS (master branch) is definitely the way to go on my device.  That was a nice accident.
Title: Re: NanoVNA Custom Software
Post by: ogden on September 27, 2019, 09:24:39 am
Someone shall try to contact hugen, huh?

BTW you guys are testing same range again and again, 850-950. It's deep into "out of spec" range. I wonder how glitchty firmware performs in 570-950 range. Exact numbers are important because "roll over" frequency is within specs (<=225Mhz), 570/3=190, 950/5=190.
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 27, 2019, 10:00:07 am
Bicurico,
If you are using the DfuSeDemo program on Windows to change firmware, then you have to first convert the "BIN" file to a "DFU" file.  The "BIN" format is useable on LINUX and Apple systems  using a command-line utility.  Both formats are released together by some Moders as a convenience.  I believe the DfuFileMgr program can be used to perform the conversion but I'm not certain.

Herb

That was it!

I did not notice there was a separate DfuFileMgr. It allows to convert from BIN to DFU, which is much more convenient than using STLink.

Regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 27, 2019, 11:08:37 am
Someone shall try to contact hugen, huh?

BTW you guys are testing same range again and again, 850-950. It's deep into "out of spec" range. I wonder how glitchty firmware performs in 570-950 range. Exact numbers are important because "roll over" frequency is within specs (<=225Mhz), 570/3=190, 950/5=190.

I thought I was clear about the reason I was using this particular range:
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2703604/#msg2703604 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2703604/#msg2703604)
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2708874/#msg2708874 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2708874/#msg2708874)

If not, I'll try to consolidate my findings into this single post for you. 

Running older versions of firmware (I would have no idea what version as they are not clearly marked), the Nano would send up corrupt data at seemingly random times.   Slowing down how fast my software requests data from the Nano improved this.   The corrupt data was not correlated with any specific frequency ranges.   Also, making requests too fast could cause the Nano to white screen which required a power cycle to recover.   I saw the same corrupt data when using their included software.

I then installed some later version of the hugen firmware.  This appeared to completely solve the corrupt data.   I ran several tests over a few days and never saw a single corrupt packet, however, I limited my frequency range to 900MHz.      I then started to run some tests above 900M and discovered it would once again send corrupt packets.  This was independent from how fast I requested the data, or for that matter, it would happen without using any software.   This area was always at the 900MHz switch point.   

Current testing with the latest edy555 firmware is being ran in that same frequency range as that is the only place I have seen a problem. 

Now, if others including yourself are having similar problems in other ranges, I would have no way of knowing unless you posted about it.  If you are having problems at specific ranges, you should post the ranges, the version of firmware you are using and maybe screen shots of your results.   I could then attempt to replicate your findings.   As I said, I only have the one Nano and it's very possible that this one is unique in how it behaves. 

I have not tried to contact anyone outside of this forum.  The main reason is again, I only have one test point (one Nano) and as I said, if the problem in unique to this one unit, it's hardly worth going after.   
Title: Re: NanoVNA Custom Software
Post by: ogden on September 27, 2019, 11:41:31 am
This area was always at the 900MHz switch point.   
To reiterate, 300 and 900MHz crossing points are critical. When crossing 900MHz mark, internal VCO is stepping from (899/3)*4 = 1198.66 MHz to (900/5)*4= 720MHz. Note that max specified freq of internal VCO is 900MHz. Jumping into 850MHz (of your choice) shall be considered for PLL as "tricky to lock" because it is still deep into overclock range. That's why I asked about "safe" 570-950Mhz range. It is obviously for you to decide - you want to waste your precious time checking something that comes from random d00d in the forum or not.

Quote
Now, if others including yourself are having similar problems in other ranges
Thing is I do not have nanovna. Not yet. It is up-to you guys ::)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 27, 2019, 12:01:32 pm
This area was always at the 900MHz switch point.   
To reiterate, 300 and 900MHz crossing points are critical. When crossing 900MHz mark, internal VCO is stepping from (899/3)*4 = 1198.66 MHz to (900/5)*4= 720MHz. Note that max specified freq of internal VCO is 900MHz. Jumping into 850MHz (of your choice) shall be considered for PLL as "tricky to lock" because it is still deep into overclock range. That's why I asked about "safe" 570-950Mhz range. It is obviously for you to decide - you want to waste your precious time checking something that comes from random d00d in the forum or not.

Quote
Now, if others including yourself are having similar problems in other ranges
Thing is I do not have nanovna. Not yet. It is up-to you guys ::)

It seems you are unable to understand that I had ran tests at 300MHz before your posting about it. 
Quote
It tried to straddle 300M, 600M and 800M with a 100M span and saw no problems.  It appears unique to 900M.   

Quote
It is obviously for you to decide - you want to waste your precious time checking something that comes from random d00d in the forum or not.

You don't have one to test and this is the comment you come up with.  :palm:     
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 27, 2019, 12:09:51 pm
joeqsmith,

Would you mind comparing the results from this firmware image to the plots you just posted?
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2709596/#msg2709596 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2709596/#msg2709596)   (latest edy555 source with older ChibiOS)

Quote
If I compare the hugen firmware with the edy555, I do see a difference in the data.   The edy firmware appears to be less stable overall with more noise.  The transition over the 900MHz crossover point it not as smooth.    However, it doesn't seem to send corrupt data like the hugen firmware. 

I would describe what I've observed about the same.  The image with the older ChibiOS (above link) appears to have cleared up the glitchy traces as seen in the hugen image (I assume was shipped with my device), but looks like it is better data than either the current edy555 image (latest ChibiOS) or image that shipped with the unit I'm testing as it was shipped.  Unfortunately, I accidentally deleted the firmware image that it shipped with even though I had backed it up.  I have no idea what version, etc it was now.

[edit]
After more testing, no doubt about it for me now.  The latest edy555 firmware, but with old ChibiOS (master branch) is definitely the way to go on my device.  That was a nice accident.

Using your build, I ran a few more sweeps than the edy555 with the same test setup.   It appears very similar to the image I had just built from Git.  It did not glitch, has the same harsh transition and roughly the same noise.   I may have to add some metric tracking to my software.   

What is really odd, is obviously this is a new day with a whole new install.  Note how that same pattern immerges at roughly the same sweep.   Chances of that happening by chance would be zero.  I wonder if there is something happening in the firmware at these times that causes the pattern. It would be roughly synced up with the power on, or reset. 
Title: Re: NanoVNA Custom Software
Post by: ogden on September 27, 2019, 12:43:10 pm
It seems you are unable to understand that I had ran tests at 300MHz before your posting about it. 
Speaking of ability to understand: had you let VCO jump from < 900MHz frequency to >= 1100 MHz in those tests "at 300MHz"? Hint: you did not. So if you don't want to verify what I say - fine. What is not fine - passive aggressive insults.

Quote
Quote
It is obviously for you to decide - you want to waste your precious time checking something that comes from random d00d in the forum or not.
You don't have one to test and this is the comment you come up with.  :palm:     
Since when owning one became criteria to post in this thread?  :-DD
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 27, 2019, 01:37:43 pm
It seems you are unable to understand that I had ran tests at 300MHz before your posting about it. 
Speaking of ability to understand: had you let VCO jump from < 900MHz frequency to >= 1100 MHz in those tests "at 300MHz"? Hint: you did not. So if you don't want to verify what I say - fine. What is not fine - passive aggressive insults.

Quote
Quote
It is obviously for you to decide - you want to waste your precious time checking something that comes from random d00d in the forum or not.
You don't have one to test and this is the comment you come up with.  :palm:     
Since when owning one became criteria to post in this thread?  :-DD

What I have presented was the test case where I was able to replicate the problem.  I expect it's obvious to most people that this would not include all test cases ran.   

If you had a Nano, and a specific test case that was causing you problems, I would invest the time to try and replicate it.   I am not interested in wasting my time investigating your wild guesses of what you feel may be a problem.   
Title: Re: NanoVNA Custom Software
Post by: Bicurico on September 27, 2019, 02:18:07 pm
https://www.aliexpress.com/item/33010508546.html?spm=a2g0o.productlist.0.0.41987b1ff0XwgM (https://www.aliexpress.com/item/33010508546.html?spm=a2g0o.productlist.0.0.41987b1ff0XwgM)

Is this the new device?

Does it have a spectrum analyzer mode, too?

Regards,
Vitor
Title: Re: NanoVNA Custom Software
Post by: ogden on September 27, 2019, 02:33:16 pm
I am not interested in wasting my time investigating your wild guesses of what you feel may be a problem.
Right. It is so incredibly hard to set other start/stop frequencies, run test again.  :blah: :blah:  Oh and BTW instability of some overclocked si5351 is widely known, hold your horses naming it as my guess. Dont even bother to waste your time answering.
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 27, 2019, 03:08:23 pm
joeqsmith,

Would you mind comparing the results from this firmware image to the plots you just posted?
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2709596/#msg2709596 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2709596/#msg2709596)   (latest edy555 source with older ChibiOS)

Quote
If I compare the hugen firmware with the edy555, I do see a difference in the data.   The edy firmware appears to be less stable overall with more noise.  The transition over the 900MHz crossover point it not as smooth.    However, it doesn't seem to send corrupt data like the hugen firmware. 

I would describe what I've observed about the same.  The image with the older ChibiOS (above link) appears to have cleared up the glitchy traces as seen in the hugen image (I assume was shipped with my device), but looks like it is better data than either the current edy555 image (latest ChibiOS) or image that shipped with the unit I'm testing as it was shipped.  Unfortunately, I accidentally deleted the firmware image that it shipped with even though I had backed it up.  I have no idea what version, etc it was now.

[edit]
After more testing, no doubt about it for me now.  The latest edy555 firmware, but with old ChibiOS (master branch) is definitely the way to go on my device.  That was a nice accident.

Using your build, I ran a few more sweeps than the edy555 with the same test setup.   It appears very similar to the image I had just built from Git.  It did not glitch, has the same harsh transition and roughly the same noise.   I may have to add some metric tracking to my software.   

What is really odd, is obviously this is a new day with a whole new install.  Note how that same pattern immerges at roughly the same sweep.   Chances of that happening by chance would be zero.  I wonder if there is something happening in the firmware at these times that causes the pattern. It would be roughly synced up with the power on, or reset. 

Thanks for testing that.  I may have been on the wrong track with older/newer ChibiOS.   I loaded up the latest  edy555 + latest ChibiOS this morning again and it looks great.  I'm just visually comparing sweeps on a bandpass filter over time.  Yesterday, it seemed there was a clear difference.  This morning,  they look the same.  I may start logging sweeps as well so I can do a better comparison.
Title: Re: NanoVNA Custom Software
Post by: hwalker on September 27, 2019, 03:36:00 pm
Vitor wrote ...
"Is this the new device?"
---------------------------------------------

Vitor,

The device you linked to is not the V2 design.  V2 will come from Hugen who first retailed the nanoVNA device based on the edy555 open source project.  I gleaned the following information from earlier posts in this user group regarding nanoVNA version 2.

1. The nanoVNA will eventually reach 3GHz (and at a similar price to version 1).
2. It's going to be based on the adf4350 + si5351.
3. The 3 mixers are replaced with one higher spec mixer (ad8342) that is switched between the 3 channels.
4. A variable gain amplifier is added at baseband using one opamp and switched feedback resistors for improved dynamic range.
5. The Audio codec is removed and the stm32 built in ADC is used instead.
6. The performance should be comparable or better to V1.
7. Info about the baseband VGA design:  A RFIC switch is used to switch the shunt resistor in the feedback path. The switch is basically "transparent" because the off state capacitance is in the femtofarad range (it is an RF switch) which is negligible at the IF frequency. The on state resistance is small compared to the resistors being switched in. Since the amplifier gain is mainly dictated by the feedback network, and the switch is "transparent", there is nothing other than the tempco of the physical resistors that can cause a temperature dependence. The RFIC used is the same as for the receiver RF switch, and it turns out all the maxscend switches do not have the shunt diode problem (most RF switch ICs have parasitic diodes from RF input to ground which will start to conduct at lower frequencies), so it has no theoretical lower frequency limit and can be applied at the IF frequency. This is a big improvement over using normal analog switch ICs which have capacitance in the pF range.
8. Info about linearity: The code will perform a calibration of each VGA step on boot up. Since there is no temperature dependence the calibration only needs to happen once.
9. The V2 PCB is 4 layers.
10. The schematics will be posted to GitHub, at the same time as the launch on taobao,
11. Design objectives include keeping BOM cost below $100 and compatibility with current software base.

A member of this forum, located in China, indicated that the schematics are available now but only via private request.  I haven't seen any leaked info regarding screen size, but Hugen has posted in the past about prototyping with a 3.5-inch LCD.  I would expect something that size or larger to keep pace with the nanoVNA-F that is already being marketed.  To distinguish itself from the nanoVNA-F, it will most likely be marketed as the nanoVNA-H or nanoVNA-H V2.

Herb
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 27, 2019, 10:02:45 pm
I am not interested in wasting my time investigating your wild guesses of what you feel may be a problem.
Right. It is so incredibly hard to set other start/stop frequencies, run test again.  :blah: :blah:  Oh and BTW instability of some overclocked si5351 is widely known, hold your horses naming it as my guess. Dont even bother to waste your time answering.
It's not hard at all to setup these tests and run them, but once they have been ran, there is no reason to waste time repeating them.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 27, 2019, 10:08:06 pm
joeqsmith,

Would you mind comparing the results from this firmware image to the plots you just posted?
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2709596/#msg2709596 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2709596/#msg2709596)   (latest edy555 source with older ChibiOS)

Quote
If I compare the hugen firmware with the edy555, I do see a difference in the data.   The edy firmware appears to be less stable overall with more noise.  The transition over the 900MHz crossover point it not as smooth.    However, it doesn't seem to send corrupt data like the hugen firmware. 

I would describe what I've observed about the same.  The image with the older ChibiOS (above link) appears to have cleared up the glitchy traces as seen in the hugen image (I assume was shipped with my device), but looks like it is better data than either the current edy555 image (latest ChibiOS) or image that shipped with the unit I'm testing as it was shipped.  Unfortunately, I accidentally deleted the firmware image that it shipped with even though I had backed it up.  I have no idea what version, etc it was now.

[edit]
After more testing, no doubt about it for me now.  The latest edy555 firmware, but with old ChibiOS (master branch) is definitely the way to go on my device.  That was a nice accident.

Using your build, I ran a few more sweeps than the edy555 with the same test setup.   It appears very similar to the image I had just built from Git.  It did not glitch, has the same harsh transition and roughly the same noise.   I may have to add some metric tracking to my software.   

What is really odd, is obviously this is a new day with a whole new install.  Note how that same pattern immerges at roughly the same sweep.   Chances of that happening by chance would be zero.  I wonder if there is something happening in the firmware at these times that causes the pattern. It would be roughly synced up with the power on, or reset. 

Thanks for testing that.  I may have been on the wrong track with older/newer ChibiOS.   I loaded up the latest  edy555 + latest ChibiOS this morning again and it looks great.  I'm just visually comparing sweeps on a bandpass filter over time.  Yesterday, it seemed there was a clear difference.  This morning,  they look the same.  I may start logging sweeps as well so I can do a better comparison.

No problem.   I would need to add software to try and characterize the differences as I can't tell from just visually looking at the data that there is any difference.   Of course, there could be other differences if we start to run other test cases.    Good to hear that you are seeing the same thing.   I have wondered how temperature effects it.  This time of the year, our house stays fairly stable.  Maybe something like this caused your results to change.   

Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 28, 2019, 04:32:19 am
joeqsmith, there is fixed bug with S21 calibration in edy555 firmware, I recommend to update.
Title: Re: NanoVNA Custom Software
Post by: ebclr on September 28, 2019, 07:51:58 am
Do anybody have experience with this unit ?

(http://i.ebayimg.com/images/g/~EoAAOSwCKRcucju/s-l1600.jpg)

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on September 28, 2019, 04:27:45 pm
joeqsmith, there is fixed bug with S21 calibration in edy555 firmware, I recommend to update.

I had seen that release and was going to download it just now but saw they had updated it again a couple of hours ago.  Doing a diff on Main.c, it appears they may be trying to fix the artifact problems I was seeing with the graphics.   

Looking at the hugen area, there appears to be no new changes.   Depending how you use the Nano, it may be worth it to wait a few weeks and see if it becomes more stable.   I wonder if they perform some sort of automated regression test before releasing the code to the public or if they rely on the users to test their code for them.
Title: Re: NanoVNA Custom Software
Post by: xrunner on September 28, 2019, 04:41:19 pm
Been following this thread - thanks for the info. I just got a NanoVNA yesterday, so far it's pretty impressive. Matches the return loss plot of my ham bands fan dipole using a Rigol DSA815-TG.

I did use the dfu utility to update the firmware and it went well - I used this file -

NanoVNA-H__900_ch_20190924.dfu
Title: Re: NanoVNA Custom Software
Post by: MagicSmoker on September 28, 2019, 10:40:46 pm
I read every last message in this thread - can't claim I remember all of them  :P - and promptly ordered a nanovna as a result. I'm more of a power electronics guy than RF but jeez... only $50? Why the hell not?

Actually, I do have a use in mind that I'm not sure can be done but again, only $50; I want to better characterize transformers used in resonant converters. It would be nice if the minimum frequency could be dropped to say, 10kHz (is that a hardware [unlikely] or firmware limit?) but the immediate task at hand is a converter operating at 250kHz which I suspect has an unintended parallel resonance somewhere north of 4MHz (hence why I need a VNA).

And who knows, maybe I'll learn to love the Smith chart...
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 28, 2019, 11:35:13 pm
only $50

now you can find it for 30 USD from some sellers
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 29, 2019, 12:08:48 am
I'll see if I can narrow the problem down further so maybe the real firmware guys can correct it.  Then again, if it's just this one unit, it's hardly worth going after.

It seems like hardware problem (that may be fixable in software or not). Noticeably there are many traces w/o glitch. Then suddenly one or more traces have huge noise. We see that problem occur above 800MHz only when there are huge VCO tuning jumps. Seems like PLL is struggling to lock for some reasons in overclocking freq range or software do not wait long enough for PLL to lock, continue with measurement disregarding unlocked PLL. I have not seen source code - are there any PLL lock checks at all? I say that huge VCO freq jumps shall be followed by direct PLL lock status polling and only small steps shall be done using timeouts.

I'm trying to get PLL lock check added just to see what happens, but something is not working right here.   This returns fail about every other call to set_freq function.  Anyone see what is wrong here?  I've tried quite a few variations on this, but not sure that I'm calling the ChibiOS i2c functions correctly.   Things I've already tried:

-  i2cMasterTransmitTimeout()  only with the receive parameters filled in
-  longer timeouts
-  setting bit 0 for addr on the the read function

Ideas?

Also FYI,  @ogden,  I took a look at the decoupling on pin 7 and pin 1 of the si5351A.  On the board I have,  both pins appear to be decoupled correctly.


Code: [Select]
int si5351_wait_for_pll_lock(void) {

  int addr = SI5351_I2C_ADDR>>1;
  #define STATUS_REG 0x00
  uint8_t reg[] = { STATUS_REG};
  uint8_t data[1];
  int retry=6;

  i2cAcquireBus(&I2CD1);

lock_retry:

  retry--;
  (void)i2cMasterTransmitTimeout(&I2CD1, addr, reg, 1, NULL, 0, 10);
  (void)i2cMasterReceiveTimeout(&I2CD1, addr , data, 1, 10);

  //A and B
  //if( (data[0]&0x60) != 0x00 && --retry>0) goto lock_retry;

  //A only
  //if( (data[0]&0x20) != 0x00 && --retry>0) goto lock_retry;

  //B only
  if( (data[0]&0x40) != 0x00 && retry>0) goto lock_retry;


  i2cReleaseBus(&I2CD1);

  if(retry==0) return 0;
    else return 1;  //PLL locked
}


[edit]  I should point out that I'm quite happy with the current state of the firmware in the github repository.   Just experimenting with it here...
Title: Re: NanoVNA Custom Software
Post by: ogden on September 29, 2019, 07:03:56 am
I'm trying to get PLL lock check added just to see what happens, but something is not working right here.   This returns fail about every other call to set_freq function.
Just two cents, no pressure to do anything about what I going to say next (grin): Usually after PLL freq change there shall be some delay before continuing with PLL state check. After initial delay, PLL lock status shall be checked during defined and *limited* time. So do you know how long it takes to execute PLL lock check loop 6 times? Also such (indicator) class of instrument better not halt with "hard error" on PLL unlock, it shall continue measurements no matter what - as it does now. It may be just some "PLL unlock" warning indicator on screen which lights up for 0.5sec or so and maybe output some diagnostics info in serial output as well (w/o breaking PC s/w backwards compatibility!). As datasheet is very obscure about PLL timings, PLL minimum/maximum delay shall be determined somehow. One is clear that maximum delay do not need to be longer than 10ms which is whole chip power-up time (max). Anyway if it is not locked during significant time say 10ms, most likely it will never lock in current conditions and some change is needed to "fix" situation. BTW that also could be the case why you see errors no matter what.

Quote
Also FYI,  @ogden,  I took a look at the decoupling on pin 7 and pin 1 of the si5351A.  On the board I have,  both pins appear to be decoupled correctly.
Great. Which version do you have? Any chance of PCB close-up picture so potential buyers have better decision making chances?
Title: Re: NanoVNA Custom Software
Post by: hwalker on September 29, 2019, 11:07:29 am
Over on nanovna-users@groups.io, hugen gave some clarifications about his anticipated October product release.

1. It will be called NanoVNA-H per his agreement with edy555 to help differentiate clone branches.
2. He provided a pre-release photo of the  anticipated October product release (see attachment).
3. The release is a repackaging of the current nanoVNA and not the STM32F303CCT6 modification currently in development.

hugen's additional comments on 9-29-2019:

"I don't have a plan to compete with NanoVNA-F. The NanoVNA-F is too big. I can't put it in my trouser pocket. I don't even think he should be called NanoVNA. If you need a larger screen, connecting your smartphone with cho45's NanoVNA-Web-Client (https://github.com/cho45/NanoVNA-Web-Client) is a great solution. Regarding the new nanoVNA-H plan, I am trying to move to STM32F303CCT6 with AA6KL. Maybe I will try 3.5-inch LCD later. If you are interested, you can follow this project https://github.com/AA6KL/NanoVNA, if You want to participate in development and you can contact me to get the hardware. Thank you!"


Title: Re: NanoVNA Custom Software
Post by: radioactive on September 29, 2019, 09:41:38 pm
I'm trying to get PLL lock check added just to see what happens, but something is not working right here.   This returns fail about every other call to set_freq function.
Just two cents, no pressure to do anything about what I going to say next (grin): Usually after PLL freq change there shall be some delay before continuing with PLL state check. After initial delay, PLL lock status shall be checked during defined and *limited* time. So do you know how long it takes to execute PLL lock check loop 6 times? Also such (indicator) class of instrument better not halt with "hard error" on PLL unlock, it shall continue measurements no matter what - as it does now. It may be just some "PLL unlock" warning indicator on screen which lights up for 0.5sec or so and maybe output some diagnostics info in serial output as well (w/o breaking PC s/w backwards compatibility!). As datasheet is very obscure about PLL timings, PLL minimum/maximum delay shall be determined somehow. One is clear that maximum delay do not need to be longer than 10ms which is whole chip power-up time (max). Anyway if it is not locked during significant time say 10ms, most likely it will never lock in current conditions and some change is needed to "fix" situation. BTW that also could be the case why you see errors no matter what.

Quote
Also FYI,  @ogden,  I took a look at the decoupling on pin 7 and pin 1 of the si5351A.  On the board I have,  both pins appear to be decoupled correctly.
Great. Which version do you have? Any chance of PCB close-up picture so potential buyers have better decision making chances?

Success! 

The main problem I was having getting it to work was needing to turn off DMA for I2C communications in mcuconf.h

Code: [Select]
#define STM32_I2C_USE_DMA                   FALSE
beginning of sweep function in main.c looks like this now:

Code: [Select]
// main loop for measurement
bool sweep(bool break_on_operation)
{
  int i;
  int delay;

  for (i = 0; i < sweep_points; i++) {

retry_lock:

    #if 1
      delay = set_frequency(frequencies[i]);

      if( si5351_wait_for_pll_lock()==0) {
        chprintf((BaseSequentialStream *)&SDU1, "freq: %d not locking\r\n", frequencies[i]);
        frequencies[i] += 1;  //see if we can lock on 1Hz greater freq
        goto retry_lock;
      }
      tlv320aic3204_select_in3(); // CH0:REFLECT
      wait_dsp(delay);
    #else
      tlv320aic3204_select_in3(); // CH0:REFLECT
      wait_dsp(delay);
    #endif


new function in si5351.c

Code: [Select]
int si5351_wait_for_pll_lock(void) {

  int addr = SI5351_I2C_ADDR>>1;
  #define STATUS_REG 0x00
  uint8_t reg[] = { STATUS_REG};
  uint8_t data[1];
  int retry=99;

  i2cAcquireBus(&I2CD1);

lock_retry:

  retry--;
  (void)i2cMasterTransmitTimeout(&I2CD1, addr, reg, 1, data, 1, 1000);

  //A and B
  if( (data[0]&0x60) != 0x00 && --retry>0) goto lock_retry;

  i2cReleaseBus(&I2CD1);

  if(retry==0) return 0;
    else return 1;
}

With retry=6 in wait_for_lock function,  I see errors locking like this during sweeps:

Quote
freq: 50024 not locking
freq: 108044024 not locking
freq: 153041524 not locking
freq: 306033024 not locking
freq: 450025024 not locking
freq: 50025 not locking
freq: 108044025 not locking
freq: 153041525 not locking
freq: 306033025 not locking
freq: 450025025 not locking
freq: 50026 not locking
freq: 108044026 not locking
freq: 153041526 not locking
freq: 306033026 not locking
freq: 450025026 not locking
freq: 50027 not locking
freq: 108044027 not locking
freq: 153041527 not locking
freq: 306033027 not locking
freq: 450025027 not locking
freq: 50028 not locking
freq: 108044028 not locking
freq: 153041528 not locking
freq: 306033028 not locking
freq: 450025028 not locking

With retry=99  in wait_for_lock function,  I see no errors locking.

@ogden,  I can post an image later, but you can just take a look at the image of pcb and schematic at hugen's sales site here:  https://www.alibaba.com/product-detail/Original-2-8-Touchscreen-50KHz-900MHz_62232701280.html (https://www.alibaba.com/product-detail/Original-2-8-Touchscreen-50KHz-900MHz_62232701280.html)



Title: Re: NanoVNA Custom Software
Post by: radioactive on September 29, 2019, 10:06:56 pm
Forgot to mention that the lock errors shown in previous post were for the standard 101 point sweep from 50kHz to 900MHz.   Still no errors showing up with retry=99.  I may stick the thing in freezer and oven later to see if anything different happens.
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 29, 2019, 10:39:06 pm
If anyone wants to compare their results with mine, but doesn't want to make changes to source and compile,  I'm attaching a binary.  This differs in one way from the results that I posted in previous 2 posts.  This binary will not increment the frequency by 1 Hz if the wait_for_lock function fails to lock.  If there is no lock, it will just print the frequency that did not lock in the USB serial console and continue to retry.  Note that you would need to handle this in your external software application if there is actually some lock errors during the sweep.  This firmware image has the retry=99 in the wait_for_lock function.  I can also post an image for retry=6 (or whatever) if anyone wants to compare results for that.   Aside from the changes I posted above, this firmware image is based on the latest source from here:   https://github.com/ttrftech/NanoVNA   ,  from edy555 commit 30d33571fa3929ff697bf410d3b7f25145cc6e45

[edit]
If you do try this out,  it would probably be a good idea to do a re-cal just in case this might improve calibration coefficients for a few frequencies that were off from the previous cal due to unlock.

[edit]

I tested after putting it in the freezer for 10 minutes and the oven, low temp,  for 10 minutes (measured 105F when I pulled it out).  No pll lock errors reported with retry=99 in lock function for either temperature extreme.   I did see 3-4 glitches in the display for the first 30 seconds or so after the cold temperatures.  Not sure what that would be.

I would say this is something that probably should be added to the code base.  Based on experience with frequency synthesizers,  I have found that you *must* check for lock and have some sort of retry mechanism.  It might only affect one unit out of a batch.  It might only happen in temperatures extremes, but sooner or later you will find unlock happening in certain circumstances.  It needs to be handled by checking lock status, retries, etc.
Title: Re: NanoVNA Custom Software
Post by: ogden on September 30, 2019, 05:44:16 am
Success!
Congrats!  :clap:

Quote
        frequencies += 1;  //see if we can lock on 1Hz greater freq
Better do not touch frequency like that unless you are absolutely sure. Even slightest shift of IF or LO freq which is unexpected for VNA math, may lead to significant errors.

Quote
With retry=99  in wait_for_lock function,  I see no errors locking.
Good. You may narrow down retry number in just few test runs by using "binary search" approach.

Quote
@ogden,  I can post an image later, but you can just take a look at the image of pcb and schematic at hugen's sales site here
No need. Knowing that it is hugen's original version, we just take picture from the web (attach). BTW from appearance it seems like @joeqsmith have such as well. Yes, this version have decoupling capacitor for pin7 which is kinda improvement compared to edy555 PCB, yet there's still rookie errors: both traces going to (C10) capacitor forms loop antenna close to nearby signal trace. Influence may be minimal, yet anyway... There was room for everything - few ground plane stiches along signal line *and* closer pin7 capacitor placement. It becomes clear when we look at audio codec decoupling capacitor (C34, C36, C37) placements which are strange as well: they all are at distance away from the chip. Seems like strange "minimum distance to IC" rule applied  :palm: and absent ground via next to cap.
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 30, 2019, 06:54:17 am
Quote
Better do not touch frequency like that unless you are absolutely sure. Even slightest shift of IF or LO freq which is unexpected for VNA math, may lead to significant errors.

As I already mentioned,  I took that out before posting the binary image.  It was just a bit of test code.   I left it in the first post output,  so it made it clear that the synth was locking on second call to set_freq after wait_for_lock function failed.

I agree with your assessment that the layout could be improved, but it works fine.  I suspect there are some via-in-pads for some of those caps, so grounds may be closer than they look.  C9 should only bypass the chip (and be moved closer) and another separate cap  should be added for the ref osc.    Anyway,  it is close enough.  Obviously, it works great.

Still no lock errors.
Title: Re: NanoVNA Custom Software
Post by: ogden on September 30, 2019, 08:20:25 am
I suspect there are some via-in-pads for some of those caps, so grounds may be closer than they look.
Very unlikely, unless those vias under caps are epoxy-filled. I bet they are not because $$$. Via-in-pad is bad idea on cheap PCB, unless used for thermal pads of big components (TO-252, D-PAK). Otherwise you may get tombstone or open joint (pic below).

[edit] Briefly looked into source code. Seems like both, PLL-A and PLL-B used for VNA functions. It means that MCLK is derived from either one. Well, well, well...  VCO tuning, PLL locking takes time. During that time clock output is either disabled or whatever VCO is doing at the moment - sweeping or just wandering around. It does happen to MCLK as well!! That in result can and will upset audio codec and USB operation, cause various artefacts of sample or USB data corruption. During operation you shall never re-tune VCO+PLL that feeds either audio or serial interface (USB, Ethernet). Possible fix: run si5351 and MCU from 24MHz XO and use si5351 exclusively and only for VNA frequency generation.


(https://screamingcircuits.typepad.com/photos/uncategorized/2008/02/15/led_viainpad.jpg)
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 30, 2019, 03:49:58 pm
I'm attaching an update to the firmware image I posted last night with the pll lock check.   I've added a command to change the number of loops in the wait_for_lock function before it returns lock status to the main loop.  If the lock fails after reading the si5351 status register n times, it will will call the set_freq() function again until lock.
usage:  lock_wait n,  where n=99 by default.

While running a trace from 50kHz to 1500MHz,  I see no errors in the USB serial console.  If I set lock_wait to a value of 25,  still no errors.   

Quote
ch> lock_wait 20

ch> freq: 50000 not locking
freq: 300039984 not locking
freq: 50000 not locking
freq: 50000 not locking
freq: 300039984 not locking
freq: 300039984 not locking
freq: 50000 not locking
freq: 300039984 not locking
freq: 50000 not locking
freq: 300039984 not locking
freq: 900019984 not locking
freq: 50000 not locking
freq: 300039984 not locking
freq: 50000 not locking


Quote
ch> lock_wait 10

ch> freq: 50000 not locking
freq: 108044000 not locking
freq: 153041504 not locking
freq: 306033008 not locking
freq: 450025008 not locking
freq: 900000016 not locking
freq: 50000 not locking
freq: 108044000 not locking
freq: 153041504 not locking
freq: 306033008 not locking
freq: 450025008 not locking
freq: 900000016 not locking
freq: 50000 not locking
freq: 108044000 not locking
freq: 153041504 not locking
freq: 306033008 not locking
freq: 450025008 not locking


see the post above for more info on what the code looks like:
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2715592/#msg2715592 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2715592/#msg2715592)
Title: Re: NanoVNA Custom Software
Post by: ogden on September 30, 2019, 04:45:17 pm
freq: 50000 not locking
freq: 108044000 not locking
freq: 153041504 not locking
freq: 306033008 not locking
freq: 450025008 not locking
freq: 900000016 not locking

Those frequencies makes sense because they are at the beginning of each (VCO) range:
 * 1~100MHz fixed PLL 900MHz, fractional divider
 * 100~150MHz fractional PLL 600-900MHz, fixed divider 6
 * 150~300MHz fractional PLL 600-900MHz, fixed divider 4
Then there are two transitions of harmonics mode, 450MHz and 900MHz.
BTW 50KHz-100MHz is done using fixed PLL config, no need to test that.

BTW due to your PLL lock polling, code following comment "// Set PLL twice on changing from band ___" is superflous.
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 30, 2019, 06:24:50 pm
Quote
Those frequencies makes sense because they are at the beginning of each (VCO) range:

I noticed that.  I think the reason the current firmware in the repository works good is because there is a "delay" parameter returned from the set_frequency() function.  The delay is incremented by 10 on vco band changes.  That delay value determines the number of adc samples to skip over.   So on a band change,  it skips over samples that might otherwise be glitchy due to pll unlock.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 30, 2019, 06:41:40 pm
I tested si5351 for sweep generator. With no PLL change it allows to change frequency very fast and with no breaks. But when you change PLL and make PLL reset, the output will be disabled for a short period of time. For about 1 us or something like that (don't remember exactly). It prevents to use si5351 for continuous sweep above 150 MHz.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 30, 2019, 06:49:50 pm
I think the reason the current firmware in the repository works good is because there is a "delay" parameter returned from the set_frequency() function.  The delay is incremented by 10 on vco band changes.

yes, I think this approach is more stable than continuous check for pll lock. Because pll reset requires fixed time in average, so proper delay will works good. But continuous read of status may lead to si5351 hung up, especially if you're I2C at high speed 400 kHz.

I have such issue with si5351. If you're using overclocked I2C for communication at extreme high speed, sometimes it may leads to hung up. After that si5351 is responsive for I2C requests, but it's output is stuck and cannot be changed with any register write. After that you can fix it with power off and power on.
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 30, 2019, 07:08:07 pm
One last attachment for now.   The zip has a binary image and the changes I made to the source from  https://github.com/ttrftech/NanoVNA   (edy555 commit 30d33571fa3929ff697bf410d3b7f25145cc6e45)

I added another command 'adc_samples' and got rid of the delay+10 in returned on vco changes because of the pll lock polling.   adc_samples N,  where N is a value between 3 and 255.  This is the value that the set_frequency() function will return.  Instead of I/Q skipping samples,  it now averages them.  It looks like averaging samples has a good effect on the measurement range for frequencies below 100 MHz.   Of course, the higher N,  the longer it takes to sweep.

Anyway,  hope this gives someone else something to mess around with.   I'm going to get back to work on the sdr project now.
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 30, 2019, 08:07:14 pm
I think the reason the current firmware in the repository works good is because there is a "delay" parameter returned from the set_frequency() function.  The delay is incremented by 10 on vco band changes.

yes, I think this approach is more stable than continuous check for pll lock. Because pll reset requires fixed time in average, so proper delay will works good. But continuous read of status may lead to si5351 hung up, especially if you're I2C at high speed 400 kHz.

I have such issue with si5351. If you're using overclocked I2C for communication at extreme high speed, sometimes it may leads to hung up. After that si5351 is responsive for I2C requests, but it's output is stuck and cannot be changed with any register write. After that you can fix it with power off and power on.

It does seem to work fine just skipping some adc samples, so no big deal if your device looks like it is working ok.  Your argument about I2C doesn't make much sense to me.  The device is constantly using I2C @ 400kHz for programming the tlvxxx and si5351 part on every sweep.  I know I mentioned before, but when you are dealing with PLL that has the ability to check lock  (pretty much all of them),  then it is a good idea to take advantage of that in general.  In this case, it would be good to at least have warnings on unlock in my opinion.  If you don't check, how will you know? 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on September 30, 2019, 08:14:59 pm
If you don't check, how will you know?

just use delay for some period of time which is needed for stable pll lock :)

You're needs to make this delay when you send PLL reset command to si5351.
Title: Re: NanoVNA Custom Software
Post by: radioactive on September 30, 2019, 09:10:43 pm
If you don't check, how will you know?

just use delay for some period of time which is needed for stable pll lock :)

You're needs to make this delay when you send PLL reset command to si5351.

Might work almost all the time.   Wonder what could be causing these issues:  https://github.com/ttrftech/NanoVNA/issues/59
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 01, 2019, 06:05:24 pm
Wonder what could be causing these issues

I think he forgot to perform calibration after firmware update
Title: Re: NanoVNA Custom Software
Post by: bob91343 on October 02, 2019, 07:47:04 pm
I don't see a link to the video.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 10, 2019, 12:25:14 am
After having the newer firmware lockup on me a few times, I shelved the Nano.   I looked a few days ago and saw there was a newer release but I have not tried it.   I did see that they had uncommented the new command allowing for a variable number of samples.   
Title: Re: NanoVNA Custom Software
Post by: Mike G on October 10, 2019, 05:13:03 am
Hi Joe, just in case it might help, the latest, 7th October 2019, version of edy555's firmware seems to have cured the "white screen" when performing segmented scanning, I am not sure if this is connected to your problem?  Hope you don't hang up your nano for good as I have learnt a lot from your you-tube videos and the posts on this forum, although I admit a fair bit of your later work is above my head. Regards Mike
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 10, 2019, 12:05:46 pm
Hi Joe, just in case it might help, the latest, 7th October 2019, version of edy555's firmware seems to have cured the "white screen" when performing segmented scanning, I am not sure if this is connected to your problem?  Hope you don't hang up your nano for good as I have learnt a lot from your you-tube videos and the posts on this forum, although I admit a fair bit of your later work is above my head. Regards Mike
Thanks and I'm glad you found them useful.     

With the latest firmware, the screen doesn't go white like it used to but the Nano locks up.  It will not accept USB commands and requires a power cycle to recover.   

I had put together a longer stage for my TDR experiments and was running some fairly long tests and the Nano would lockup while running them.  This was with the last stock firmware from edy555 that I downloaded.  I did not reload the later hugen firmware as it was having other problems sending corrupt data.   

With them cranking out what appears to be untested versions so fast, it's not worth manually checking them all looking for stable version.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 10, 2019, 12:39:40 pm
With the latest firmware, the screen doesn't go white like it used to but the Nano locks up.  It will not accept USB commands and requires a power cycle to recover.   

Try this version (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2739374/#msg2739374)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 10, 2019, 05:08:31 pm
With the latest firmware, the screen doesn't go white like it used to but the Nano locks up.  It will not accept USB commands and requires a power cycle to recover.   

Try this version
I would have no way of knowing what this version is.  That's been part of the problem I see with the edy555 and hugen79 code, they do not document. As a user,  I can waste time running a diff and try to sort of what they changed and why.  A bit odd they don't keep a detailed log of the changes.

It looks like hugen79 also released something new in the last couple of days.  Like the latest edy555 release, they also enabled the scan command. 

It may be worth spending some time putting together some sort of automated regression tests for the Nano. 
Title: Re: NanoVNA Custom Software
Post by: ogden on October 10, 2019, 06:57:16 pm
I had put together a longer stage for my TDR experiments and was running some fairly long tests

While doing that did you remember what you say (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2691423/#msg2691423) some time ago? Just saying.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 10, 2019, 07:11:40 pm
I had put together a longer stage for my TDR experiments and was running some fairly long tests

While doing that did you remember what you say (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2691423/#msg2691423) some time ago? Just saying.

Sure I remember.  What about it?
Title: Re: NanoVNA Custom Software
Post by: ogden on October 10, 2019, 10:06:19 pm
I had put together a longer stage for my TDR experiments and was running some fairly long tests
While doing that did you remember what you say (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2691423/#msg2691423) some time ago? Just saying.
Sure I remember.  What about it?
Well...  Rebuild of delay contraption removed most of obstacles you mentioned back then. So @rhb could get info he looked for.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 10, 2019, 10:59:35 pm
Try this version
I would have no way of knowing what this version is.  That's been part of the problem I see with the edy555 and hugen79 code

This is the most fresh version which includes edy555 changes + hugen79 improvements + improved stability + scanraw command. It also excludes these changes which didn't passed QA due to regression.

scanraw command allows to read raw S11 or S21 (with no calibration apply) and averaging. You can use it to apply your own calibration.

For example:

Code: [Select]
scanraw 0 1000000 1000000 900 10
will read 900 points from 1 MHz to 900 MHz with 1 MHz step and averaging by 10 points for CH0.

You're needs to apply your own calibration to the result.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 11, 2019, 12:56:27 am
Try this version
I would have no way of knowing what this version is.  That's been part of the problem I see with the edy555 and hugen79 code

This is the most fresh version which includes edy555 changes + hugen79 improvements + improved stability + scanraw command. It also excludes these changes which didn't passed QA due to regression.

scanraw command allows to read raw S11 or S21 (with no calibration apply) and averaging. You can use it to apply your own calibration.

For example:

Code: [Select]
scanraw 0 1000000 1000000 900 10
will read 900 points from 1 MHz to 900 MHz with 1 MHz step and averaging by 10 points for CH0.

You're needs to apply your own calibration to the result.

Please fill me in on this regression testing you mention.     

Do you have a link to where the source is being stored for the image you uploaded? 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 11, 2019, 02:54:00 am
Do you have a link to where the source is being stored for the image you uploaded?

https://github.com/qrp73/NanoVNA
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 11, 2019, 11:56:16 am
Do you have a link to where the source is being stored for the image you uploaded?

https://github.com/qrp73/NanoVNA
Thanks for the link.

In order to evaluate all of these various versions efficiently, I would really need to consider setting up some sort auto or semi-auto regression test.   I am very interesting in knowing more about the regression testing you mentioned.   Mainly, what tests you perform?  Is it possible to use your test scripts on other flavors?   What hardware you require?  Do you create any sort of reports that could be posted?   

If your regression tests could be shared with the other developers, that may be helpful. 

Currently I have no way of running a decent test outside of just manually going through the paces.   This takes a fair amount of time.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 11, 2019, 09:56:22 pm
Got nanovna by shopping spree accident, black clone. Why it's not "original" - don't ask. Perhaps for greater good. Port2 mixer IC (sa612) was dead, reflection mixer seems to be "factory-repaired" as well. After quick fix it seems to perform well for a price.

Supplied cables and short are surprisingly good. Open is good by definition because it's joke at those frequencies anyway. Terminator/load is utter piece of crap. Every owner of nanovna shall consider getting quality 50ohm terminator (https://www.minicircuits.com/WebStore/dashboard.html?model=ANNE-50L%2B). Those who can afford some more may get 2nd terminator and 10dB, 20dB, 40dB 6dB attenuators.

I did calibrate repaired and fully functioning nanovna using supplied accessories + mini-circuits terminator. Measured S11 of mini-circuits terminator, then supplied terminator. Files attached.
Title: Re: NanoVNA Custom Software
Post by: radioactive on October 12, 2019, 04:51:16 am
Terminator/load is utter piece of crap. Every owner of nanovna shall consider getting quality 50ohm terminator (https://www.minicircuits.com/WebStore/dashboard.html?model=ANNE-50L%2B).

I guess results may vary.  The 50-ohm terminator I was supplied results in S11 measurement range very close to your mini-circuits terminator measurements.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 12, 2019, 07:27:47 am
Terminator/load is utter piece of crap. Every owner of nanovna shall consider getting quality 50ohm terminator (https://www.minicircuits.com/WebStore/dashboard.html?model=ANNE-50L%2B).

I guess results may vary.  The 50-ohm terminator I was supplied results in S11 measurement range very close to your mini-circuits terminator measurements.

Be careful before you jump with conclusions. You can't judge about quality of your terminator unless you have one reference to calibrate & compare with. With just one terminator you don't know. You may see amazing return loss picture like attached S11 and do not even know that it is actually worst 50ohm'ish crap ever:
Title: Re: NanoVNA Custom Software
Post by: radioactive on October 12, 2019, 07:57:38 am
Terminator/load is utter piece of crap. Every owner of nanovna shall consider getting quality 50ohm terminator (https://www.minicircuits.com/WebStore/dashboard.html?model=ANNE-50L%2B).

I guess results may vary.  The 50-ohm terminator I was supplied results in S11 measurement range very close to your mini-circuits terminator measurements.

Be careful before you jump with conclusions. You can't judge about quality of your terminator unless you have one reference to calibrate & compare with. With just one terminator you don't know. You may see amazing return loss picture like attached S11 and do not even know that it is actually worst 50ohm'ish crap ever:

The supplied terminator I received with nanoVNA also looks very close to a Weinschel 50 ohm terminator of mine.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 12, 2019, 01:12:12 pm
Terminator/load is utter piece of crap. Every owner of nanovna shall consider getting quality 50ohm terminator.

Don't rush to draw conclusions. There is big probability, that your minicircuit is much worse. At least on 1-900 MHz frequency range. I'm pretty sure about that. Because this is not cal-kit load. This is usual 50R terminator. :)

At least my NanoVNA cal-kit L load is very good. It has 49.95 Ohm and works much better than all Chinese terminators that I have.

Your minicircuit may be very good above 6 GHz but it cannot be good within entire 12 GHz range, so there is very high probability that it is not so good below 1 GHz :)

First, try to measure your minicircuit load terminator with precise DMM. And compare it with cal-kit L load.

The second issue, is that all cal-kit loads needs to have the same delay. Do you have O and S loads for your minicircuit? I guess not. And it means that you cannot use it with O and S loads from NanoVNA kit, because they have different delay. And according to picture, significantly different. I think the difference is about 20-30 picoseconds. Such delay is too high for NanoVNA.


Regarding to your request for screenshot, here it is:

CH0 and CH1 are open:
[attachimg=1]

CH0 and CH1 both connected with 50R load:
[attachimg=2]
Title: Re: NanoVNA Custom Software
Post by: ogden on October 12, 2019, 03:21:19 pm
Your minicircuit may be very good above 6 GHz but it cannot be good within entire 12 GHz range, so there is very high probability that it is not so good below 1 GHz
No. You are wrong. https://ww2.minicircuits.com/pages/s-params/ANNE-50+_GRAPHS.pdf (https://ww2.minicircuits.com/pages/s-params/ANNE-50+_GRAPHS.pdf)

Quote
The second issue, is that all cal-kit loads needs to have the same delay. Do you have O and S loads for your minicircuit?
Purist :D You better check presence of pin in your Open "standard" first.

Quote
And according to picture, significantly different. I think the difference is about 20-30 picoseconds.
Where did you get 20-30 picoseconds from? :-//

[edit] Thank you for screens! Speaking of insanely good return loss indication - again we see that you can't estimate precision of the ruler using same exact ruler
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 13, 2019, 02:42:00 am
I have started working on my own regression test.   

I had thought about using the SA, tied to the PC to aid with some of the tests but decided to keep the required hardware to a minimum for now and just do what I can with a thru installed.   

It needs more work but can at least catch the basic problems I have been seeing with some of the firmware with the added bonus, I don't have do anything outside of pressing go.  Considering it takes a few hours to run through all the tests so far, this is a big time saver.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 13, 2019, 04:38:48 pm
With the latest firmware, the screen doesn't go white like it used to but the Nano locks up.  It will not accept USB commands and requires a power cycle to recover.   

Try this version

I was planning to use this version while I work through my regression tests.   I have started adding a report generator and increasing some of the tests I run.   I will report the problems as I find them.  If you want to try to correct them as I find problems, I would be willing to work with you to run your changes through my regression tests. 
 

Problem 1
Setting the Center frequency to 750MHz, then set the Span to 1500MHz.   Request the Frequency.   The firmware returns only 100 data points rather than 101.  I would expect the Nano to always send 101 data points.    This problem is reproducible.   

Problem 2
Setting the Start frequency to 0MHz, the Stop to 1MHz.   Request the Frequency.   The firmware returns a starting frequency of 10KHz rather than the expected 50KHz.  The number of data points is correct.   I would expect the Nano to limit the lower frequency to 50KHz, or there should be a document explaining that the lower limit is now 10KHz.   This problem is reproducible.   

Problem 3
Screen still leaving random artifacts from previous scan when using the Smith Chart.  This problem is reproducible and appeared in the firmware that was supplied with my Nano.   I have yet to see firmware that does not have this problem.

Problem 4
After programming the new firmware into the Nano and running a calibration, the calibration appeared corrupt.  An open was on the left side of the screen and a short was on the right.  Applying any load would be unstable when looking at the display.   The frequency range was set to 0.05 to 900MHz prior to calibration.  A reset was ran prior to calibration.    Attempting to repeat the calibration corrected the problem.  I have not attempted to repeat this condition. 

Problem 5
Programming a start of 50KHz and an stop frequency of 1500MHz.   Request the Frequency.   The firmware returns the correct frequency for the first data point.   Looking at higher frequencies, there is an error between various firmware.  For example, some will report 1500 for the last data point where others report 1499.99995.   For a given version of firmware, it will return predictable values.    This problem is easy to reproduce. 
Title: Re: NanoVNA Custom Software
Post by: ogden on October 13, 2019, 05:34:52 pm
View at the terminators from another angle. Attached R+jX plots for minicircuits anne-50+ (18GHz) terminator, original terminator and original terminator with 40dB 18GHz hi-end attenuator attached. That atten BTW is worth more than nanovna. It is clear that supplied terminator have "parasits" inside. To be clear - that minicircuits terminator is more than good as minivna cal standard. Any claim that it's performance at minivna frequencies is poor - utter BS.

[edit] note that "original terminator" means: originally supplied with nanovna *clone*, black version
Title: Re: NanoVNA Custom Software
Post by: erikka on October 13, 2019, 05:40:23 pm
The nanoVNA internal calibration assumes a 50fF C0 parasitic for the load. Would that match your measurement?
Title: Re: NanoVNA Custom Software
Post by: ogden on October 13, 2019, 07:09:10 pm
The nanoVNA internal calibration assumes a 50fF C0 parasitic for the load. Would that match your measurement?
For "good terminator" - kind of. It's capacitance and inductance indication is noisy as it should be measuring return loss noise floor, yet averages around zero. Not so good terminator "averaged" around 1nH, attach.
Title: Re: NanoVNA Custom Software
Post by: radioactive on October 13, 2019, 09:06:01 pm
Anyone else think that the need for better than 40dB for an S11 measurement might be a post for the Metrology thread?   The description could be changed from "This is where the Voltnuts hang out."   to  "This is where the Voltnuts and S11nuts hang out".   
Title: Re: NanoVNA Custom Software
Post by: hendorog on October 13, 2019, 09:20:59 pm
The nanoVNA internal calibration assumes a 50fF C0 parasitic for the load. Would that match your measurement?

That's not correct, unless something has changed recently. The 50fF is for the open. The Load and Short standards are assumed perfect.



Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 14, 2019, 02:15:09 am
I have added a few more findings to my list as I continue to expand my test scripts:
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2736580/#msg2736580 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2736580/#msg2736580)

I decided to try and build the last edy555 code from 10112019 and run the regression test on it.    This was right from Git.   

build/ch.elf section `.data' will not fit in region `flash0'
none-eabi/bin/ld.exe: region `flash0' overflowed by 296 bytes

Odd anyone would commit something that won't even build.    It's the first time I have ran into a problem like this with the Nano firmware.   

I tried a version from hugen that I had downloaded on 10102019.  While this version builds just fine, it will send corrupt data at other switch points, not just 900MHz like I was seeing with the older version.     

It appears that most of the firmware I have looked at will send back a frequency of 1500.000000 rather than being off.   I would expect if I program 1500, I would get 1500, not 1499.99995.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 09:45:42 am
Attached R+jX plots for minicircuits anne-50+ (18GHz) terminator, original terminator and original terminator with 40dB 18GHz hi-end attenuator attached

your comparison is invalid, just because you're trying to compare different loads with different electronic delay and didn't apply correction for this electronic delay difference.

Such comparison just doesn't make sense, because you're trying to compare measurement taken with significantly different conditions.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 09:52:11 am
The nanoVNA internal calibration assumes a 50fF C0 parasitic for the load. Would that match your measurement?

No, the NanoVNA error-adapter assumes 50 fF for open load and also it assumes zero electronic delay (like ideal loads).

Supplied cal-kit is close to that assumption. Some guys reported that supplied open load has 22 fF. That's the only complaint I've heard about cal-kit supplied with NanoVNA.

But ogen trying to compare it with terminator which has much longer visual size. I think it's delay is about 20-30 picoseconds higher than NanoVNA cal-kit load.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 15, 2019, 10:18:26 am
your comparison is invalid, just because you're trying to compare different loads with different electronic delay and didn't apply correction for this electronic delay difference.
Comparison was to demonstrate exactly that - "original terminator" have (longer) parasitic transmission line inside, yet you say that I shall compensate for it and basically void whole idea of demonstration  :palm:

But ogen trying to compare it with terminator which has much longer visual size. I think it's delay is about 20-30 picoseconds higher than NanoVNA cal-kit load.
How many times I shall repeat that I do not compare hugens calkit because I do not have one! I just demonstrate that clones have crap calkits, especially terminators, reference planes of short and load for my supplied cal kit are kinda far from each other.

[edit] Geez, you guys seems are here only to have argument no matter what  :-//
[edit1] Attached R+jX minicircuits terminator in the end of 10cm quality semirigid. As you see impedance does not wander off as in case of crap terminator. Explain that.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 10:35:58 am
Comparison was to demonstrate exactly that - "original terminator" have (longer) parasitic transmission line inside, yet you say that I shall compensate for it and basically void whole idea of demonstration  :palm:

you cannot make conclusions from your measurements, because your NanoVNA was calibrated with incompatible loads. It means that your NanoVNA calibration is invalid and you cannot believe to it's measurements.

Your cal-lit L load can be really bad, but you're needs to use proper calibration in order to check that. Proper calibration means that all your cal-kit loads - L, O and S should be exactly the same physical length. O load should have 50 fF. If you you can satisfy these conditions for calibration, then you can believe measurements results.


I can help you to determine if your load is really bad and what happens exactly.
In order to do that, please provide me with S1P files taken in the following way:

1) open CAL menu and press RESET
2) open CLIBRATE menu and perform calibration with NanoVNA cal-kit (with using NanoVNA L load). Press OPEN/SHORT/LOAD just once. If you press it twice, go to step 1 (reset cal and repeat).
3) Check if calibration success (check that O, S, L loads shows proper point on Smith chart)
4) Measure S1P file for NanoVNA cal-kit L load
5) Measure S1P file for Minicircuits terminator
6) Provide me with these two S1P files

Provide me with these two S1P files and I will check what is going on with your loads.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 10:42:33 am
Attached R+jX

R+jX measurement is very sensitive to electronic delay. Especially on high frequency. Before R+jX measurements, you're needs to setup proper electronic delay in the menu DISPLAY => SCALE => ELECTRICAL DELAY
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 11:19:07 am
Problem 1
Setting the Center frequency to 750MHz, then set the Span to 1500MHz.   Request the Frequency.   The firmware returns only 100 data points rather than 101.  I would expect the Nano to always send 101 data points.    This problem is reproducible.   

fixed

Problem 2
Setting the Start frequency to 0MHz, the Stop to 1MHz.   Request the Frequency.   The firmware returns a starting frequency of 10KHz rather than the expected 50KHz.  The number of data points is correct.   I would expect the Nano to limit the lower frequency to 50KHz, or there should be a document explaining that the lower limit is now 10KHz.   This problem is reproducible.   

this is not a problem. This is feature of this firmware. It allows to use 10 kHz - 1500 MHz frequency range :)

Problem 3
Screen still leaving random artifacts from previous scan when using the Smith Chart.  This problem is reproducible and appeared in the firmware that was supplied with my Nano.   I have yet to see firmware that does not have this problem.

this is known issue of all NanoVNA firmware versions, but there is still no fix for that.

Problem 4
After programming the new firmware into the Nano and running a calibration, the calibration appeared corrupt.  An open was on the left side of the screen and a short was on the right.  Applying any load would be unstable when looking at the display.   The frequency range was set to 0.05 to 900MHz prior to calibration.  A reset was ran prior to calibration.    Attempting to repeat the calibration corrected the problem.  I have not attempted to repeat this condition. 

Different firmware may use incompatible calibration settings. In order to avoid such issues, it is recommended to perform clear of configuration and perform full calibration after firmware update. You can clear configuration with the following console command:
Code: [Select]
clearconfig
Problem 5
Programming a start of 50KHz and an stop frequency of 1500MHz.   Request the Frequency.   The firmware returns the correct frequency for the first data point.   Looking at higher frequencies, there is an error between various firmware.  For example, some will report 1500 for the last data point where others report 1499.99995.   For a given version of firmware, it will return predictable values.    This problem is easy to reproduce.

fixed

Try this version (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2739418/#msg2739418), it solves your issues, allows to enter negative electronic delay and also improves precision for data transfer from NanoVNA to PC.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 15, 2019, 11:30:46 am
R+jX measurement is very sensitive to electronic delay. Especially on high frequency. Before R+jX measurements, you're needs to setup proper electronic delay in the menu DISPLAY => SCALE => ELECTRICAL DELAY
Again you do not get what I am actually showing you and/or you do not understand what causes impedance increase @high frequencies in case of crap load. I just give up. Have a nice day. Meanwhile think why hi-end (Keysight, R&S, Anritsu) cal kits have length specifications only for open and shorts, never for broadband loads.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 15, 2019, 11:42:08 am

Try this version, it solves your issues, allows to enter negative electronic delay and also improves precision for data transfer from NanoVNA to PC.

There's no link. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 11:43:05 am
There's no link.

Here:
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 15, 2019, 11:48:11 am
Just downloaded from your GH area and tried to build but once again get errors that it will not fit.  I assume that the image was not built from what is uploaded.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 11:48:56 am
Just downloaded from your GH area and tried to build but once again get errors that it will not fit.  I assume that the image was not built from what is uploaded.

there is needs fix for ChibiOS, and it depends on environment. The image has version stamp, it is linked to github version.

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 15, 2019, 12:18:03 pm
With the image you linked, it does appear to correct the rounding, span  and range problems.  Nice job.   I have updated my regression tests to look for the 10KHz lower limit. 

I also want to mention that I ran that last image for several hours and not once did I see the screen go white, or had the firmware lockup where it required a power cycle to reset.   

I am building under Windows 10, with the same tools I previously listed.  What will need to change in the ChiOS to support this tool chain?

There is one thing I notice with your code that seems unique that I find strange.  I run a speed test where I make requests to the Nano and measure the response times.  I start with the Frequencies command, sending it several times.   I then switch to data 0.  At the time I make this switch, with your code I will see the response time increase (about double) for the very first read.  It then settles down.    It also appears to be quicker then some of the older images I was trying to use.   This delay does appear to be repeatable. 

The reason I am asking about this delay is that when I was looking at the PC software they provided for the Nano, they always read the frequency and both data sets.   I suspect as they scan through the commands, this delay would effect the overall speed.  I have not tried to run a cycle test like this yet but may add it to my scripts.

Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 12:37:02 pm
There is one thing I notice with your code that seems unique that I find strange.  I run a speed test where I make requests to the Nano and measure the response times.  I start with the Frequencies command, sending it several times.   I then switch to data 0.  At the time I make this switch, with your code I will see the response time increase (about double) for the very first read.

data command needs to wait until NanoVNA will complete sweep. You can monitor sweep state by LED state on the NanoVNA board. When sweep is active, the LED is off, at this moment data command will needs to wait.

Since NanoVNA performs sweep in the loop. The delay of data command will depends on current sweep state. Because data command needs to wait when sweep will be completed.


If you don't change start/stop/center/span frequencies, there is no need to repeat "frequencies" command. You can exectute "frequencies" command just once after start/stop/center/span frequency change. After that you can execute just data command in a loop.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 15, 2019, 12:44:52 pm
I tried installing your couple of files.  I placed cstartup.s in the compilers/IAR directory and the hal_i2s_lld.c in both SPIV1&2.   It still errors out. 

On the plus side, your latest version just finished running through my simple regression tests and had no errors.   Of course I am not suggesting the code is bug free, just that it passed my simple test.  Good job.

My software waits for each command to have a response before sending the next or it times out.   I had ran some tests early on where I would stack them up, but it seems unpredictable if the Nano would keep up or not.   Basically, in some cases where I would say, make a parameter change, I could send more than one command while waiting for the Nano to respond.   I could not do this with the data commands.    At the time, it would not crash the Nano but it appeared to just not receive the commands.



Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 12:51:55 pm
I tried installing your couple of files.  I placed cstartup.s in the compilers/IAR directory and the hal_i2s_lld.c in both SPIV1&2.   It still errors out.

hal_i2s_lld.c needs to be replaced just in the folder ChibiOS\os\hal\ports\STM32\LLD\SPIv2\hal_i2s_lld.c

But actually, these are minor changes, and they should not affect build.

The error depends on tool chain
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 15, 2019, 12:54:44 pm
If you don't change start/stop/center/span frequencies, there is no need to repeat "frequencies" command. You can exectute "frequencies" command just once after start/stop/center/span frequency change. After that you can execute just data command in a loop.

Again, this is a regression test, not normal operation.  I am collecting metrics on the firmware.  One of the metrics is the response time.   When I run this test, I will send the commands over and over (50 times) and then calculate my standard deviation and mean from that.     I run these various odd tests to get some insight as to how the firmware behaves. 

It's similar to setting the center to 750MHz and setting the span to 1500, pushing the low end to 0.  A fringe case but none the less showed some unexpected behavior.   Not something I would normally do if I were just using the Nano.   

Some of the tests seem to cause the white screen in certain firmware versions.   One of the main reasons I am creating these tests is to try and find a stable version of firmware.   

I had asked you about your regression tests that you mention but you chose not to discuss for what ever reason.  I am still open to discussing and plan to continue to add to the complexity of my scripts.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 15, 2019, 12:56:07 pm
I tried installing your couple of files.  I placed cstartup.s in the compilers/IAR directory and the hal_i2s_lld.c in both SPIV1&2.   It still errors out.

hal_i2s_lld.c needs to be replaced just in the folder ChibiOS\os\hal\ports\STM32\LLD\SPIv2\hal_i2s_lld.c

But actually, these are minor changes, and they should not affect build.

The error depends on tool chain

/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.7.1/.content/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: region `flash0' overflowed by 584 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [ChibiOS/os/common/startup/ARMCMx/compilers/GCC/rules.mk:243: build/ch.elf] Error 1

Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 12:58:01 pm
I could send more than one command while waiting for the Nano to respond.   I could not do this with the data commands.    At the time, it would not crash the Nano but it appeared to just not receive the commands.

You can send several commands, but it depends on buffer size in the NanoVNA. If you flooding it with commands, it will be lost.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 01:01:16 pm
/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.7.1/.content/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: region `flash0' overflowed by 584 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [ChibiOS/os/common/startup/ARMCMx/compilers/GCC/rules.mk:243: build/ch.elf] Error 1

it seems that the code doesn't fit into STM32F072CB. First check that your tool chain uses 128 kB flash for this chip. The second you can play with optimization options. If it doesn't help, you can remove some commands. For example scan command duplicating sweep functionality, so you can comment it with #if 0 directive. Also remove it from the command list array.

This is known issue. The controller STM32F072CB has too small flash memory - just 128 kB. And you can find that other people also fighting with this limitation for NanoVNA.

This is why NanoVNA V2 uses more powerful controller, it has more memory, so it can handle more things :)
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 15, 2019, 01:16:40 pm
I had asked you about your regression tests that you mention but you chose not to discuss for what ever reason.  I am still open to discussing and plan to continue to add to the complexity of my scripts.

I don't have automated regression tests. I do it manually. Just compare what is changed in the code and then trying to test if these changes works properly and there is no regression. That's what I mean when I told you about regression tests :)
Title: Re: NanoVNA Custom Software
Post by: ogden on October 15, 2019, 01:21:50 pm
You both are doing great job to improve nanovna, yet chat about build and source code specifics better be done using private messages. No offense, just saying.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 15, 2019, 06:17:49 pm
/roaming/xpacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.7.1/.content/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: region `flash0' overflowed by 584 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [ChibiOS/os/common/startup/ARMCMx/compilers/GCC/rules.mk:243: build/ch.elf] Error 1

it seems that the code doesn't fit into STM32F072CB. First check that your tool chain uses 128 kB flash for this chip. The second you can play with optimization options. If it doesn't help, you can remove some commands. For example scan command duplicating sweep functionality, so you can comment it with #if 0 directive. Also remove it from the command list array.

This is known issue. The controller STM32F072CB has too small flash memory - just 128 kB. And you can find that other people also fighting with this limitation for NanoVNA.

This is why NanoVNA V2 uses more powerful controller, it has more memory, so it can handle more things :)

Yes, it seems to be setup for 128K.     Are you building with same files you have archived?     Comparing the LD file with others, any idea why flash7 is set to 32K?    Do they really need this much space for calibrations?   

I can disable your new commands and of course it will fit.   Another option is to enable the size optimization.   Setting this will easily allow it to build what you have and fit.   I suspect the performance hit is too much and why they are not using it.   I'll try running it built this way through the regression tests.

Assuming that you are building with all the files you have uploaded, what version of the tools are using?   Hard to believe that compiler would have changed this much but maybe.  It may explain why I wasn't able to build the other code I had downloaded. 


As for stacking commands (sending more than one without waiting for a response), the way I have my software currently structured, if I am sending a command that will change the frequency settings, I will go ahead and send the frequencies command with it.   In this case, I know all the set commands (start, stop, span....) are very fast and have virtually no payload.   So far this has not caused a problem.   It's the only case though where I continue to stack them.   

On the regression test,  this makes more sense.  I've started adding an automated report generation to document the testing so I can easily compare the results later on. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 15, 2019, 11:02:01 pm
While enabling the optimizer does allow me to build with all of the commands you have selected and fit, once loaded into the Nano, it will not run.  Some text is displayed on the screen but the Smith Chart for example does not get displayed.   

I'm interested in seeing what your tool chain is showing for usages. 

Removing your last commands with the optimizer set to the defaults allows it to fit and also seems to pass my basic regression tests.   An odd side effect is that I no longer see the delay when the commands are switched like I show in the earlier plots. 

One of the test cases I added was to set the start frequency to 1500 and the stop to 0.   My old analog VNA has no way to scan backwards.  Looking at my old HP3589A, it behaves similar to the Nano which basically reports it will scan from 10KHz to 10KHz with 101 samples.     With my Signal Hound, when trying to set the stop lower than the stop, it will coerce the it to the maximum value.   Any thought on if you will change how this works?   
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 16, 2019, 04:47:01 am
An odd side effect is that I no longer see the delay when the commands are switched like I show in the earlier plots. 

That's interesting. Is it better or worse compared to this hex file (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2739418/#msg2739418)?

One of the test cases I added was to set the start frequency to 1500 and the stop to 0.   My old analog VNA has no way to scan backwards.  Looking at my old HP3589A, it behaves similar to the Nano which basically reports it will scan from 10KHz to 10KHz with 101 samples.     With my Signal Hound, when trying to set the stop lower than the stop, it will coerce the it to the maximum value.   Any thought on if you will change how this works?

Do you mean something like sweep from start=100 MHz to stop=50 MHz? It is possible, but I'm not sure if it really needed.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 16, 2019, 07:55:25 am
What is actual bottleneck why PC (NanoVNA Saver) scan rate is much slower than on-board display? Nearly two times or so, even when PC software is running, thus primary and on-board display scans is not that important anymore? There even could be option to disable onboard display while USB software running (PC software command, screen_off/on). (NanoVNA-Q-2019-10-15-e427dbb, NanoVNA Saver 0.1.1) BTW how PC USB scan data is made? It is separate scan which is not displayed on nanovna display? If so - is it possible to just readout buffer of completed scan?
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 16, 2019, 08:05:21 am
how PC USB scan data is made? It is separate scan which is not displayed on nanovna display? If so - is it possible to just readout buffer of completed scan?

The device performs sweep and render in a loop. The PC can request the current data of the sweep through USB and NanoVNA will send the last sweep data to PC.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 16, 2019, 08:50:58 am
how PC USB scan data is made? It is separate scan which is not displayed on nanovna display? If so - is it possible to just readout buffer of completed scan?
The device performs sweep and render in a loop. The PC can request the current data of the sweep through USB and NanoVNA will send the last sweep data to PC.
That means that scan is not bottleneck. Excellent. USB have enough bandwidth, MCU have bandwidth as well - because it does update it's screen fast during PC software scan. It means PC SW update speed *can* be improved. Somebody just have to look at it because it is important while using average, especially knowing that it can be *twice* as fast.

Do you release hex and/or dfu releases as well? Please.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 16, 2019, 09:22:54 am
That means that scan is not bottleneck. Excellent. USB have enough bandwidth

that's not the case, it uses old USB peripherals which can work in USB FS mode and the speed is limited with small amount of buffer memory and MCU speed. But it is good enough for communication. I didn't measured the maximum performance, but think it is about 50-100 kB/s.

MCU have bandwidth as well - because it does update it's screen fast during PC software scan.
It means PC SW update speed *can* be improved. Somebody just have to look at it because it is important while using average, especially knowing that it can be *twice* as fast.

Do you release hex and/or dfu releases as well? Please.

MCU cannot communicate with PC during sweep, because it will affect measurement.

Communication speed really can be improved, but I'm not sure that this is really needed.

There are several ways to improve performance:
1) optimize communication from PC side (don't send extra requests, don't do long delays, etc)
2) use binary format communications, but it will break compatibility with existing software (NanoVNASharp, Saver, etc)

As for average, it is better to perform it on MCU side. For example you can use scanraw command from NanoVNA-Q firmware. It allows to setup average from 1x to 1000x and it will be performed on MCU side. But it returns raw gamma data with no correction (with no calibration apply, the same as you see with reset calibration), so you're needs to apply your own calibration.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 16, 2019, 09:56:45 am
That means that scan is not bottleneck. Excellent. USB have enough bandwidth
that's not the case, it uses old USB peripherals which can work in USB FS mode
Yes, I did mean exactly that - USB FS of stm32 which is running at 72MHz(?) have enough bandwidth for this application.

Quote
MCU cannot communicate with PC during sweep, because it will affect measurement.
Well, it does not need to show scan on it's display two times faster than PC is getting scan data as well. While connected to PC, display can be off. That would also fall into "will not affect measurement", if not then "waste less time" definitely.

Quote
For example you can use scanraw command from NanoVNA-Q firmware.
No. I can do many things but what i Want to do is - *use* nanovna, not modify or develop it. What I see - PC software is slow, slower than onboard firmware and I know that hardware is more than capable.
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 16, 2019, 01:32:04 pm
Hello Ogden,
there were some changes to the official firmware which necessitated a slowdown be put in to all data reads. As of firmware 0.2.0 and newer, and NanoVNA-Saver 0.1.2 and newer (but use 0.1.3, it's just out now), the new "scan" command is used. This disables the screen, runs a single sweep of the requested range, waits for it to complete, and then the application fetches the data.

I still think it feels slow, also compared to early experiments. But it's how I'm told by the maker of the firmware that I should request data via serial, and thus it's what I make the application do. I would be very happy if someone were to try to optimize the code on the NanoVNA ;-)
Title: Re: NanoVNA Custom Software
Post by: ogden on October 16, 2019, 03:49:49 pm
Thanx, tried 0.1.3 and do not see any improvements in areas that IMHO are actually important. Same weird behavior - nanovna makes two scans but on PC only one is displayed. That does not makes sense because cooms interface is CDC! As soon as nano is finished scan, it can PUSH out data. Application shall jus sit and wait for next scan data to come in. Firmware and software guys shall start to talk each other. Also seems like averaging did not work in 0.1.1 and still does not in 0.1.3. Noise peak-peak amplitude does not go down . Anybody else think so?
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 16, 2019, 04:08:13 pm
Hello Ogden,
I can confirm that averaging certainly does work. Whether it gives you the results you expect, or whether it works with your particular firmware I can't promise, of course :-) What firmware revision are you running?

On the "shall start to talk to each other": I certainly have had conversations with edy555 about the device and interaction with NanoVNA-Saver, and he has specified using this particularly interface, ie. using the "scan" command in newer firmware. What speed it goes at isn't something I can affect :-)
Title: Re: NanoVNA Custom Software
Post by: ogden on October 16, 2019, 04:25:27 pm
I can confirm that averaging certainly does work.

Firmware mentioned in this post:
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2739418/#msg2739418 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2739418/#msg2739418)

Tested using s11 noise floor which is most "noisy". Look at the picture. Those dips can't be there after 20x average. No way. Not to mention that picture does not look any different than single sweep w/o average. If you are further interested - let's go PM. I can give input as long as it does not take big chunk out of my spare time.
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 16, 2019, 05:22:15 pm
Whether those dips can be there or not depends on your calibration, I would say. If there were opposite peaks at the time of calibrating the NanoVNA itself, it would over-compensate on those particular frequencies, and consistently produce such dips.

Attached are two sweeps of 900-1500MHz (lots of noise!) - one without and one with 20x averaging. I would say it looks like it's working.

[attachimg=1]
[attachimg=2]

The levels you're looking at when looking at the noise floor are quite small. Even a tiny variation in the magnitude of S11 causes a large jump in measured return loss.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 16, 2019, 05:54:49 pm
Even a tiny variation in the magnitude of S11 causes a large jump in measured return loss.
Agreed. Large jump will trash all the average and spike will stay. Yet I marked *dips*. Whatever. If you say it works - fine.

Quote
If there were opposite peaks at the time of calibrating the NanoVNA itself, it would over-compensate on those particular frequencies, and consistently produce such dips.
Oh, ok. It means that I did find problem with firmware/calibration, not PC software :D
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 16, 2019, 06:19:09 pm
Possibly - though to confirm, you should probably do multiple sweeps with high averaging. If the dips (or peaks) stay in place, it's a "true" error, if they move around, maybe the averaging isn't good enough to catch it, or you have indeed found a bug that I just haven't recognized ;-)

I generally run 10 segments and 25x averaging (using truncated mean, so 25 averages dropping 5 readings per average) when doing calibration. It takes a few minutes per sweep at that point, but it does give a very nice and stable in-application calibration which I can save afterwards. Then again, if I change any cables or connectors, I have to start over ...  ::)
Title: Re: NanoVNA Custom Software
Post by: ogden on October 16, 2019, 06:31:04 pm
Possibly - though to confirm, you should probably do multiple sweeps with high averaging. If the dips (or peaks) stay in place, it's a "true" error, if they move around, maybe the averaging isn't good enough to catch it, or you have indeed found a bug that I just haven't recognized ;-)
Everything is fine, there is no bugs. Phew. Three 20x averages of 20dB reflection, they all look basically the same. Conclusion: to get meaningful averaging results, same level of averaging for calibration data is necessary. Now averaging just reveals calibration noise.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 17, 2019, 01:39:05 am
....

I didn't measured the maximum performance, but think it is about 50-100 kB/s.

....
Communication speed really can be improved, but I'm not sure that this is really needed.

There are several ways to improve performance:
1) optimize communication from PC side (don't send extra requests, don't do long delays, etc)
2) use binary format communications, but it will break compatibility with existing software (NanoVNASharp, Saver, etc)

Oddly, I'm seeing no where close to 50-100 kB/s (400kbs-800kbs) but then again, it could be something I am doing wrong.    I don't think this is the problem with why it's so slow.   Without the Nano connected to the PC and just watching it, it will scan about once a second.   This is using the last image you uploaded.     

On the PC I am seeing 325467 Bytes in 14.04 seconds or 185kbs.  This is plenty fast to keep up with how slow the Nano scans.   If I really push the data rates, basically asking for the next data set right after is finished sending a data set, without giving it some delay, the performance suffers.   

Attached, I am showing the data rate portion of my regression test.   I send out 50 frequencies commands which are very fast to respond as the payload is so small.  This is followed by 50 data  0 and 50 data 1 packets.      I will wait up to 2 seconds for the Nano to respond with a valid packet before timing out.   I had tried to disable the LCD at one time but it had no effect on the speed.  Maybe this has changed. 

I've posted this a few times and mentioned it during my video but as long as we are on the topic of speed,  unlike the software that was supplied with the Nano, I only request the frequencies when I have changed them.   I also only collect data 0 for S11.   Their software will collect data 0, data 1 and the frequencies for each sweep.   I suspect they need a slightly longer delay  for their Auto (1.2 seconds).   It's a very small difference and IMO, both are very slow.   

But hey, it's $50.  I am just happy to see how stable this image you uploaded is!   I have been running a fair number of tests on it over the last few days and not once has it white screened, locked up, or sent bad data.    :-+

I have not added any support for your averaged scan or the normal scan.  I did try sending the commands just to get a feel how they would work.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 17, 2019, 04:15:01 am
If I really push the data rates, basically asking for the next data set right after is finished sending a data set, without giving it some delay, the performance suffers.
Problem even have a name: multitasking race condition. PC software have to request data but time window while it is available, is very small. As we see, PC manages to miss each other scan data set. Needed change is quite "simple" - leave existing "polling" approach alone and introduce new command for continuous scan and "push" for nano. In short nano while said mode is initiated: 1) performs scan 2) optionally displays it on the built-in LCD 3) sends scan data to PC unconditionally and only when USB transfer fully done, continue with next scan.

Quote
But hey, it's $50.
Yes, you can say so when you are talking about tiny screen and fonts, awkward and fragile input "thingie", lack of proper case but such excuse is not OK in case of poor software *design* that clearly can be improved.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 17, 2019, 06:57:33 am
Problem even have a name: multitasking race condition. PC software have to request data but time window while it is available, is very small.

No, there is no race condition. There is just delay while NanoVNA is busy. It cannot respond immediately, because it may be busy. If PC request performed when NanoVNA is busy, it will needs to wait. NanoVNA may perform sweep or rendering. PC command cannot interrupt this operation, so it needs to wait until current operation will be completed.

NanoVNA cannot respond in parallel, because data command needs to access to measurement data, which is under update by sweep. It needs to share the same memory with measurement data, because there is not enough memory to store a copy. Measurement data for single channel requires 101*4 = 404 bytes. There is no memory even for stack margins, so you're needs just to share the same memory for different task.

Since data is modified by sweep task and modification is not complete yet, the data command needs to wait when the sweep will be completed. This is the reason for delay.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 17, 2019, 07:26:40 am
Problem even have a name: multitasking race condition. PC software have to request data but time window while it is available, is very small.
No, there is no race condition. There is just delay while NanoVNA is busy. It cannot respond immediately, because it may be busy. If PC request performed when NanoVNA is busy, it will needs to wait.
You do not make any sense. Why PC does get only each 2nd scan then? I am afraid that you need to update your knowledge about "race condition". Meaning is quite broad BTW.

Quote
Since data is modified by sweep task and modification is not complete yet, the data command needs to wait when the sweep will be completed. This is the reason for delay.
Yes. It means that PC have small time window. I said it already.  Yet you somehow manage to reply "no you are wrong, let me say the same just using another words" :palm:  :-DD

[edit] Why don't you comment my suggestion of PC communications redesign? Two PC software guys are reading, they can potentially change software side accordingly, seems you are more than capable to make such seemingly small firmware change.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 17, 2019, 11:08:24 am
If I really push the data rates, basically asking for the next data set right after is finished sending a data set, without giving it some delay, the performance suffers.
Problem even have a name: multitasking race condition. PC software have to request data but time window while it is available, is very small. As we see, PC manages to miss each other scan data set. Needed change is quite "simple" - leave existing "polling" approach alone and introduce new command for continuous scan and "push" for nano. In short nano while said mode is initiated: 1) performs scan 2) optionally displays it on the built-in LCD 3) sends scan data to PC unconditionally and only when USB transfer fully done, continue with next scan.

Quote
But hey, it's $50.
Yes, you can say so when you are talking about tiny screen and fonts, awkward and fragile input "thingie", lack of proper case but such excuse is not OK in case of poor software *design* that clearly can be improved.

Sadly you seem to have ignored:

Quote
I don't think this is the problem with why it's so slow.   Without the Nano connected to the PC and just watching it, it will scan about once a second.   This is using the last image you uploaded.     On the PC I am seeing 325467 Bytes in 14.04 seconds or 185kbs.  This is plenty fast to keep up with how slow the Nano scans.

I have no race condition.  My software is synchronized to the Nano by the completion of the first request.   

Quote
As we see, PC manages to miss each other scan data set.
As "you" see, not "we".   What I see with the software I am writing, using Radiolistern's image is that my PC easily keeps pace with how slow the Nano sweeps.   

In case you would like to see what I am seeing, I made a short video showing my software plotting data.  The Nano is hung next to the screen so you can watch its' LED compared with the scan indicator of my software.  If you have firmware for the Nano that will sweep faster than this, post details about it and I will see if my PC can somehow manage to keep pace with it. 

https://youtu.be/N77my69u_b8
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 17, 2019, 11:14:19 am
Why PC does get only each 2nd scan then?

Because NanoVNA Saver sends two data requests. First for S11 and second for S21. Each request requires one sweep cycle. So, two request needs two sweep cycles.

That's behavior is specific for NanoVNA Saver. You can request just S11 and it will take single sweep time. But NanoVNA Saver sends two data requests and this is why it takes two sweeps.


I am afraid that you need to update your knowledge about "race condition". Meaning is quite broad BTW.

There is no race condition for data command, because operations are synchronized with mutex.

Why don't you comment my suggestion of PC communications redesign?

I don't see reason to redesign something. Yes, transfer speed can be improved, but I'm too lazy to do something with no real needs. It already works good enough :)
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 17, 2019, 11:21:06 am
That's behavior is specific for NanoVNA Saver.

I don't know that there would be another way to do it if reading both S11 and S21?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 17, 2019, 11:25:06 am
Why PC does get only each 2nd scan then?

Because NanoVNA Saver sends two data requests. First for S11 and second for S21. Each request requires one sweep cycle. So, two request needs two sweep cycles.

That's behavior is specific for NanoVNA Saver. You can request just S11 and it will take single sweep time. But NanoVNA Saver sends two data requests and this is why it takes two sweeps.

When I use both data0 & data1, I plot while alternating between the two data sets.  So my screen always updates once per request.   I guess I could have shown that as well.  It would have been just as exciting to watch. 

 :-DD :-DD

That's totally wrong with my current software.  I plot once after both data sets have been collected.

 :-DD :-DD

Wrong again....  It's actually the way I originally described.   :palm:  Time for some wake up juice. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 17, 2019, 11:44:56 am
As a totally off subject, I happened to listen to the last Amp hour podcast.  Anytime they mention RF in the subject with both Dave and Chris, I'll have a listen.    Oddly, they are talking about VNAs.  Chris talks about getting the new Siglent one and they discuss the merits of the old 8753ES vs the new Siglent.  (I almost pulled the trigger on a 6Ghz ES to replace my old 8754A).    Anyway, to my surprise, even with it being as popular as it is, there wasn't a single mention of the NanoVNA.   

If I were buying my first ever VNA and was just getting started with RF, I would hands down spend the $50 on the Nano to at least learn some of the basics.   I wouldn't be surprised to find out that it wasn't the most sold VNA ever! 
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 17, 2019, 12:21:03 pm
I don't know that I would say it's off-topic. :)

My guess is that there are two main reasons: The NanoVNA isn't being marketed, but only spreading via word of mouth, mainly among enthusiasts in the amateur radio community. And there is a preference, approaching a fetish at times, for expensive test gear from the big name brands among some parts of the electronics community ;)

The NanoVNA is my first VNA, and I have no desire to buy anything more expensive than it, given the (limited) uses I have for it.
Title: Re: NanoVNA Custom Software
Post by: xrunner on October 17, 2019, 12:30:48 pm
If I were buying my first ever VNA and was just getting started with RF, I would hands down spend the $50 on the Nano to at least learn some of the basics.   I wouldn't be at all surprised to find out that it wasn't the highest sold VNA ever!

It's selling like hotcakes in my town as far as the local hams. A few of us got them and started talking about the NanoVNA. Most people didn't have a clue what a "vector network analyzer" did. But after an explanation and some in-person demos it's caught on Big Time. Companies like MFJ who sell antenna analyzers for hams here -

MFJ Analyzers (https://www.mfjenterprises.com/Categories.php?sub=0&ref=7)

are in trouble because they will not be able to compete with something like the Nano for < $50.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 17, 2019, 12:50:09 pm
As "you" see, not "we".
It's "you", not me/we ;) I talk about NanoVNA Saver and it was clearly said BTW.

Because NanoVNA Saver sends two data requests. First for S11 and second for S21. Each request requires one sweep cycle. So, two request needs two sweep cycles.
Well, I did not know that. It makes sense then indeed. So how does NanoVNA Saver and other PC software can get Both - S11 and S21 using single request? - If there is no command then perhaps you can make one?  :-//
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 17, 2019, 01:01:01 pm
It's selling like hotcakes in my town as far as the local hams. A few of us got them and started talking about the NanoVNA. Most people didn't have a clue what a "vector network analyzer" did. But after an explanation and some in-person demos it's caught on Big Time. Companies like MFJ who sell antenna analyzers for hams here -

MFJ Analyzers (https://www.mfjenterprises.com/Categories.php?sub=0&ref=7)

are in trouble because they will not be able to compete with something like the Nano for < $50.

That doesn't surprise me at all.   If anything, I would have expected him to plug his own site.  I find it hard to believe Dave's not aware of this threads' popularity. 
Title: Re: NanoVNA Custom Software
Post by: ogden on October 17, 2019, 01:01:59 pm
Companies like MFJ who sell antenna analyzers for hams here -
MFJ Analyzers (https://www.mfjenterprises.com/Categories.php?sub=0&ref=7)
are in trouble because they will not be able to compete with something like the Nano for < $50.

Right, they should be worried :) Is it even legal to use square wave signal for antenna tuning? - Harmonics violate out-of band radiation regulations for sure. It's kinda "spread spectrum" unless CW mode used, but anyway. Many of you are HAMs, right? Perhaps you can comment? - Just curious.
Title: Re: NanoVNA Custom Software
Post by: xrunner on October 17, 2019, 02:02:35 pm

Right, they should be worried :) Is it even legal to use square wave signal for antenna tuning? - Harmonics violate out-of band radiation regulations for sure. It's kinda "spread spectrum" unless CW mode used, but anyway. Many of you are HAMs, right? Perhaps you can comment? - Just curious.

What does it output - something like -10 dBm, which is 100 uW? Maybe even less.

I just connected the NanoVNA to a 30m dipole outside, which is just under another fan dipole with the same band included (I have a lot of antennas ). I set the Nano to sweep from 10.1 to 10.150 MHz. I listened to the sweeps on an Icom IC-7300 and you can indeed hear the sweeping (and see it on the waterfall). I then connected the radio to my other main fan dipole which is about 30 feet away - the amplitude is already falling off considerably in that range.

However - I tuned through other ham bands (and other ranges in the shortwave bands) and could not hear any sweeping at all outside of the set sweep range. So, even though there may be sidebands out there, they are too low to detect with a shortwave radio

Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 17, 2019, 03:57:00 pm
Well, I did not know that. It makes sense then indeed. So how does NanoVNA Saver and other PC software can get Both - S11 and S21 using single request? - If there is no command then perhaps you can make one?  :-//

yes, technically there is no command which allows to read S11 and S21 simultaneously. And if you want both, you will need to send two requests and it will take two sweeps. It is possible to add such ability, but current PC software don't know about new features, so they will continue to use old command and it will still take two sweeps :)

This makes a vicious circle. Firmware don't have such command because it is not used in software. And software is unable to do that because there is no such command in firmware :)

Sending both S11 and S21 is much slower. And there is no needs for S11 and S21 simultaneously. So, I don't see the real needs for command which can send information about both channel simultaneously. If you needs S11 and S21 you can send two data commands. And if you needs just S11 or just S21, you can send single data command. It works pretty good.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 17, 2019, 04:04:41 pm
Is it even legal to use square wave signal for antenna tuning? - Harmonics violate out-of band radiation regulations for sure. It's kinda "spread spectrum" unless CW mode used, but anyway. Many of you are HAMs, right? Perhaps you can comment? - Just curious.

NanoVNA has low power output. The maximum peak power from NanoVNA is about 10 dBm and it is even much smaller on high frequency. This is about 0.01 W power. The average NanoVNA power is about -10 dBm, it is about 0.0001 W. In most countries it is allowed to use such power with no license.

HAMs in most cases using resonant antennas, which actually works as effective bandpass filter due to it's high Q-factor. So, it radiates at ham bands and has very low efficiency outside HAM bands. If you use wideband antenna it will have low efficiency due to low Q needed for wide bandwidth.

As you can see, weak signal from NanoVNA can be radiated at HAM bands and it's power as low, so it cannot affect anything.
Title: Re: NanoVNA Custom Software
Post by: Kalvin on October 17, 2019, 04:15:31 pm
Possibly - though to confirm, you should probably do multiple sweeps with high averaging. If the dips (or peaks) stay in place, it's a "true" error, if they move around, maybe the averaging isn't good enough to catch it, or you have indeed found a bug that I just haven't recognized ;-)
Everything is fine, there is no bugs. Phew. Three 20x averages of 20dB reflection, they all look basically the same. Conclusion: to get meaningful averaging results, same level of averaging for calibration data is necessary. Now averaging just reveals calibration noise.

Yes, I was going to ask whether the calibration is using the averaging also. If not, then the averaging during actual measurement doesn't really make sense as the calibration data is noisy anyway.

Edit: Probably the calibration should be done using at least twice the averaging compared to the averaging used during the actual measurement.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 17, 2019, 07:40:02 pm
And there is no needs for S11 and S21 simultaneously.
Nonsense. You again invent strange (to say it politely) arguments out of nowhere, just for argument sake. Not mentioning big VNA's (https://cdn.rohde-schwarz.com/pws/product/z_1/znb/ZNB_front_4.jpg), even Nanovna itself measure S11 and S21 in single scan pass and display both, yet you just decided for everybody that PC application do not need such feature, at least not as fast as nanovna *hardware* allows. :wtf:   FYI it is very convenient to simultaneously see "both ends" of the filter or diplexer or whatever >=2 terminal thing you measure, especially if you tune it. Then it may be even necessity.

NanoVNA has low power output. The maximum peak power from NanoVNA is about 10 dBm and it is even much smaller on high frequency. This is about 0.01 W power. The average NanoVNA power is about -10 dBm, it is about 0.0001 W. In most countries it is allowed to use such power with no license.
Yes. When transmission is within amateur band. I was talking about out of band spurious emissions that are products of square wave. Let's check FCC 47 Radio Amateur Service regulations, §97.307.(e):
Quote
on a frequency between 30–225 MHz must be at least 60 dB below the mean power of the fundamental. For a transmitter having a mean power of 25 W or less, the mean power of any spurious emission supplied to the antenna transmission line must not exceed 25 μW and must be at least 40 dB below the mean power of the fundamental emission, but need not be reduced below the power of 10 μW.
10uW is -20dBm, 25uW is -16dBm. What is level of 3rd harmonic when fundamental of square wave is at -10dBm?
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 17, 2019, 08:01:23 pm
When NanoVNA-Saver reads a segment, it reads frequencies, S11, S21. For those running a newer edy555 firmware (0.2.0+) supporting the "scan" function, the command sequence is as follows:

scan 50000 900000000 101
frequencies
data 0
data 1

(Example there for 50 kHz - 900 MHz)

The timing here is as follows, examples from my own NanoVNA:
0.412s: Sending scan command
0.551s: Asked for frequencies
1.320s: Finished receiving frequencies  <-- This is where the application primarily waits for the device
1.422s: Asked for S11
1.510s: Done reading S11
1.613s: Asked for S21
1.708s: Done reading S21

Total time spent 1.296 seconds plus the processing done in NanoVNA-Saver. Looks like the time between the app saving data is 1.303, so the application uses 7 milliseconds for its internal processing between segments.

I have tried moving the frequencies to be read later, but the pattern is clear that the first data requested after the "scan" command is slowed down by about 6-800ms.

After each command, the application waits 50ms before it starts emptying the buffer. I doubt that this moves the timings significantly, as emptying the buffers takes more than 50ms in all cases, and the PC speed is not the limit.

I don't know how this looks for different firmwares - I only have the one NanoVNA, and I'm not going to flash all kinds of different firmware on it, as I need it for app development ;) However: For devices that do *not* support the scan command, the application sleeps for a full second after setting the sweep span, to allow the NanoVNA to sweep the frequencies requested. Prior to doing this (when the timing was 300ms), I would sometimes see values from the previous frequency span repeated. It was faster, but less reliable - and I made the decision that reliable is more important than fast. The code is there for anyone who wants to change it for their own priorities :)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 17, 2019, 11:29:21 pm
When NanoVNA-Saver reads a segment, it reads frequencies, S11, S21. For those running a newer edy555 firmware (0.2.0+) supporting the "scan" function, the command sequence is as follows:

scan 50000 900000000 101
frequencies
data 0
data 1

(Example there for 50 kHz - 900 MHz)
.....

I don't know how this looks for different firmwares - I only have the one NanoVNA, and I'm not going to flash all kinds of different firmware on it, as I need it for app development ;) However: For devices that do *not* support the scan command, the application sleeps for a full second after setting the sweep span, to allow the NanoVNA to sweep the frequencies requested.
...

When I first noticed the Scan command someone was posting how it worked and I was interested in looking at it but it was disabled in the Hugen code I downloaded.   What was interesting to me is that it sent up the frequency, S11 and S21 data in one call.  Plus it would handle more than the 101 points.   I had hoped it would help speed things up.      While I archived the details how it worked, when I tried to use it with the last image from Radiolistener, it was nothing like what had been presented.  It seems like there were different people creating the same commands.   

Once again, the lack of documentation for the firmware makes it less appealing at least for me at least to try it out.   In the case of the Scan command that's implemented in this particular load,  I suspect it is similar to what you have shown.    The original documentation I have shows the command not applying the calibration.   You don't mention this detail, and I would be guessing and using trial and error.   Certainly one way to develop code.

Their Scanraw may be of more interest to me as it supports some sort of averaging which I don't currently support because of how slow the Nano is.   Currently I will run a smoothing filter across each sweep.  I can easily do this and keep up with that ultra fast 1Hz rate.   :-DD   I showed a plot and a link to an article about it here:

https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2703604/#msg2703604 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2703604/#msg2703604)


Comment I had archived about the Scan command: 
Quote
I added one command to the eddy firmware to enable on demand scans of
arbitrary length (yes, you can scan with one million steps or much more if you want)

Usage:
First pause the continuous scanning with "pause" and the use the "scan" command
to scan [from frequency in Hz] [increment frequency in Hz] [number of steps]
The frequency increment step is for now an integer
The scan command outputs

start
frequency s11_real s11_imag s21_real s21_imag
done

during the scan the calibration is NOT used so the output are uncalibrated numbers
allowing alternative calibration strategies

Example:
ch> pause
ch> scan 5000000 20 5
ch> start
5000000 0.001503840 0.000420701 -0.306770563 0.018568072
5000020 0.000695601 0.000503197 -0.306792527 0.018579231
5000040 0.000532656 0.000520238 -0.306793421 0.018573865
5000060 0.000495833 0.000512704 -0.306819111 0.018593480
5000080 0.000520689 0.000523833 -0.306812644 0.018576323
Title: Re: NanoVNA Custom Software
Post by: ogden on October 18, 2019, 04:20:20 am
Good. Seems like least effort solution to PC software "individual data request for each port which results in 2x slower scanning" problem is - just make new data request command ("data01" ?) that returns data for both ports. As we see format is already there, at least on Nano side. Obviously scan shall include NanoVNA calibration corrections.
5000000 0.001503840 0.000420701 -0.306770563 0.018568072
5000020 0.000695601 0.000503197 -0.306792527 0.018579231
5000040 0.000532656 0.000520238 -0.306793421 0.018573865
Title: Re: NanoVNA Custom Software
Post by: OwO on October 18, 2019, 04:24:00 am
I'm currently working on porting the firmware to the V2 and I can tell you it's a cesspool of bad design, very typical of embedded code. Implicit function calls everywhere (calling a function without including a header file that contains the declaration, and usually there is no declaration at all), everything communicates through globals, no clear dependency relationship between files, hardcoded callbacks everywhere, compiler warnings seem to be all ignored (because I found a handful of bugs just by looking at the warnings), functions just call each other with no regard to which module it is in (e.g. the si5351 driver accesses global variables declared in main.c), forward declarations in the *caller*'s file, and of course I found one that had the wrong signature. The UI code directly manipulates the ADC FFS.

So far I've decided to simply refractor and integrate the UI code into my own firmware that implements all the VNA functionality from scratch. Of course, the command interface is completely replaced so compatibility is broken and you can get far higher sweep rates. Here is the firmware being worked on: https://github.com/nanovna/NanoVNA-V2-firmware-new
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 18, 2019, 04:47:25 am
For those running a newer edy555 firmware (0.2.0+) supporting the "scan" function, the command sequence is as follows:

scan 50000 900000000 101
frequencies
data 0
data 1

you can do it in the following way:

scan 50000 900000000 101
frequencies
data 0
data 1
data 0
data 1
data 0
data 1
data 0
data 1
data 0
data 1
...

I don't know how this looks for different firmwares - I only have the one NanoVNA, and I'm not going to flash all kinds of different firmware on it, as I need it for app development ;)

that's your mistake and the source of bugs. There is no risk for firmware update, except that you may loss your configuration settings and calibration and will needs to calibrate it from scratch after firmware update. But it takes not so long time.

Probably you're using very old firmware, it has race condition issues, high noise floor, high spikes, frequency step rounding error, frequency range rounding error, data transfer error, floating point precision loss and a bunch of other bugs. I highly recommend to use more new firmware.


However: For devices that do *not* support the scan command, the application sleeps for a full second after setting the sweep span, to allow the NanoVNA to sweep the frequencies requested. Prior to doing this (when the timing was 300ms), I would sometimes see values from the previous frequency span repeated.

such behavior was possible in the old firmware which has race conditions issues and very unstable.

Now I understand the reason why edy555 added scan command. The difference between sweep and scan commands is just that scan command is synchronized with sweep and waits for scan end before executing next command. The sweep command is not synchronized and don't wait's. That's the difference.

That's why you have long delay on frequencies command executed immediately after scan command. You will needs to wait while scan command execution will be completed (it needs to wait for sweep end).

Now I see that using sweep command very often is not thread safe and may leads to data transfer errors. I will think about it and how to fix it.

By the way, NanoVNA-Q has scan command from edy555 version. So you can use it if you needs scan command. Technically all fixes from edy555 branch are included in the NanoVNA-Q firmware, include these which still not released and will be released in the future release of firmware. In addition it also has some fixes from hugen79 branch. Also NanoVNA-Q has a lot of bug fixes.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 18, 2019, 04:52:53 am
it's a cesspool of bad design, very typical of embedded code
Right. It is usually in case of hobby projects that are started by hobbyists who do not foresee that their creation will ever become widely popular. We shall just live with that.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 18, 2019, 04:55:59 am
I'm currently working on porting the firmware to the V2 and I can tell you it's a cesspool of bad design, very typical of embedded code. Implicit function calls everywhere (calling a function without including a header file that contains the declaration, and usually there is no declaration at all), everything communicates through globals, no clear dependency relationship between files, hardcoded callbacks everywhere, compiler warnings seem to be all ignored (because I found a handful of bugs just by looking at the warnings), functions just call each other with no regard to which module it is in (e.g. the si5351 driver accesses global variables declared in main.c), forward declarations in the *caller*'s file, and of course I found one that had the wrong signature. The UI code directly manipulates the ADC FFS.

уeah, it has poor design. There is also variable which actually #define for struct member access. It very confusing when you debugging the code :)

The most of warnings, except these about goto statement and floating point conversion, they are fixed in NanoVNA-Q branch.

I also thought about refactoring, but it will take a lot of time. So, I just fixed critical issues in the code and that's it :)
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 18, 2019, 05:00:48 am
Comment I had archived about the Scan command: 

this scan command was invented by @erikkaashoek, but it is was rejected by @edy555. He implemented scan command as a thread safe version of sweep command.

So, now scan command is just a thread safe replacement for sweep command. And it cannot sweep more than 101 point.

This is why scanraw command was introduced in the NanoVNA-Q. It has the same principle as @erikkaashoek, but a little optimized and improved.

scanraw don't returns frequency, because frequency can be easily calculated by adding step frequency on each step. And it allows to perform average measurement.

But scanraw don't apply calibration to the measurement results, it just returns raw uncalibrated measurements.

If you're planning to add the same command with calibration apply, I suggest to use name scancal for such command. :)
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 18, 2019, 07:13:32 am
you can do it in the following way:
That would just give me the same data over and over. The NanoVNA stops sweeping after sending the scan command.

Even if it did not, my most common use case is to sweep one segment, then the next, then the next, etc.

that's your mistake and the source of bugs.
Good, we got that squared away then.

Probably you're using very old firmware
I think my post makes it quite clear that I have coded the particular sequence for firmwares newer than 0.2.0.  I'm running 0.2.3.

However: For devices that do *not* support the scan command, the application sleeps for a full second after setting the sweep span, to allow the NanoVNA to sweep the frequencies requested. Prior to doing this (when the timing was 300ms), I would sometimes see values from the previous frequency span repeated.

such behavior was possible in the old firmware which has race conditions issues and very unstable.
Yes, that's where the delay is used.

By the way, NanoVNA-Q has scan command from edy555 version. So you can use it if you needs scan command. Technically all fixes from edy555 branch are included in the NanoVNA-Q firmware, include these which still not released and will be released in the future release of firmware. In addition it also has some fixes from hugen79 branch. Also NanoVNA-Q has a lot of bug fixes.

How would I programmatically recognize a NanoVNA-Q firmware? Which versions have the scan command? Is it from a specific version number and up? Is it fully compatible with the original firmware, or would I have to make special handling for it?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 18, 2019, 12:11:46 pm
......

By the way, NanoVNA-Q has scan command from edy555 version. So you can use it if you needs scan command. Technically all fixes from edy555 branch are included in the NanoVNA-Q firmware, include these which still not released and will be released in the future release of firmware. In addition it also has some fixes from hugen79 branch. Also NanoVNA-Q has a lot of bug fixes.

How would I programmatically recognize a NanoVNA-Q firmware? Which versions have the scan command? Is it from a specific version number and up? Is it fully compatible with the original firmware, or would I have to make special handling for it?

I use the Help command and check the list of supported commands before trying to test them.    I would imagine the Info command could be used to narrow it down further. 

While my software will work with the six or so images I have tried (at least to the degree that the firmware works), because I don't use the Scan command,  I can't comment on if that will hinder you or not.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 18, 2019, 12:22:50 pm
For those running a newer edy555 firmware (0.2.0+) supporting the "scan" function, the command sequence is as follows:

scan 50000 900000000 101
frequencies
data 0
data 1

you can do it in the following way:

scan 50000 900000000 101
frequencies
data 0
data 1
data 0
data 1
data 0
data 1
data 0
data 1
data 0
data 1
...


I assume that the data0&1 will cause the Nano to sweep and update the display then.   

I wonder what drove the change.   If it really takes 1.3 seconds to pull both data sets plus the frequency list, it seems like from your post that the data0 for example could be repeated with an update rate of half that.    Still, not great but it seems be this may be an advantage.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 18, 2019, 01:15:49 pm
For those running a newer edy555 firmware (0.2.0+) supporting the "scan" function, the command sequence is as follows:

scan 50000 900000000 101
frequencies
data 0
data 1

you can do it in the following way:

scan 50000 900000000 101
frequencies
data 0
data 1
data 0
data 1
data 0
data 1
data 0
data 1
data 0
data 1
...


I assume that the data0&1 will cause the Nano to sweep and update the display then.   

I wonder what drove the change.   If it really takes 1.3 seconds to pull both data sets plus the frequency list, it seems like from your post that the data0 for example could be repeated with an update rate of half that.    Still, not great but it seems be this may be an advantage.

It appears that the scan must be sent prior to each data set being read, or the same data is read.   The LCD does not appear to update.   So the ordering listed makes sense.   Ignoring the floating point errors, you may be able to ignore the frequencies command and just call say data 0.   The more I look at it, I am missing the point.  The way I structured my code appears very stable and again keeps pace with the slow Nano.  So Scan is out unless I really missed the point of it.

Quote
scan 50000 900000000 101
frequencies
data 0
data 1


Sending the Scanraw, followed by Frequencies, the displayed frequency list will not match the requested range.   The software could calculate the frequencies, ignoring the floating point errors.  It's blind faith...

Normally when running a sweep, setting the start frequency to 0Hz will cause the actual start to be whatever the lowest supported frequency is.  With Scanraw, it will report out of range.   I'm not sure why the commands don't work the same in this respect.  As is, without the frequency tracking and lower limit not being coerced, without support for the original command set it would be difficult to find the lower limit.

When using the Scanraw to average the data, there appears to be no user feedback that the Nano is doing anything.  The LED stops flashing and the unit appears hung.  Again, blind faith, pry it comes back in some amount of time..

When using the Scanraw and setting the upper frequency to 900MHz and a lower to 100KHz, will cause an out of range error.  I started with 10KHz to 1G which also errors out.   100KHz to 100MHz seems to work.  Same with a 10MHz upper limit.
This was a mistake on my part, using improper syntax.
Quote
scanraw
usage: scanraw {channel(0|1)} {start(Hz)} {stEp(Hz)} {count} [average]
ch>

Setting the average parameter to 0 causes an error.  I would have expected that to disable the average.  Again, trail and error.  It's possible that not including the average parameter disables it.   Just a guess.

Again, problems could be on my side.  I have no documentation on how it should be used and what the fringe cases are.  It's a pure design be trial and error, using blind faith.    Oh mighty Nano, please except my offering.....   

I would expect a new command like scanraw to use the start and stop frequencies along with span and such.   I would also expect to be able to use the standard commands like frequencies with it.    Having  a command to enable average and set what ever parameters it needs, then use the other existing commands to support it.   

Using the Scanraw and sending up 101 data points when compared with the original method appears to be very slow.  I suspect the only gains are when using the average feature.   
 

***
Added a plot showing the result with the Average parameter set to 100.  Without documentation, I am not sure how the average is performed but assume the system performs 100 sweeps to do it.   What is interesting is it takes roughly 11 seconds per command or a sweep every tenth of a second.   If that's true and the Nano can actually scan this fast, not loose lock and send corrupt data,  forget all this scan stuff and speed it up.   I would much rather see a 10Hz sweep rate.   
Title: Re: NanoVNA Custom Software
Post by: V_9 on October 18, 2019, 03:26:03 pm
Dear joeqsmith
i would like to thank you for all this knowledge you are offering.
May I ask you please, what is the program you use and present in your images?
Can you share it with me or let me know about it?
Thanks.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 18, 2019, 03:52:05 pm
Dear joeqsmith
i would like to thank you for all this knowledge you are offering.
May I ask you please, what is the program you use and present in your images?
Can you share it with me or let me know about it?
Thanks.

If you look at the first few posts in this thread, you will find it's custom and written in LabView.   There is a member here creating a fully open source interface.   I don't know much about it and only tried it out when they first posted about it.   I would imagine by now it's fairly mature.  Being supplied to the public, I would expect it is much more user friendly and well documented.   I would also imagine the support would be there from people using it as well as the author.    Personally, I suggest you have a look.

My software by contrast is really being developed to conduct my own personal experiments with the Nano.  It's an engineering tool at best.  While I have thought about releasing it a few times, reality steps in, bitch slaps me and snaps me out of it.    Lack of time to support it is still the biggest concern I have.  I suspect the majority of uses of the Nano are amateurs and to be frank, I suspect the software in it's current state would not be well suited for this group.     So have a look at the open source and enjoy your Nano.  It's a pretty slick device IMO. 
Title: Re: NanoVNA Custom Software
Post by: V_9 on October 18, 2019, 03:56:43 pm
thank you again for your response
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 18, 2019, 05:11:17 pm
The NanoVNA stops sweeping after sending the scan command.

You can use sweep command instead of scan. It works great and allows to update S11 and S21 in a single sweep. At least with NanoVNA-Q it works in such way :)

How would I programmatically recognize a NanoVNA-Q firmware? Which versions have the scan command? Is it from a specific version number and up? Is it fully compatible with the original firmware, or would I have to make special handling for it?

it has board name: NanoVNA-Q

Yes, it is fully compatible with the latest original edy555 firmware. The only difference is that the data command returns more precise values and frequency range has no rounding error. These bugs are fixed.
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 18, 2019, 06:10:19 pm
The NanoVNA stops sweeping after sending the scan command.

You can use sweep command instead of scan. It works great and allows to update S11 and S21 in a single sweep. At least with NanoVNA-Q it works in such way :)
Yes, but that doesn't work on the original firmware, at least not after 0.2.0. That's why I changed it; I talked to edy555, and he told me that software should use the "scan" command for future firmware versions. Whether he makes it faster is up to him.

it has board name: NanoVNA-Q

Yes, it is fully compatible with the latest original edy555 firmware. The only difference is that the data command returns more precise values and frequency range has no rounding error. These bugs are fixed.

Sounds good wrt the board name.  I'm a little confused that you say it's fully compatible, though, if the scan command behaves differently. What rounding error are you saying the edy555 firmware has?
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 18, 2019, 06:18:09 pm
Sending the Scanraw, followed by Frequencies, the displayed frequency list will not match the requested range.   The software could calculate the frequencies, ignoring the floating point errors.  It's blind faith...

scanraw use integer frequency arithmetic, there is no floating point error for integer arithmetic. It always calculate exactly the same value.

For example, if start frequency is 1000000 and frequency step is 1000. It is guaranteed that frequency list will be exactly the following:

1000000
1001000
1002000
1003000
1004000
...

The result is always predictable. This is why scanraw don't needs frequencies command.

Normally when running a sweep, setting the start frequency to 0Hz will cause the actual start to be whatever the lowest supported frequency is.  With Scanraw, it will report out of range.   I'm not sure why the commands don't work the same in this respect. As is, without the frequency tracking and lower limit not being coerced, without support for the original command set it would be difficult to find the lower limit.

scanraw returns requested frequency range only. It doesn't shift frequencies. If you requested start frequency 12345 Hz and frequency step 100 Hz, then scanraw guarantee that the first frequency will be always exactly 12345 Hz, the second frequency will be exactly 12345 + 100 = 12445 Hz, the third frequency will be exactly 12345 + 100 + 100 = 12545 Hz etc. Scanraw command guarantees that frequencies will be exactly the same as requested, with no shift, with no rounding error.

This is why scanraw returns error if requested range is out of device frequency range (10 kHz - 1500 MHz).

You can find supported frequencies by send sweep commands and then execute frequencies command:

Code: [Select]
sweep start 0
sweep stop 4000000000
frequencies

Just look for the first and last record and you will know device limit :)


When using the Scanraw to average the data, there appears to be no user feedback that the Nano is doing anything.  The LED stops flashing and the unit appears hung.  Again, blind faith, pry it comes back in some amount of time..

it didn't hung. It just capture device for exclusive use during command execution time. When the command will be completed, the normal sweep operation will be restored and you will be able to continue use touch screen as usual.

Setting the average parameter to 0 causes an error.  I would have expected that to disable the average.  Again, trail and error.  It's possible that not including the average parameter disables it.   Just a guess.

average = 1 means no average, just single measurement.

average = 0 means zero measurement count and no data. This is why it returns error for zero average.

I would expect a new command like scanraw to use the start and stop frequencies along with span and such.

If you specify start/stop or center/span it leads to uncertainty. The frequency step will be calculated on NanoVNA side and it may have rounding error and you will need to request frequency list. As it used with usual sweep and data commands.

It leads to redundant transfer for frequency data and more long measurement time. And PC cannot control frequency step value, because it will be calculated on NanoVNA side with it's rounding precision. This is why using start/stop center/span is a bad idea.

scanraw uses start/step parameters in order to guarantee that the frequency list will be exactly as requested with no rounding and no shifting. It allows to exclude frequency data from data transfer, because frequency can be easily calculated on PC side and it will be exactly the same. Because it uses integer arithmetic and fixed frequency step. It allows to significantly improve data transfer and measurement speed. And excludes frequency step uncertainty.

Using the Scanraw and sending up 101 data points when compared with the original method appears to be very slow.  I suspect the only gains are when using the average feature.   

scanraw is introduced for a large datasets. For example if you request 1000 points, scanraw will be done in 6 seconds. If you use data command it will require about 15 seconds for 10 sweeps.

For 3000 points scanraw takes 17 seconds.

With 10x average, 1000 points measurement takes 15 seconds.

This is how it works :)
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 18, 2019, 06:29:43 pm
I'm a little confused that you say it's fully compatible, though, if the scan command behaves differently.

"scanraw" and "scan" are different commands.

"scan" command works exactly the same as "scan" command in original edy555 firmware.

What rounding error are you saying the edy555 firmware has?

original firmware has frequency rounding error. For example, if you selected 50000 to 900000000 range, you will find that there is no 50000 and 900000000 frequency. All frequency are shifted with random value, about 16 Hz or something like that.

The worse thing is that the real frequency also may be different from that value which you will get with frequencies command. And there is no reliable way to know that it uses proper frequency.

It will be even more confusing, because NanoVNA shows different frequency range than you get with frequencies command.

These bugs are fixed in NanoVNA-Q.
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 18, 2019, 06:34:49 pm
"scan" command works exactly the same as "scan" command in original edy555 firmware.

Right, okay. I was just confused by your earlier post where you suggested I could do scan/data 0/data 1/data 0/data 1/... and get new data. Which isn't possible with the stock firmware. So I thought your version was different. :-)

If it's fully compatible, I think I'll just let it use the same interface as the stock firmware for now.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 18, 2019, 06:35:43 pm
Yes, but that doesn't work on the original firmware, at least not after 0.2.0. That's why I changed it; I talked to edy555, and he told me that software should use the "scan" command for future firmware versions. Whether he makes it faster is up to him.

it works with any firmware version :)
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 18, 2019, 06:37:56 pm
Right, okay. I was just confused by your earlier post where you suggested I could do scan/data 0/data 1/data 0/data 1/... and get new data. Which isn't possible with the stock firmware. So I thought your version was different. :-)

yes, you're right, I just forgot, that "scan" command disable sweep. So, such method won't works with "scan" command. But it works good with usual "sweep" command.
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 18, 2019, 06:46:55 pm
Yes, but that doesn't work on the original firmware, at least not after 0.2.0. That's why I changed it; I talked to edy555, and he told me that software should use the "scan" command for future firmware versions. Whether he makes it faster is up to him.

it works with any firmware version :)

Firmware version 0.2.0-0.2.2 at least had problems with it - it would return data from the previous span if polled too fast after a sweep command. I think earlier firmwares showed this problem as well.  That's why I talked to edy555 about it in the first place.

So no, it doesn't work with "any" firmware version: Sadly, the various firmwares are not generally compatible. :)
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 18, 2019, 06:50:51 pm
Firmware version 0.2.0-0.2.2 at least had problems with it - it would return data from the previous span if polled too fast after a sweep command. I think earlier firmwares showed this problem as well.  That's why I talked to edy555 about it in the first place.

yes it is possible to read the same sweep two times in a row. But I don't see a big problem with that. Just wait for the next sweep :)

There is no need for delay. Just execute data command again and you will get next sweep.
Title: Re: NanoVNA Custom Software
Post by: 5q5r on October 18, 2019, 07:02:51 pm
There are serious problems with that approach: When reading multiple segments in a row, reading the wrong data for a given frequency span gives completely wrong readings.

The frequencies command would return the requested span of frequencies, but the data commands would sometimes return the old data. So it wouldn't even be sufficient to check if the frequencies were right.

Your approach of executing the data command again only seems to work for the limited use case of doing continuous single-span sweeping.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 18, 2019, 07:52:16 pm
okay, now I understand the problem. I will try to fix it.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 18, 2019, 08:33:52 pm
try this one. If all works as expected,  this version should guarantee that the "data" command will read correct data after "sweep" command. But needs to test.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 19, 2019, 05:03:12 am
scanraw use integer frequency arithmetic, there is no floating point error for integer arithmetic. It always calculate exactly the same value.
....
The result is always predictable. This is why scanraw don't needs frequencies command.

Understood.

scanraw returns requested frequency range only. It doesn't shift frequencies. If you requested start frequency 12345 Hz and frequency step 100 Hz, then scanraw guarantee that the first frequency will be always exactly 12345 Hz, the second frequency will be exactly 12345 + 100 = 12445 Hz, the third frequency will be exactly 12345 + 100 + 100 = 12545 Hz etc. Scanraw command guarantees that frequencies will be exactly the same as requested, with no shift, with no rounding error.

This is why scanraw returns error if requested range is out of device frequency range (10 kHz - 1500 MHz).

You can find supported frequencies by send sweep commands and then execute frequencies command:

Code: [Select]
sweep start 0
sweep stop 4000000000
frequencies

Just look for the first and last record and you will know device limit :)

Understood.   Of course, it requires the older Frequencies command, which is how I had been determining the limits.


When using the Scanraw to average the data, there appears to be no user feedback that the Nano is doing anything.  The LED stops flashing and the unit appears hung.  Again, blind faith, pry it comes back in some amount of time..

it didn't hung. It just capture device for exclusive use during command execution time. When the command will be completed, the normal sweep operation will be restored and you will be able to continue use touch screen as usual.

My point is from a user perspective.  Depending on the parameters passed down to the command, it may require minutes to run.  During that time, nothing is happening on the Nano.  The PC can't detect if it's doing anything.  The LED that normally would show that it is scanning, doesn't appear to be used.  For all practical purposes, it appears dead. 

If you specify start/stop or center/span it leads to uncertainty. The frequency step will be calculated on NanoVNA side and it may have rounding error and you will need to request frequency list. As it used with usual sweep and data commands.

It leads to redundant transfer for frequency data and more long measurement time. And PC cannot control frequency step value, because it will be calculated on NanoVNA side with it's rounding precision. This is why using start/stop center/span is a bad idea.

scanraw uses start/step parameters in order to guarantee that the frequency list will be exactly as requested with no rounding and no shifting. It allows to exclude frequency data from data transfer, because frequency can be easily calculated on PC side and it will be exactly the same. Because it uses integer arithmetic and fixed frequency step. It allows to significantly improve data transfer and measurement speed. And excludes frequency step uncertainty.

Understood.  I doubt the rounding would make any difference to me as a user.    I only request the frequency when I change it so that really doesn't come into play when looking at the measurement times.   From my experience, start, stop, center and span are all fairly common commands for NA and SAs.   The analyzer normally calculates the step size.   It's been ingrained into me by the industry.   

Overall speed wise, from what I can tell, the scanraw is very slow for doing 101 samples without average.   Hands down, if I needed to run a longer average, it would be faster but the smoothing has been good enough and I get the updates live.    I've thought about using a running average but haven't had a need for it yet. 


Using the Scanraw and sending up 101 data points when compared with the original method appears to be very slow.  I suspect the only gains are when using the average feature.   

scanraw is introduced for a large datasets. For example if you request 1000 points, scanraw will be done in 6 seconds. If you use data command it will require about 15 seconds for 10 sweeps.

For 3000 points scanraw takes 17 seconds.

With 10x average, 1000 points measurement takes 15 seconds.

This is how it works :)
Understood.   If it were possible to get the system to collect data on the PC faster,  that's what I would want.   Fast enough that as I make adjustments that there is no perceptive delay.  Then again, that $50 number forgives a lot.... 
 

It's odd as I started using segmented sweeping shortly after getting the Nano and having it miss or be out of sync hasn't been a problem.   I tried several tests with your previous image and it seems to work fine. 

I have downloaded your latest version and plan to let it run the latest regression tests overnight.   It's about a quarter of the way through now and I'm not seeing any problems with it. 

I tried downloading a really early version and running it.  I couldn't make it past one loop without getting bad data from the Nano.   Even if I don't end up using any of these new commands, these updates you have made appear to be a substantial improvement in making the Nano more robust.   


************************************

Your latest version passed the regression test without any errors.   There are commands that I don't currently support as I havn't found a use for them.  Also, the order the commands are sent is  pretty much the same as I would use when normally talking with the Nano.   The fact it doesn't detect a change in the this new version and your previous one should give you some idea how primitive the tests are.   

I made a couple of custom transfer relays for the Nano, both with poor performance.   One uses GaAs.  I've thought about using this relay (which would not wear out) to allow me to enhance my tests.  Currently I just install a thru and do what I can with it. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 19, 2019, 12:40:10 pm
My point is from a user perspective.  Depending on the parameters passed down to the command, it may require minutes to run.  During that time, nothing is happening on the Nano.  The PC can't detect if it's doing anything.  The LED that normally would show that it is scanning, doesn't appear to be used.  For all practical purposes, it appears dead. 

This is done intentionally. LED blinking leads to a small power supply voltage fluctuations due to Ohm's law, which leads to a little voltage jumps for SA602 mixers and ADC REF power supply. Also it leads to noise from rise and fall pulses.

Power supply purity is critical when you deal with 80-90 dB range signals. This is why LED is off during measurement, to eliminate redundant noise source.

You can check that device still alive by monitoring data transfer through USB port. If device sends you a lot of data, it cannot be dead :)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 19, 2019, 01:32:28 pm
My point is from a user perspective.  Depending on the parameters passed down to the command, it may require minutes to run.  During that time, nothing is happening on the Nano.  The PC can't detect if it's doing anything.  The LED that normally would show that it is scanning, doesn't appear to be used.  For all practical purposes, it appears dead. 

This is done intentionally. LED blinking leads to a small power supply voltage fluctuations due to Ohm's law, which leads to a little voltage jumps for SA602 mixers and ADC REF power supply. Also it leads to noise from rise and fall pulses.

Power supply purity is critical when you deal with 80-90 dB range signals. This is why LED is off during measurement, to eliminate redundant noise source.

You can check that device still alive by monitoring data transfer through USB port. If device sends you a lot of data, it cannot be dead :)

It may take minutes for it to start to send data.   I didn't try to see how far I could push it out but I tried it at around 1 minute, 45 seconds and it did eventually respond with data.   
scanraw 0 10000 10000 101 1000

Plug in the wrong parameters and there is no way I know of to abort it.  Still, if what I am seeing is actually correct, that's 1000 sweeps in 105 seconds or around 10X faster than what we have today. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 19, 2019, 02:43:04 pm
It may take minutes for it to start to send data.

no, scanraw command starts to send data immediately. There is no memory to store all points, so it needs to send each measured frequency to PC.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 19, 2019, 02:58:40 pm
It may take minutes for it to start to send data.

no, scanraw command starts to send data immediately. There is no memory to store all points, so it needs to send each measured frequency to PC.

Odd. That's not what I see with a dumb terminal. 

Using scanraw 0 10000 10000 1000 1000 requires about 17 minutes before the Nano responds.   1Hz with 10X the data.     

I sent something like scanraw 0 10000 1 1000000 10.   I assume it's been crunching on it for over 45 minutes now.  During this time, I have tried sending various commands to see if it would respond to anything but it appears not to.  The touchscreen has no effect.   

While you may not perceive these as valid use cases for your command, if that's true you need to limit the parameters that can be sent to it and document these limits. 

***
I had assumed you accumulated the data for the average then did a simple divide before sending.   It sounds like this may not be the case and it may be something other than an average. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 19, 2019, 03:30:02 pm
Odd. That's not what I see with a dumb terminal. 

Using scanraw 0 10000 10000 1000 1000 requires about 17 minutes before the Nano responds.

just tried. It responds in 1 second and sends each frequency step with about 1 second interval. Probably your terminal has some kind of buffering or cache. Try PuTTY
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 19, 2019, 04:09:54 pm
That's really odd.   The scanraw 0 10000 1 1000000 1 required well over an hour before it responded.    Again Nano is locked up from a user perspective this entire time.   

How should it work then?  For the case of scanraw 0 10000 10000 1000 1000, does it do 1000 sweeps at each discrete frequency, do the division then send that one frequency?   

I just tried Tera Term and sure enough, it is sending something.   I still see no way to abort it.  It doesn't appear to respond to any commands until it is finished.   
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 19, 2019, 04:35:17 pm
That's really odd.   The scanraw 0 10000 1 1000000 1 required well over an hour before it responded.    Again Nano is locked up from a user perspective this entire time.

This is problem with your terminal application. There is no delay. The first response takes about 0.5 second.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 19, 2019, 04:38:04 pm
How should it work then?

scanraw 0 10000 1 1000000 1 works in the following way:

- measure frequency 10000 Hz
- send measured data to PC
- measure frequency 10001 Hz
- send measured data to PC
- measure frequency 10002 Hz
- send measured data to PC
...

if you requested 1000000 points it can take long time :)


Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 19, 2019, 05:33:37 pm
How should it work then?

scanraw 0 10000 1 1000000 1 works in the following way:

- measure frequency 10000 Hz
- send measured data to PC
- measure frequency 10001 Hz
- send measured data to PC
- measure frequency 10002 Hz
- send measured data to PC
...

if you requested 1000000 points it can take long time :)

Is there a reason you don't want to discuss the average?   Or am I not being clear when I am asking how the average works? 

And, is there a way to abort it? 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 19, 2019, 06:56:36 pm
Is there a reason you don't want to discuss the average?

Average works in usual way. For example average 3x is specified.
Then it performs 3 measurements: a1, a2, a3.

each measurement is complex, it includes real and imag part.

the result will be calculated in the following way:
real part = ( real(a1) + real(a2) + real(a3) ) / 3
imag part = ( imag(a1) + imag(a2) + imag(a3) ) / 3

And, is there a way to abort it?

yes, you can abort it with power off NanoVNA  ;D
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 19, 2019, 07:50:03 pm
Is there a reason you don't want to discuss the average?

Average works in usual way. For example average 3x is specified.
Then it performs 3 measurements: a1, a2, a3.

each measurement is complex, it includes real and imag part.

the result will be calculated in the following way:
real part = ( real(a1) + real(a2) + real(a3) ) / 3
imag part = ( imag(a1) + imag(a2) + imag(a3) ) / 3

And, is there a way to abort it?

yes, you can abort it with power off NanoVNA  ;D
Hang in there.  It's slowly sinking in.   

After some trial and error, it seems you limit the number of accumulations to 1000.  1001 errors out.   For a single sample with averages set to 1000,  scanraw 0 10000 1 1 1000, it seems as though you can read at about 1KHz.  So, for 100 samples, can it sweep at 10Hz without averaging?    At least running it with the Tera Term and sending scanraw 0 10000 1 101 1,   it doesn't appear so.    I wonder is the poor update rate really the time it takes to sweep (perhaps limited by the loss of lock)  or is it the data rate. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 19, 2019, 08:14:00 pm
sweep requires change frequency. Change frequency needs for wait PLL lock, etc.

Average don't needs to change frequency. It just needs to get more samples. This is why it works much more faster than usual sweep.

scanraw works pretty fast for usual measurements. If you want realtime fast sweep several times per second, I think NanoVNA cannot do that, because there is needs some time for pll lock, for channel switch, for gain stabilization, etc.

Average don't needs to switch channel, don't needs to change gain, don't needs to change frequency and don't needs to wait for PLL lock. This is why it can measure several samples more fast.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 19, 2019, 10:36:32 pm
Thank you for all the information. 

Does your new firmware wait for the lock status?   

Have you looked into the purpose of the other two commands (threshold & transform) you added?   If so, could you provide a brief description?   
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 19, 2019, 11:37:42 pm
Does your new firmware wait for the lock status?   

yes, it check hardware status of PLL lock. In, comparison original edy555 firmware just use some delay with no actual check for hardware PLL status. The idea to check PLL status was introduced on this thread by user radioactive (https://www.eevblog.com/forum/profile/?u=250409).

Have you looked into the purpose of the other two commands (threshold & transform) you added?   If so, could you provide a brief description?

These commands were added by edy555 in original firmware it will be available in the next edy555 firmware release. It just merged to NanoVNA-Q.

"threshold" command allows to change frequency threshold for 1-st harmonic. By default it uses 300 MHz threshold. Bad quality si5351 chips cannot work at 300 MHz. In such case you can decrease threshold.

"transform" command just a console command for DISPLAY => TRANSFORM menu. It enables TDR mode on NanoVNA.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 20, 2019, 01:35:06 pm
Your lock check routine appears to only be used when changing ranges.  Others appear to use a fixed delay time. 

I tried to download your latest files and now see this error:

./NANOVNA_STM32_F072/board.h:49:8: error: unknown type name 'uint32_t'
 extern uint32_t dfu_reset_to_bootloader_magic;
        ^~~~~~~~

Looks like you have been busy.   Lot's of changes.....
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 20, 2019, 04:17:45 pm
I tried to download your latest files and now see this error:

./NANOVNA_STM32_F072/board.h:49:8: error: unknown type name 'uint32_t'
 extern uint32_t dfu_reset_to_bootloader_magic;
        ^~~~~~~~

interesting. I don't have such error, some compiler dependent issue.
You can solve it by adding this line at the top of board.h file:
Code: [Select]
#include <stdint.h>
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 20, 2019, 04:47:13 pm
I tried to download your latest files and now see this error:

./NANOVNA_STM32_F072/board.h:49:8: error: unknown type name 'uint32_t'
 extern uint32_t dfu_reset_to_bootloader_magic;
        ^~~~~~~~

interesting. I don't have such error, some compiler dependent issue.
You can solve it by adding this line at the top of board.h file:
Code: [Select]
#include <stdint.h>

Thanks.  After adding, it builds without any other changes.   It's running the regression now. 

*****

Passes.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 22, 2019, 02:37:47 am
I connected my home made GaAs transfer relay to the nano with two different loads.  I then toggle between the two, collecting and plotting the data while in each state.   The firmware I am using is the one I mentioned in the previous post, so I assume it will have whatever fix was specifically added to try and address the out of sync problem.   

You can see there are two discrete lines for the two states.  If the firmware or my software were to fall out of sync, these two lines are going to swap positions.

This is using my normal method of start, stop, data0, toggle and repeat.   Again, I have never had this be a problem when I use my segmented sweep and am not expecting to find anything.  I'll let it run overnight. 

It's possible that something else was wrong but because of how I talk with the nano, I never run into it. 


**** 

I had the wrong data being plotted, but caught it before calling it a day.   It ran all night and never fell out of sync.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 23, 2019, 10:42:49 am
Showing test setup and data from the toggle test.   I am not sure what was going on with the 500 ohm being bimodal towards the end.  It gets a bit of an offset and higher noise.  Maybe something being coupled in from the PC. 
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 23, 2019, 05:23:21 pm
Showing test setup and data from the toggle test.   I am not sure what was going on with the 500 ohm being bimodal towards the end.  It gets a bit of an offset and higher noise.  Maybe something being coupled in from the PC.

probably this is charge controller from NanoVNA. It is a little noisy and you can notice significant offset when usb charger is connected to NanoVNA.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 24, 2019, 12:05:27 am
I would expect with it plugged into the USB while running it, if it was low we would have seen it charge early on in the data set, not towards the end.  Still, it's certainly possible. 

What is the thread safe display about? 

Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 24, 2019, 01:30:18 am
it allows to use display from different threads of NanoVNA firmware. Technically it allows to get screenshot from almost any device state, for example now you can get screenshot with numpad, or version screen. Old firmware doesn't allow that. :)

In addition, these issues related with data modification from different threads are fixed. Now it will not get you garbage if two threads trying to modify the same memory simultaneously. Unfortunately, not all issues are fixed. Actually, original firmware was overcrowded with these thread collision issues. Fix of some issues may leads to slow down PC data transfer due to poor data transfer protocol. I cannot change it, because it will break backward compatibility. So, I leave some issues unfixed in order to support backward compatibility and fast data transfer.

In overall, I feel the whole code needs to be rewritten. Because there are whole black holes full of bugs. For example, try to press joystick for long time on START/STOP menu in the STIMULUS. It will open numerical editor, which currently don't works properly. I have fix, but it pulls a buch of another changes. So, I just shelved these fixes. It will take a lot of time and I'm not sure that I want to spend time on that :)

I feel that I want just to fix major issues and the rest of issues leave as is. Because it already works good enough :)

PS: forgot to say, numpad frequency rounding error is fixed. Now you can enter 123456789 Hz on NanoVNA numpad and it will be exactly 123456789. In old versions it was rounded to 123456792. Annoying bug. But now it works as expected :)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 24, 2019, 02:31:46 am
Thanks for the description.  I'm not understanding what you mean by a screen shot.   Are you suggesting there is a way to do screen captures of the Nano from the PC? 

Personally, I think you've done a great job getting it as stable as it is.   My software is fairly simple and doesn't take advantage of most of the new features.  Combined with seldom running it standalone,  this may be why I'm not finding problems with your later versions.       

I would still like to see the Nano scan faster but I don't see it as a major issue.   If you decided to go after it, I would attempt to support it.   

It's funny to hear your concerned with few Hz error.   Having used my old HP VNA, I can't control it anywhere near that.  There's no way to control the start, stop, center or span from the software.  Even from the panel, it's not accurate.   The only thing I can do with the PC is download the data from it.   The Nano being 40 years newer, is far more advanced. 


Quote
Quote
"transform" command just a console command for DISPLAY => TRANSFORM menu. It enables TDR mode on NanoVNA.
Could you please walk though the steps on how to use it?   
I was missing that real needs to be selected.   
Title: Re: NanoVNA Custom Software
Post by: ted572 on October 26, 2019, 12:58:46 am
Hello  'radiolistener':
A little over a month ago I installed newer firmware in my NanoVLA per your instructions here -> https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2701026/#msg2701026 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2701026/#msg2701026)
First of all I would like to thank you again for all the assistance you provided, and I was able to successfully install version 0.1.1.9 firmware, also others below this level.  Although this is where it has stopped for me, as I'm not able to fully install any 0.2.x or 0.3.x versions.  It seems to install, and it reports that it was installed, although when I select the menu, and them select a individual menu item, the whole menu just disappears.  Gonski!  So I'm unable to Cal. the unit, see version info, or do anything else with it.  Although earlier versions, and 0.1.1.9 does works Ok (with a few miner bugs) and of course up to 1.5 GHz.  By the way I had some other issues here that has taken all my time until now, and I have been re-visiting this with no results to date.  I'm still able to go back and reinstall ver. 0.1.1.9 after several failed attempts with newer firmware. 

Do you (or anyone else please) have any thoughts on what could cause this inability to install more recent firmware?  Any suggestions to try wold be appreciated.   Thank you in advance, Ted
Edit - PS: I have been using your method '2) ST-LINK update', and have also tried '1) DFO update'.  Neither works for me with the newer FW.
Title: Re: NanoVNA Custom Software
Post by: xrunner on October 26, 2019, 01:12:16 am
Try the attached file which clears all memory, then try the latest firmware. Hope it helps.
Title: Re: NanoVNA Custom Software
Post by: ted572 on October 26, 2019, 01:33:59 am
Hello xrunner:
Wow! That did it for me.  Thank you so very much.  I had supposedly previously cleared the firmware area a couple of times thinking that would have possibly helped.  Any way your file did the job.   Thanks, Ted
Title: Re: NanoVNA Custom Software
Post by: xrunner on October 26, 2019, 01:38:40 am
Cool!

[attachimg=1]
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 26, 2019, 02:08:19 am
Do you (or anyone else please) have any thoughts on what could cause this inability to install more recent firmware?  Any suggestions to try wold be appreciated.   Thank you in advance, Ted

it looks like you're forgot to clean up settings after update. You can do it with console command

Code: [Select]
clearconfig 1234
Just run PuTTY, select Serial connection and enter COM port name with NanoVNA. Connect and execute this command. It will clean all settings. After that do power off and power on. That's it.

Some peoples doing clean memory with CLEAR.DFU file. But this way is not reliable. Execute clearconfig is more reliable way.

After cleanup, you're needs to do touch calibration, enter to CONFIG menu and select TOUCH CAL. Then check your touch calibration with TOUCH TEST menu. If it works ok, then save this touch calibration with menu SAVE.

After that, just setup frequency range in STIMULUS menu and do usual calibration.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 26, 2019, 09:09:42 am
it looks like you're forgot to clean up settings after update. You can do it with console command

Code: [Select]
clearconfig 1234

*Manual* reset of data which is made invalid by data-related changes in firmware can be easily avoided. Usually it is done by saving firmware data format version along with data (settings/calibration), comparing it upon startup. When no match - reset automagically, just notify user, or maybe not.
Title: Re: NanoVNA Custom Software
Post by: radiolistener on October 26, 2019, 01:14:31 pm
*Manual* reset of data which is made invalid by data-related changes in firmware can be easily avoided. Usually it is done by saving firmware data format version along with data

it's already present. But it seems that some old firmware had different data structure, but the same version code. I think you're right it will be better to change version for different firmware, even if it uses the same data structure.
Title: Re: NanoVNA Custom Software
Post by: ogden on October 26, 2019, 01:35:56 pm
it seems that some old firmware had different data structure, but the same version code
You may avoid that mistake by simply introducing new version code disregarding fact that structure is not changed. [edit] Data contents (compatibility) change also shall be versioned, not only structure change.
Title: Re: NanoVNA Custom Software
Post by: battlecoder on October 28, 2019, 04:55:21 am
Thanks radiolistener! I've been following this thread for a while, waiting for my nanoVNA to arrive.
I finally got mine a couple of weeks ago, and thanks to all the information you've shared here I was able to update my nanoVNA to a more recent firmware version!

I was also able to fix the battery indicator by soldering D2 on the board. I have to admit I didn't have the diode specified in the schematics, so I used a thru-hole 5817 that I managed to solder on the pads by clipping and bending the diode legs against its body, similar to a DO-214 package. I figured the only important spec was low Vf, and that's the diode with the lowest forward voltage I had. I'm not 100% sure if it's a good choice for that application, but for the time being it seems to work.
Title: Re: NanoVNA Custom Software
Post by: Jacon on October 28, 2019, 06:16:04 am
Hi battlecoder,

You should subscribe to this board ASAP:

https://groups.io/g/nanovna-users (https://groups.io/g/nanovna-users)

It's really the main place of info, help & devel works for this marvelous unit  :)
Title: Re: NanoVNA Custom Software
Post by: ted572 on October 29, 2019, 11:57:26 am
The NanoVNA menu can be like working in the dark searching for where to go next.  That is until you get used to it, and appreciate it’s features and very easy operation.  So for a kick start and a reminder, I made this PDF Table of the Menu Options in the NanoVNA with Firmware (edy555) 0.3.1 (the latest). Please let me know if you find any errors or missing info.
Title: Re: NanoVNA Custom Software
Post by: Jacon on October 29, 2019, 05:34:26 pm
...  So for a kick start and a reminder, I made this PDF Table of the Menu Options in the NanoVNA with Firmware (edy555) 0.3.1 (the latest). Please let me know if you find any errors or missing info.

This, IMHO, is the most actual, accurate & convenient Menu info page:
https://oristopo.github.io/nVhelp/html/Menu.htm (https://oristopo.github.io/nVhelp/html/Menu.htm)

Oristo prepared quite comprehensive docu page also:
https://oristopo.github.io/nVhelp/html/nVhelp.htm#U0 (https://oristopo.github.io/nVhelp/html/nVhelp.htm#U0)
Title: Re: NanoVNA Custom Software
Post by: bradley1evblog on November 16, 2019, 12:00:58 pm
Hello Joe, I'm new to the nanovna but delighted with the product. I'm trying to find your Nano Custom Software (for a pc) as shown in your video .... is it available for download anywhere?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 16, 2019, 07:20:39 pm
Hello Joe, I'm new to the nanovna but delighted with the product. I'm trying to find your Nano Custom Software (for a pc) as shown in your video .... is it available for download anywhere?

Bradley,  while I have not released my software there are a few open source projects being worked on that may work well for you.  I can't say I have personally tried any of them but I suspect they are much closer to what you would want from a software interface than what I put together for doing my own evaluation of the Nano.   

As I have stated a few times, mine is really more of an engineering research tool than anything.  It supports some hardware to run specific tests that the average user is not going to have access to.   It's also become a lot more complex over time and I have yet to put any sort of manual together for it. 

I was going to make one last video showing some of the latest features and maybe provide some additional ideas to those creating the open source code but I lost interest in the project.   If you find that the open source projects are lacking in some way, I suggest you politely ask the authors and see if they will support you. 

Enjoy your Nano.   It is a pretty nice device, especially at the $50 price.   
Title: Re: NanoVNA Custom Software
Post by: pa3hfu on November 29, 2019, 04:52:48 pm
I installed VNASaver on my iMac. Installation was succesful. But when I connect my unit by USB and click connect to NANOVNA I get this failure:

MacMini-I:.config mathieuverhorst$ cd nanovnasaver
MacMini-I:nanovnasaver mathieuverhorst$ nanovnasaver
NanoVNASaver 0.2.0
Copyright (C) 2019 Rune B. Broberg
This program comes with ABSOLUTELY NO WARRANTY
This program is licensed under the GNU General Public License version 3
See https://github.com/mihtjel/nanovna-saver for further details
Settings: /Users/mathieuverhorst/.config/NanoVNASaver/NanoVNASaver.ini
2019-11-28 11:40:42,308 - NanoVNASaver.NanoVNASaver - ERROR - Tried to open  and failed: [Errno 2] could not open port : [Errno 2] No such file or directory: ''

What can be wrong?
If I cannot connect to my Mac, I even cannot update my VNA-f in the future...
Thanks in advance again!!
Title: Re: NanoVNA Custom Software
Post by: radiolistener on November 29, 2019, 10:38:18 pm
pa3hfu, I'm not sure if NanoVNA-F is compatible with NanoVNA-SAVER, but your error looks like you have issue with port name. It may be related with missing driver or bad USB connection.
Title: Re: NanoVNA Custom Software
Post by: pa3hfu on November 30, 2019, 05:40:11 pm
Thanks RadioListener,  It was a bad USB connection. Another cable ==> succes!!  :D
Title: Re: NanoVNA Custom Software
Post by: ted572 on December 07, 2019, 02:10:33 am
RF Demo Kit - NanoVNA Test Networks Data
The following PDF provides information on the RF Demo Kit manufactured by SYSJOINT.CON, EEPELEC.COM, etc. This document describes the required VNA settings (of course not just the NanoVNA) to duplicate the response cures depicted on the unit's PCB for each RF circuit.
Edit: Without this type of information the RF Demon Kit is of very little value, if any for a novice.  Although with it you can verify that your VNA (any type/model) is working properly, and the RF Demo Kit then can also assist with learning how to use a VNA for measuring low value LC (i.e. uH, pF) components, use of a Smith Chart, etc, in addition to simply Antenna SWR.
Note: I’m not affiliated with any eBay seller of the RF Demo Kit, and in fact I held off posting this for a month or so because I didn’t want them to use this info to sell their product. But I caved and decided to share it with other users that may be interested. Although this is not rocket science, and anyone with a VNA could have done this very easily.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on January 25, 2020, 05:56:20 pm
Just an update.

I've had a few people ask me about how the Nano compares with other VNAs.  I will ask for specifics but it seems to be a more general question in general.  I think the last person asked about reliability and I responded that I had the Nano for a few months but my old 8754A has spanned five decades now and still running.  (with the original capacitors BTW lol) 

I see where there continues to be an effort to produce a 3GHz pocket VNA that doesn't use harmonics.  If they come up with a product, I plan to have a look.   

Playing with the Nano may end up costing me a chunk of change as it's rekindled my interest in replacing my old VNA.  I am reading up on the more common instruments available today.       

I was thinking that I may do some sort of video that compares these four systems.   Obviously reliability can't be a metric but if you have something you would like to see, feel free to chime in. 

A few things off the top of my head are noise, cost, features, noise, stability, accuracy, noise, dynamic range, ease of interfacing it with a PC, noise and sweep rates.   I may do something with noise while I am at it.   
Title: Re: NanoVNA Custom Software
Post by: ogden on January 25, 2020, 06:52:13 pm
Main difference between two: 8754A is instrument with certain and defined accuracy, NanoVNA is "low cost tool". Latter is more like pocket DMM which BTW is sold w/o proper enclosure, another - benchtop multimeter with (possibly valid) calibration sticker on it. Both have their use.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on January 25, 2020, 09:10:19 pm
While it wouldn't take much to improve on my old HP,  I would like to find something that will support lower frequencies (<1MHz) and faster data rates to the PC.  I dare say without the Labview interface, the old HP would be worthless as I no longer have a grease pen to write on the screen.    With Windows 10, I now need to run it under a virtual XP box and I can't see investing the time to do this.   I want to get something new enough to at least support Ethernet.    Thinking something along the lines of the old Agilent PNAs like this one:

https://www.ebay.com/itm/Agilent-PNA-E8358A-300kHz-9GHz-2-Port-4-Receiver-RF-Vector-Network-Analyzer-015/223568031067?hash=item340db16d5b:g:rw4AAOSwK0ldFTxx (https://www.ebay.com/itm/Agilent-PNA-E8358A-300kHz-9GHz-2-Port-4-Receiver-RF-Vector-Network-Analyzer-015/223568031067?hash=item340db16d5b:g:rw4AAOSwK0ldFTxx)

I've been reading the manuals and like the system but they do seem to have some high asking prices for them.   
Title: Re: NanoVNA Custom Software
Post by: DH1AKF_Wolfgang on January 26, 2020, 10:28:46 am
Please look here:
https://groups.io/g/nanovna-users/wiki/shellcommands (https://groups.io/g/nanovna-users/wiki/shellcommands)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on January 26, 2020, 04:07:06 pm
Please look here:
https://groups.io/g/nanovna-users/wiki/shellcommands (https://groups.io/g/nanovna-users/wiki/shellcommands)

If there is something specific you would like me to have a look at, just upload it here or to Google docs.   

I have to be registered to gain access to this area.  I was a member for a very short time.  The majority of posts were about how to print a case for it.    There were very few technical discussions and so I left. 

That ebay listing advertises "Fully Functional,  aligned with test data", but we can clearly see one of the source attenuators is damaged.   


https://www.ebay.com/itm/Agilent-PNA-E8358A-300kHz-9GHz-2-Port-4-Reciever-RF-Vector-Network-Analyzer/273440234503?_trkparms=aid%3D1110001%26algo%3DSPLICE.SIM%26ao%3D2%26asc%3D20160323102634%26meid%3Df1cbcf5bc5c74606920468d8c5276bd9%26pid%3D100623%26rk%3D2%26rkt%3D6%26sd%3D223568031067%26itm%3D273440234503%26pmt%3D0%26noa%3D1%26pg%3D2047675&_trksid=p2047675.c100623.m-1 (https://www.ebay.com/itm/Agilent-PNA-E8358A-300kHz-9GHz-2-Port-4-Reciever-RF-Vector-Network-Analyzer/273440234503?_trkparms=aid%3D1110001%26algo%3DSPLICE.SIM%26ao%3D2%26asc%3D20160323102634%26meid%3Df1cbcf5bc5c74606920468d8c5276bd9%26pid%3D100623%26rk%3D2%26rkt%3D6%26sd%3D223568031067%26itm%3D273440234503%26pmt%3D0%26noa%3D1%26pg%3D2047675&_trksid=p2047675.c100623.m-1)

I was thinking, pay a little more and you could get a working one.     We can see "Seller refurbished: An item that has been restored to working order by the eBay seller or a third party not approved by the manufacturer. This means the item has been inspected, cleaned, and repaired to full working order and is in excellent condition."   Again, slide down to the diagnostics page and we can see the unit fails the diagnostics. 

Most listings don't offer any details so it's a pretty high risk for such an old system that is no longer serviced and parts may be difficult to locate. 

I haven't looked at what they are actually selling for yet but  for a 20 years old, damaged unit,  the prices see way off.    Maybe time for some very low offers.   
Title: Re: NanoVNA Custom Software
Post by: Roger Need on January 30, 2020, 10:50:33 pm

I have to be registered to gain access to this area.  I was a member for a very short time.  The majority of posts were about how to print a case for it.    There were very few technical discussions and so I left. 


Joe,

The groups.io nanaovna users group has changed a lot since you first saw it. High SNR now... 

There a now a lot of people with extensive VNA experience posting good technical stuff at a high level.  Some are VNA calibration commercial vendors and one is developing a new low cost VNA's that go up to 3.5 GHz for $100 USD (just went into production) . Hugen who made the nanovna so popular by creating an assembled product posts from time to time as well as several authors who have created forked firmware and software for the device.  There is also an extensive wiki on all facets of software, hardware and documentation plus many informative user manuals. 

Roger
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on January 31, 2020, 01:43:26 pm

I have to be registered to gain access to this area.  I was a member for a very short time.  The majority of posts were about how to print a case for it.    There were very few technical discussions and so I left. 


Joe,

The groups.io nanaovna users group has changed a lot since you first saw it. High SNR now... 

There a now a lot of people with extensive VNA experience posting good technical stuff at a high level.  Some are VNA calibration commercial vendors and one is developing a new low cost VNA's that go up to 3.5 GHz for $100 USD (just went into production) . Hugen who made the nanovna so popular by creating an assembled product posts from time to time as well as several authors who have created forked firmware and software for the device.  There is also an extensive wiki on all facets of software, hardware and documentation plus many informative user manuals. 

Roger
Good to hear that the group has evolved.   

In my first post, I had mentioned the plan was to compare the 3GHz unit with a few others once it becomes available.   As I mention, their Wiki appears locked for member's only.   So if there is anything specific people would want me to look at, they would need to make it publicly available.   

https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2887094/#msg2887094 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg2887094/#msg2887094)

There was a member here that was doing a fair amount of work on the firmware.  I haven't looked at their progress in a few months but the later versions I was testing were a lot more stable that anything else I had seen at the time.
Title: Re: NanoVNA Custom Software
Post by: RCinFLA on February 01, 2020, 01:06:42 am
You are basing this on ADC bits.  ADC bits is not the limiting factor on dynamic range.  It is the synthesizer, followed by harmonic mixing that is limiting dynamic range.

Also the lower maximum sampling rate of the TLV320 limits the frequency of the I.F. which in turn results in more sideband noise from the synthesizer which limits dynamic range.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 01, 2020, 03:01:06 am
You are basing this on ADC bits.  ADC bits is not the limiting factor on dynamic range.  It is the synthesizer, followed by harmonic mixing that is limiting dynamic range.

Also the lower maximum sampling rate of the TLV320 limits the frequency of the I.F. which in turn results in more sideband noise from the synthesizer which limits dynamic range.

I would have no way of knowing what this is in regards to.   Who is "you" and what was based on ADC bits? 
Title: Re: NanoVNA Custom Software
Post by: OwO on February 01, 2020, 04:05:24 am
Yes, so V2 uses the built in ADC on the GD32. The input noise floor is still far above the ADC's own noise floor so it was "free" cost savings. The bottleneck on S21 noise floor is the PSRR of the receive mixer and the fact that LF noise can't easily be filtered (and there is no power budget available for a linear regulator instead of a switching one).

The bottleneck on S11 trace noise is synthesizer phase noise, both the close-in noise (slow wobbling of the center frequency/phase) and the noise at the image frequency (f_RF + f_IF * 2). The close-in noise can be cancelled by the reference receiver, but the image noise can't. At 12kHz IF the two noise contributions are about the same, which means the noise improvement due to the reference receiver is only 3dB, which is why we went with a switched reference channel in V2.
Title: Re: NanoVNA Custom Software
Post by: profdc9 on February 01, 2020, 04:44:31 pm
May I make a suggestion?  Synchronize the data acquisition to the IF cycles, rather than free acquiring the IF because the microcontroller and the frequency synthesizer are on different clocks.  This also helps with phase noise.  The VNA I designed acquired four samples per cycle, so that one can do simple addition and subtract to get in-phase and quadrature components.  This is not presently done in the NanoVNA.  This will help reduce the sensitivity to phase noise and allow much longer integrations (smaller IF bandwidth) to achieve a lower noise floor if needed.

Also, I don't think the NanoVNA as built presently stays within the linear region of the mixer.  It overdrives the inputs of the SA612 severely.  The datasheet indicates the proper level of drive.  The RF pins should be much less than kT/q or 26 mV, usually 10 mV is the maximum desired drive.  The oscillator pins should be no more than 200 mV.  I stick with 100 mV to stay in the linear region.

Gilbert cells are good for RF receivers but their dynamic range is not that great because they only accept small signals.  The dynamic range in practice is determined by the noise voltage on the low-end (a few microvolts) up to the limit where the intermod products start to distort the mixing signal (about 10 mV).  EU1KY did a good job in his design because he maximized the signal available to the SA612 given these constraints.   The tests being done on the NanoVNA on open, short, load don't test this at all.  Try measuring 10000 ohms S11 in the HF or 1000 ohms at UHF and see what happens.  Don't make these mistakes again with a new design.

Also, it wouldn't hurt to have a proper fixture so that you can do these tests properly.  I designed one for my VNA.  Perhaps you could use that or make one of your own.  I very much tried to wring every bit of accuracy out of the VNA design even if it meant the data acquisition would be slow.

Anyways if any of this interests you, take a look at

http://github.com/profdc9/VNA (http://github.com/profdc9/VNA)
Title: Re: NanoVNA Custom Software
Post by: ogden on February 01, 2020, 05:05:31 pm
microcontroller and the frequency synthesizer are on different clocks
No they are not. In NanoVNA and NanoVNA.v2 everything related to signal path (mixers & ADC) is clocked from single source, si5351.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 01, 2020, 05:44:17 pm
https://www.rtl-sdr.com/a-nanovna-2-0-is-in-the-works-same-price-frequency-range-up-to-3-5-ghz-higher-dynamic-range/ (https://www.rtl-sdr.com/a-nanovna-2-0-is-in-the-works-same-price-frequency-range-up-to-3-5-ghz-higher-dynamic-range/)

In the above article, dated Oct 4th 2019, they mention initial sales in roughly 3 months.  I assume then that things are pretty much wrapped up with research/development and it is now in the production phase .   Is this correct, or is the project still in the design phase?
Title: Re: NanoVNA Custom Software
Post by: profdc9 on February 01, 2020, 11:53:24 pm
That doesn't mean that the acquisitions are synchronized so that the same part of each IF cycle is sampled.   How many clocks of the crystal on the SI5351A correspond to the RF and LO signals and the MCLK driving the codec and the microcontroller?  They are all on separate fractional dividers.  Being clocked from the same crystal is a necessary, but not sufficient, condition for the IF acquisition to be synchronized.  It doesn't take much error in the phase to limit your dynamic range, and the microcontroller needs to know the phase fairly precisely to demodulate the IF signal, especially if there no other signal indicating the relative phase relationship between the microcontroller's clock and the IF.

Anyways, do it or don't do it, it doesn't matter to me.  The NanoVNA is a result of groupthink.  There's not much verification of performance against real loads.  All of the emphasis is on precision, not accuracy.

https://groups.io/g/nanovna-users/topic/nanovna_real_resistance/33508471

You might want to understand the sources of error in the present NanoVNA before moving on to the next one.  The SI5351A is used out of spec up to 300 MHz and the SA612 is heavily overdriven.  What do you expect?  But since it seems its mostly used for testing whether antennas are matched or not, it's probably good enough for most of its users who have never used a VNA before and don't know what to expect.  I can't even get a straight answer to how to calibration works on the NanoVNA.  Is there anyone besides edy555 that knows how that works?  I sat down and derived the equations myself and tried to figure out how the NanoVNA firmware implements calibration.

Anyways no matter how it turns out that NanoVNA v2 will be a success, so there's no point in criticizing it.

Title: Re: NanoVNA Custom Software
Post by: OwO on February 02, 2020, 02:41:26 am
Yes I know what you are talking about. People on that list "verify" their calibration by remeasuring their short, open, and load. I suggested the coaxial stub test to check for linearity and so far only one person has done a proper test.
V2 is a separate effort and doesn't reuse anything from the original design. The IF signal's period is exactly 25 ADC clock cycles. The mixer is a high linearity one (over 20dBm IIP3) and is driven at least 20dB below P1dB. I posted some linearity and error magnitude calculations on the list where I concluded you must stay 20dB below IP3 and 10dB below P1dB to get reasonable EVM.
Title: Re: NanoVNA Custom Software
Post by: profdc9 on February 02, 2020, 05:48:11 am
Well it's good, if you're going to make a fresh start, it's better of course to not repeat mistakes.  I think some kind of fixture would be helpful, however, to go with the new VNA to verify its operation.  That way someone who receives it can verify it is working properly to spec.

I have used a zif socket, and if used carefully, can actually work up to about 500 MHz!  But that's not going to cut it for the V2, so think about a good set of standards and a fixture to go with it.  That will both help to create it and put to rest questions about its performance.  Even a simple PCB with a coplanar waveguide on it, something like this:

https://www.edn.com/pcb-fixtures-improve-component-measurements/ (https://www.edn.com/pcb-fixtures-improve-component-measurements/)

could be a big help.


Title: Re: NanoVNA Custom Software
Post by: ogden on February 02, 2020, 01:42:10 pm
That doesn't mean that the acquisitions are synchronized so that the same part of each IF cycle is sampled.   How many clocks of the crystal on the SI5351A correspond to the RF and LO signals and the MCLK driving the codec and the microcontroller?  They are all on separate fractional dividers.
Many commercial VNA's have multiple Fractional-N synthesizers as well. For example N5222 have three independent synths (RF LO, source1, source2). Only difference to NanoVNA - ADC clock of "commercial VNA" usually is not PLL-synthesized. BTW MCU&ADC of NanoVNA also can be clocked from "jitter-less clock", directly from XTAL (thru mode of SI5351A). Just knowing that any PLL have phase errors is not enough. Did you actually analyze impact of SI5351A phase noise on measurements?
Title: Re: NanoVNA Custom Software
Post by: profdc9 on February 02, 2020, 04:28:15 pm
If you put the IF on a scope, you can clearly see the jitter.  I don't have a spectrum analyzer to measure the phase noise in dBc/Hz but a zero-crossing detector clearly shows the edge of the pulse moving around.  If you have two high frequencies with very close fractional divider settings, as you would have when the difference between the RF and LO is a IF frequency a thousand times smaller or more, their mixing product will not repeat until the counters for both fractional dividers both run through their counts and realign.  A fractional divider guarantees that a fixed number of pulses of approximately the same length are produced per time interval, but some are pulses stretched a VCO cycle and others are not depending on the state of the fractional divider counter.  This means it might take many milliseconds with a 20-bit fractional divider for the output clock signal to repeat.  There will be beats between the two signals that will reoccur over the millisecond repeat intervals of the fractional divider counter of the two signals, which means the edge of the mixing product of the two clocks can move around on a time scale over milliseconds.  Depending on the state of the fractional divider counters when you start and end sampling, the phase of the signal may or not may not be what the microcontroller expects the signal to be and uses to demodulate the signal.   Some way for the microcontroller to know the phase of the IF signal, such as a zero-crossing detector or other trigger signal, could be helpful in ensuring repeatable measurements.  A fast XOR gate would be ideal for this purpose, or a zero-crossing comparator triggering off of the reference.


Title: Re: NanoVNA Custom Software
Post by: ogden on February 02, 2020, 05:03:13 pm
No need to seek for instruments or build them because you already got one - VNA itself. Just run thru calibration at single frequency for some time to gather "statistically enough" phase/magnitude readings. Phase spread bell curve (if any) will indicate phase measurement accuracy.
Title: Re: NanoVNA Custom Software
Post by: DH1AKF_Wolfgang on February 02, 2020, 05:20:34 pm
Please imagine, how this VNA works:
There are three mixers, all driven with the same frequencies f1 and f2.
IF = f2-f1 is constant.
All phase jitters in the IF are the same.
In addition, low-pass filters and  especially the FFT include calculations and give further average values. Your considerations of phase jitter do not lead to a meaningful result.

And keep in mind: This is a product for ham radio enthusiasts, not intended for professional use.
For antenna matching/measurement it is fully sufficient, also for tuning a filter or amplifier.

Title: Re: NanoVNA Custom Software
Post by: ogden on February 02, 2020, 05:35:46 pm
Please imagine, how this VNA works:
There are three mixers, all driven with the same frequencies f1 and f2.
IF = f2-f1 is constant.
All phase jitters in the IF are the same.
Incorrect. f1 and f2 are coming each from separate Fractional-N synthesizer (PLL-A & PLL-B), their jitter definitely are not the same.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 02, 2020, 06:57:21 pm
a product for ham radio enthusiasts, not intended for professional use.
For antenna matching/measurement it is fully sufficient, also for tuning a filter or amplifier.
My friend who gave me one wouldn't have any idea what amateur radio is, and I have no interest in it.   That certainly doesn't mean that we have no use for the Nano.  I would imagine any hobbyist experimenting with high speed designs that has never used a VNA could benefit from it.  As a minimum, it may help cement some  concepts.   IMO, it's a great product for anyone wanting to learn the basics.   
Title: Re: NanoVNA Custom Software
Post by: DH1AKF_Wolfgang on February 02, 2020, 08:14:21 pm
>> Incorrect. f1 and f2 are coming each from separate Fractional-N synthesizer (PLL-A & PLL-B), their jitter definitely are not the same.<<

Hello, Ogden, you misunderstood me.
My statement refers to the difference f1 - f2.
And to the averaging of the FFT.
Title: Re: NanoVNA Custom Software
Post by: ogden on February 02, 2020, 08:28:09 pm
>> Incorrect. f1 and f2 are coming each from separate Fractional-N synthesizer (PLL-A & PLL-B), their jitter definitely are not the same.<<

Hello, Ogden, you misunderstood me.
My statement refers to the difference f1 - f2.
And to the averaging of the FFT.
:-//

Please explain what you mean by saying "All phase jitters in the IF are the same", how there can be more than one jitter in the f1 - f2 difference. Are you sure you fully understand PLL synths?
Title: Re: NanoVNA Custom Software
Post by: profdc9 on February 03, 2020, 12:38:06 am
Ok, it looks like I opened up the can of worms in Pandora's box, or whatever mixed metaphor you like.

I am going to try to put an example forward.  Say the PLL VCO is 600 MHz, and we want the RF signal to be 10.25 MHz and the LO to be 10.26 MHz.  The integer divider for both the RF and LO signal is 58.  The fractional part for RF=10.25 MHz is 0.53658 and for the LO=10.26 MHz it is 0.47953.   The divided by 58 frequency is 10.34482 MHz and the divided by 59 frequency is 10.16949 MHz.  So we expect the RF signal to actually be at a frequency of 10.34482 MHz for 0.46342 of the time and 10.16949 for 0.53658 of the time.  Likewise, the LO frequency is at 10.34482 MHz for 0.52047 of the time and 10.16949 MHz for 0.47953 of the time.  While some of the pulses have a period of 96.7 ns, and others 98.3 ns, they must be interleaved so that the instantaneous IF beat frequency between RF and LO does not deviate too much.  I am not sure how the SI5351A actually interleaves the two sets of divided pulses, perhaps it uses a sigma-delta modulator?  Nevertheless, one can clearly see the period of the IF vary on the scope.  For a 3.333 kHz IF frequency (3rd harmonic) I see about 2-4 microseconds of jitter.  For a 300 microsecond period, that corresponds to 3 microseconds = 3.6 degrees or 0.0628 radians, which suggests an instantaneous frequency variation between 3.300 and 3.367 kHz, but it averages to 3.333 kHz.  Because the SNR of a single measurement is approximately 1/(radians) that would be a SNR of about 16 or 12 dB.  But if we integrate over many cycles, we can improve this by assuming the phase errors are independent.  Of course they aren't, and if you integrate assuming the correct third harmonic mean frequency (10 kHz) when you demodulate the phase errors ought to cancel out and the signal improvement should be better than assuming independent phase errors.  But if the instantaneous frequency of the IF is varying a little bit due to the fractional divider, say 1% or so, that does contribute some phase error to the demodulated signal.

I tried to deal with this problem by actually clocking the ADC using a zero-crossing detector.  However, there are probably better ways, or maybe the integration time is long enough in practice that this error source is negligible.  But it is not true that the period of the IF is constant but it does average out over a long interval.
Title: Re: NanoVNA Custom Software
Post by: Bud on February 03, 2020, 01:10:48 am
I posted some linearity and error magnitude calculations on the list where I concluded you must stay 20dB below IP3 and 10dB below P1dB to get reasonable EVM.

So much trouble to investigate something that has been known for ages, seriously ...?  ;)  :)
Title: Re: NanoVNA Custom Software
Post by: OwO on February 03, 2020, 03:16:28 am
Apparently not by the original developers of the Nano which drives the mixers close to P1dB.
Title: Re: NanoVNA Custom Software
Post by: OwO on February 03, 2020, 03:22:51 am
Above 140MHz on the V2 the si5351 is unused and there are no fractional dividers on the RF path or ADC clock path. The MCU and ADC are NOT clocked by the si5351. They are driven by a clock buffer that is sourced directly from the TCXO. The si5351 has lots of spurs on its output but the phase error only becomes noticeable above 200MHz, so we switch to the ADF4350 as low as possible.
Title: Re: NanoVNA Custom Software
Post by: ogden on February 03, 2020, 07:20:12 am
I am going to try to put an example forward.  Say the PLL VCO is 600 MHz, and we want the RF signal to be 10.25 MHz and the LO to be 10.26 MHz.  The integer divider for both the RF and LO signal is 58.  The fractional part for RF=10.25 MHz is 0.53658 and for the LO=10.26 MHz it is 0.47953.   The divided by 58 frequency is 10.34482 MHz and the divided by 59 frequency is 10.16949 MHz.  So we expect the RF signal to actually be at a frequency of 10.34482 MHz for 0.46342 of the time and 10.16949 for 0.53658 of the time.  Likewise, the LO frequency is at 10.34482 MHz for 0.52047 of the time and 10.16949 MHz for 0.47953 of the time.  While some of the pulses have a period of 96.7 ns, and others 98.3 ns, they must be interleaved so that the instantaneous IF beat frequency between RF and LO does not deviate too much.  I am not sure how the SI5351A actually interleaves the two sets of divided pulses, perhaps it uses a sigma-delta modulator? 
Your whole "explanation" is fundamentally wrong from very beginning where you assume that both VCO's are tuned to exact same frequency out of specified 600..900MHz range. Granularity of Fractional-N synth frequency steps is good enough to avoid fractional ratios of output divider meaning everything you just explained do not apply. Hopefully OwO can elaborate here.
Title: Re: NanoVNA Custom Software
Post by: ogden on February 03, 2020, 07:25:49 am
The MCU and ADC are NOT clocked by the si5351. They are driven by a clock buffer that is sourced directly from the TCXO.
Don't you use internal PLL of MCU? - STM32 have inherent clocking architecture flaw - when ARM/bus clock source is PLL (which indeed have phase noise), you can't clock ADC directly from XTAL. Dunno about GD.
Title: Re: NanoVNA Custom Software
Post by: OwO on February 03, 2020, 07:41:02 am
Yes, the ADC is clocked from the internal PLL. It's integer N, and probably has no good phase noise, but in our tests it was still found that the ADF435x phase noise dominated (you can see an almost linear increase of phase noise floor as RF frequency is increased; ADC sampling jitter would be independent of RF and LO frequency changes).

Above 100MHz the si5351 operates with a fixed output divider of 6. Below 100MHz the fractional divider is indeed used and it's done this way to get more frequency precision. My original code actually tried to use the same output divider for RF and LO, while mainly using the multiplier (feedback divider) to set frequency, but this resulted in slower lock times and slow sweep rates.

However, there is speculation that the si5351 fractional dividers aren't just dumb ones that switch between N and N+1, but also has a programmable delay network to correct the output edge timing. I'm not sure if this is true (and the datasheet doesn't talk about it), but I'm inclined to believe it based on the observed spur floor. I've used chips with a dumb fractional divider before and they produced far higher spurs.
See: https://groups.io/g/BITX20/message/29001
Title: Re: NanoVNA Custom Software
Post by: OwO on February 03, 2020, 07:58:25 am
There are a lot of differences in the RF and DSP design between the V2 (S-A-A) and the original Nano, because S-A-A is not actually based on the Nano. S-A-A was designed before the Nano hit the market, and we already had all the basic VNA infrastructure. The timeline is like this:
- Early 2019 - S-A-A-1 was designed as a 1-200MHz antenna analyzer using a si5351, no LCD and only USB interface, to retail for $20.
- May 2019 - NanoVNA began selling on taobao, but the news hasn't yet gotten to us
- Aug 2019 - NanoVNA becomes popular outside of China, and I first hear about it. I immediately inform our client and hold a meeting about direction.
- Sept 2019 - It is decided that S-A-A must go up to 3GHz to compete. The design rework starts and we make a decision to integrate the NanoVNA's UI.
- Dec 25 2019 - Design work meets spec at iteration 2 (the third iteration). Firmware and software are also in usable shape.
- Jan 2020 - We submit final designs to client and give the green light to manufacturing. Software and firmware work continues.

The S-A-A-2 started off as a separate project unrelated to the Nano, but we have integrated the UI from the Nano (and fixed a shitload of bugs). Unfortunately I can't upstream these bugfixes because the refractoring included a port to C++17, switching all code to use std::complex, and quite a bit of rework of the UI event handling and drawing code. Of the bugfixes there were stack corruptions, drawing bugs, basic math (geometry) errors (which caused the persistent old traces on screen) etc.
Title: Re: NanoVNA Custom Software
Post by: ogden on February 03, 2020, 10:07:51 am
Above 100MHz the si5351 operates with a fixed output divider of 6. Below 100MHz the fractional divider is indeed used and it's done this way to get more frequency precision.
I see. That's because you match IF frequency precisely. IMHO performance of MCU is good enough to calculate sincos coefficients on the fly (using cordic), thus relaxing IF frequency precision requirements so you can use integer dividers for < 100MHz as well. Just saying.
Title: Re: NanoVNA Custom Software
Post by: profdc9 on February 03, 2020, 03:52:17 pm
Regardless of the source of the jitter of the SI5351A, and unless an engineer from Silicon Labs is going to chime in here, you might want to do the measurement I did and see how much the IF period varies before you decide it's not a problem.  By triggering the acquisition off the zero-crossing and sampling at four times IF, I can get away with four Fourier coefficients: 1, j, -1, -j and so all of the quadrature demodulation can be performed using additions and subtractions.  No guessing at the phase relationship of various PLLs both internal or external to the microcontroller.  And by synchronizing, I can integrate a smaller signal with a small IF bandwidth so I don't have to greatly overdrive the SA612 to obtain enough signal, even though the acquisition takes longer.  It's the same principle used for a lock-in amplifier which is able to accumulate signals with a very low SNR.

I am not sure any of the people who use the NanoVNA care about this, or care about the accuracy of their instrument, because for $50 they will like whatever they get.  I wanted to put together something that used as many commodity parts as possible so that it does not become obsoleted like so many other antenna analyzers or VNAs in the past, be easily built without excessively small SMD parts so that hobbyists with limited skills could reproduce it if it can not be obtained commercially, and be completely and unquestionably open source hardware and software so that others could continue to change and improve it even if I can not.  Unlike the Chinese vendors, I have to worry about legal repercussions if I don't respect the copyrights of others, and edy555 seems to not be too happy about where the NanoVNA is going.  I am not going to make money off of the VNA I designed, I just want to point out a problem I found that could be a concern for others designs that could be improved, as in the end I think the main interest is getting good equipment into the hands of hams.
Title: Re: NanoVNA Custom Software
Post by: ogden on February 03, 2020, 04:05:49 pm
Regardless of the source of the jitter of the SI5351A, and unless an engineer from Silicon Labs is going to chime in here, you might want to do the measurement I did and see how much the IF period varies before you decide it's not a problem. By triggering the acquisition off the zero-crossing and sampling at four times IF, I can get away with four Fourier coefficients: 1, j, -1, -j and so all of the quadrature demodulation can be performed using additions and subtractions.

Are you sure about your measurement? I am asking because specified jitter of SI5351 is <100 ps (picoseconds). What scope did you use? BTW phase noise measurements of SI5351 are looking surprisingly good: https://nt7s.com/2014/11/si5351a-investigations-part-7/ (https://nt7s.com/2014/11/si5351a-investigations-part-7/)
Title: Re: NanoVNA Custom Software
Post by: OwO on February 03, 2020, 04:34:05 pm
Regardless of the source of the jitter of the SI5351A, and unless an engineer from Silicon Labs is going to chime in here, you might want to do the measurement I did and see how much the IF period varies before you decide it's not a problem.  By triggering the acquisition off the zero-crossing and sampling at four times IF, I can get away with four Fourier coefficients: 1, j, -1, -j and so all of the quadrature demodulation can be performed using additions and subtractions.  No guessing at the phase relationship of various PLLs both internal or external to the microcontroller.  And by synchronizing, I can integrate a smaller signal with a small IF bandwidth so I don't have to greatly overdrive the SA612 to obtain enough signal, even though the acquisition takes longer.  It's the same principle used for a lock-in amplifier which is able to accumulate signals with a very low SNR.
I get the use of 4*IF sample rate, but I don't get what you are talking about with the phase relationship. As I said, the VNA detects phase difference between the reflected and a reference signal, so no guessing at phase relationships anywhere.

Adding a zero crossing detector and aligning the ADC sample clock edges with the IF period boundaries will do nothing, because the IF signal is the product of two high frequency carriers and its phase is completely arbitrary; for example just the microstrip trace between the coupler output and mixer input will alter the IF phase, and this phase shift is based on the phase change of the RF carrier so is highly sensitive to distance.

Also IF bandwidth is inversely proportional to the integration time. This is a fundamental fact of physics regardless of how you do the IF detection. The optimal detection is simply multiplying with the complex sinusoid (as you are doing), plus integrate and dump. As I'm aware the Nano also does this.
Title: Re: NanoVNA Custom Software
Post by: OwO on February 03, 2020, 04:43:01 pm
I've also verified that the measurement noise floor when using the si5351 is not noticeably higher than the ADF4350, and see no change in noise floor below 100MHz when the fractional dividers are active. I'm not sure if you can even measure jitter with an ordinary scope, but I've looked at the raw baseband signal from the ADC using GNU radio and didn't see higher noise floor with the si5351 fractional divider. Plus at these low frequencies other noise sources dominate anyway, which is likely why I don't see a change when switching from si5351 to ADF4350. Once you get to 1GHz however, the phase noise floor is clearly visible in spectrum view and it's on-par with what the ADF4350 datasheet says (plus a few dB due to noise folding).
Title: Re: NanoVNA Custom Software
Post by: profdc9 on February 03, 2020, 07:32:55 pm
Put the IF signal on a scope and see for yourself.  Even a modest oscilloscope can do this.  That is what your codec/microcontroller ADC sees.  You don't have to take my word for it.
Title: Re: NanoVNA Custom Software
Post by: ogden on February 03, 2020, 10:34:01 pm
Apparently not by the original developers of the Nano which drives the mixers close to P1dB.
What you guys think - is there any chance to improve performance of original Nano as it is? Lowering input levels of ref & reflected mixers is kinda easy (1 & 2 resistors), reducing OSC level for all mixers piece of cake, but then what? Most likely IF level will decrease and codec gain (or rather lack of it) will be problem, right? Basically we trade linearity for dynamic range, right? Or not?

Put the IF signal on a scope and see for yourself.  Even a modest oscilloscope can do this.  That is what your codec/microcontroller ADC sees.  You don't have to take my word for it.
Nah. Multiple sources - jitter specs, phase noise figures, use of si5351a in many HAM DIY HF receivers do not agree with what you say.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 22, 2020, 08:59:38 pm
Member enut11 posted about making their own attenuators.  I decided to show a few examples using the Nano compared with my other old network analyzers.  At the lower frequencies, the numbers the Nano throws up is pretty decent.   For these tests, things start falling apart once we get beyond 0.3GHz or so.  Still, it's impressive for $50.       

https://www.eevblog.com/forum/projects/20db-rf-attenuator-seeking-feedback-to-improve/ (https://www.eevblog.com/forum/projects/20db-rf-attenuator-seeking-feedback-to-improve/)

For the fun of it, I soldered an unknown 51.6MHz crystal to a test board as a shunt to look at the reflection coefficient.  This was the highest part I had on hand and I would suspect is a 3rd overtone.    It was swept from 10MHz to 55MHz with a 0.1MHz step (45,000 data points) to see if there were any other areas where the device would react. 

One of the problems with my old 8754A VNA is without using an external generator, looking at narrow band signals like this can be a problem.   The frequency is low enough that my 3589A can display it. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 24, 2020, 01:50:27 am
I had shown an attempt to make a low cost transfer relay for the nano.   One of the things I had did to show how poor its performance was along with the nano was to run a T check on it.  On the left is a screen shot from that video showing +/-20% up to 500MHz.   On the right, using these same home made "standards" on a better system, sweeping to 900MHz.

I had made a really cheep power supply made from a 4000 CMOS part to drive my old transfer relay from the USB adapter.  The transfer relay is latching, so the power supply just charges a large cap that I then dump to the relay. 

Working on putting together some better standards for my hobby use.   
https://www.eevblog.com/forum/rf-microwave/get-ideal-networks-from-cal-kit-parameters/msg2921098/#msg2921098 (https://www.eevblog.com/forum/rf-microwave/get-ideal-networks-from-cal-kit-parameters/msg2921098/#msg2921098)
Title: Re: NanoVNA Custom Software
Post by: OwO on February 24, 2020, 03:32:26 am
There is an easy way to build a decent transfer switch, which is to use many stages of cheap MMIC RF switches. In fact that's how the V2 hardware switches one receiver between the two ports, and still is able to get ~70dB isolation across the frequency range. Relays are not fast enough when you want to see the sweep in realtime with all traces visible.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 24, 2020, 12:48:16 pm
I think its about a second with the Nano for a single read of 101 points.   Comparing the time to offload all four, even zero time to switch would help very little.    My old HP uses a similar mechanical transfer relay to the one shown.  The system uses GPIB to interface with the PC and like the Nano, it's very slow. 

How much time does the V2 take to sweep and then pull the data from it?  In that time, how many data points does it collect? 
Title: Re: NanoVNA Custom Software
Post by: OwO on February 24, 2020, 04:00:55 pm
I think its about a second with the Nano for a single read of 101 points.   Comparing the time to offload all four, even zero time to switch would help very little.    My old HP uses a similar mechanical transfer relay to the one shown.  The system uses GPIB to interface with the PC and like the Nano, it's very slow. 

How much time does the V2 take to sweep and then pull the data from it?  In that time, how many data points does it collect?
It's 100 points/s just like the original Nano, but the screen is updated as the sweep progresses rather than updating once per sweep. The USB data interface also streams data points out rather than send a full scan at a time. It has to operate the switch multiple times for each frequency point (duration 10ms).
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 24, 2020, 06:59:53 pm
I think its about a second with the Nano for a single read of 101 points.   Comparing the time to offload all four, even zero time to switch would help very little.    My old HP uses a similar mechanical transfer relay to the one shown.  The system uses GPIB to interface with the PC and like the Nano, it's very slow. 

How much time does the V2 take to sweep and then pull the data from it?  In that time, how many data points does it collect?
It's 100 points/s just like the original Nano, but the screen is updated as the sweep progresses rather than updating once per sweep. The USB data interface also streams data points out rather than send a full scan at a time. It has to operate the switch multiple times for each frequency point (duration 10ms).

Thanks for the information.   I'm still a little unclear.   For a single sweep it takes then 10ms X 100 samples,  then X 2 for both channels?  So 2 seconds to read S11 & S21?    Or does it read and send both channels at the 10ms rate? 

The Nano requires about 2.1 seconds to download both channels or 4.2 seconds for all four S parameters. 
Title: Re: NanoVNA Custom Software
Post by: OwO on February 25, 2020, 06:58:29 am
It sends all channels at once, so 1 second for a full sweep (S11 and S21). Toggling the switches is far faster than changing synthesizer frequency, so it makes sense to do this rather than do two sweeps.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 25, 2020, 12:43:16 pm
It sends all channels at once, so 1 second for a full sweep (S11 and S21). Toggling the switches is far faster than changing synthesizer frequency, so it makes sense to do this rather than do two sweeps.

Thanks for clearing this up.     Have you published any specs yet, or is it still in limbo?    I wasn't able to find a supplier for it.  Can you provide one?
Title: Re: NanoVNA Custom Software
Post by: OwO on February 25, 2020, 12:46:21 pm
https://github.com/nanovna/NanoVNA-QT/raw/master/ug1101.pdf

Designs are also released. There is originally one manufacturer who will be selling these, but they are on vacation until the flu is over.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 25, 2020, 01:09:19 pm
https://github.com/nanovna/NanoVNA-QT/raw/master/ug1101.pdf

Designs are also released. There is originally one manufacturer who will be selling these, but they are on vacation until the flu is over.

Nice job with the manual. 

For the sweep points when using USB, is the 1024max basically still the 10ms, so 10 seconds to get the two S parameters?

What is the input power level before going nonlinear?  I don't believe they ever did publish this for the nano.

What is the output power level?   How flat is it over the frequency range?     

With the Nano and my software, there is no support to enter the impedance values for the calibration standards.  The frequencies I normally work with are so low, I wasn't concerned with it.  It appears that you now support S-parameter calibrations.   Nice.

Nice job with the TDR as well.  Just from the manual, it looks like a really nice setup.  I look forward to trying one out. 
Title: Re: NanoVNA Custom Software
Post by: OwO on February 25, 2020, 01:54:17 pm
Yes the sweep rate is constant, so 1000 points ~= 10 seconds.

The output power isn't specified, but it's around -20dBm to -10dBm by design. The flatness is dictated by the baluns so probably not very good. The ADF4350 has 10dB of adjustment range, although it's currently hardcoded to max power in the firmware.

The receiver IP3 should be around 30dBm, but it's only tested to not saturate the ADC up to the maximum signal generator output power (using a thru cable), so to measure an amplifier with 20dB gain use at least a 20dB attenuator.
Title: Re: NanoVNA Custom Software
Post by: Saronni on April 11, 2020, 07:19:28 am
[slightly on topic?] NanoVNA features in a short article in the April 2020 edition of Silicon Chip magazine and Joe Smith's video is referenced for handy tips on physical handling, calibration and connecting to USB software.
Title: Re: NanoVNA Custom Software
Post by: bitseeker on April 11, 2020, 02:18:29 pm
That's cool. Congrats, Joe.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on April 11, 2020, 05:35:37 pm
Thanks for the posts.   

With help from member rf-messkopf I finished my Open and Short SMA and N standards.  I had borrowed various standards that I used to characterize mine using Mario's Octave scripts.   In my last few posts, you can see where I do a comparison between my NanoVNA and my latest boat anchor, using these metrology grade standards.       

https://www.eevblog.com/forum/projects/20db-rf-attenuator-seeking-feedback-to-improve/msg2986524/#msg2986524 (https://www.eevblog.com/forum/projects/20db-rf-attenuator-seeking-feedback-to-improve/msg2986524/#msg2986524)

Someone had asked me about doing a review for the V2.  I still plan to buy one at some point but most likely would make some sort of comparison video.   When I made the videos for the Nano, I was trying to focus on what it can be used for, rather than it's shortcomings.  I would like to stay with that theme with the V2, but compare it with the Nano and my old HP network analyzers.   Again, just showing some practical measurements.   After many years of pondering buying another VNA, my flock has grown with the addition of a third relic (the catalyst for making improved standards).     


****
Using the Nano to characterize quartz crystals for home made filters:

https://www.eevblog.com/forum/rf-microwave/fun-with-crystal-filters/msg3036196/#msg3036196 (https://www.eevblog.com/forum/rf-microwave/fun-with-crystal-filters/msg3036196/#msg3036196)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 31, 2020, 04:39:26 pm
*******************
  Chapter II
*******************

I picked up the new NanaVNA V2Plus & Plus4.   I was hoping they would have followed the same command set as the original firmware but they used a whole new command set.   Posts moving forward will be in referencing the new models unless I state otherwise.


At first glance the new command set seemed to be fine but now as I start to dive in, it looks less inviting.

If you look at the manual, you will notice commands like READ, READ2, READ4.  For example, if you wanted to read four 1-byte sequential registers, you would use READ4 sending it the starting address.    If you wanted to read 5 registers, well I guess you could send READ 5 times or one of the many other combinations.  Why wouldn't you use have a ReadSeq where you send it the start address and the number of registers to read.   IMO, really odd.   

They have registers for example say the start frequency.   It's 8-bytes long.  Of course, we don't see a READ8 command.

Normally, for every instrument I can run them from the instruments GUI as well as my software.   When I start my software, I will commonly query the instrument to learn how it is configured and display that on my own GUI.   But we see there is a note: 

Quote
You can not observe user entered sweep parameters (from the device UI) by reading these registers.

Really!   So, you must configure the unit to know how it is set.  That's all fine except you will not find any error checking.  If for example, you set the instrument to start a 1MHz and something caused a fault (I know, USB is the perfect bus) you have no way of knowing this.   

I assume they did some things to try and improve the communications performance.  The Nano will switch from the normal GUI to displaying a text message NanoVNA V2Plus...  USB MODE.   All fine except, I am wanting to create new software to talk with it.  So say I program the start frequency.  The display only shows USB mode.  I can't read the value back....

It's a system ran by Blind Faith.   
Title: Re: NanoVNA Custom Software
Post by: OwO on October 31, 2020, 04:57:51 pm
The configured parameters can be read back using READ* commands, just it's a separate set of sweep parameters that are unaffected by what the user configured on screen. That is because when you enter USB mode the VNA basically resets and is entirely under USB control. That there is no READ8 command was a mistake in the protocol design because command 0x13 used to be something else, but since all software have now been updated I can introduce READ8 in the next firmware update. For now just use two READ4 commands to read back the frequency values.

The reason the protocol is designed the way it is is to allow easy implementation in hardware on an FPGA. That's why there are a small number of fixed-length commands and a continuous FIFO, rather than on-demand sweeps. The same reason there is no variable length READN command (or worse, WRITEN), since variable length complicate the state machine for not much gain. READ2/READ4/READ8 should only really be used to read short/long integers, not a sequence of any 2/4/8 registers.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on October 31, 2020, 07:27:52 pm
Thanks. 

So if I am only using the commands to read the S-parameter data from the Nano (never using the start,step and sweeppoints), the Nano's UI remains active and I can continue to control it with the touch screen and display the data on the PC?

When using the RawSamplesMode, does the format of the data remain the same?  So no difference other than no calibration being applied? 

What are the ValuespPerFrequency?   I would assume you set the sweep points to 100, you get 100 values total.   In the case of the V2P, 401.  The manual does not provide boundaries.
It appears it must resend the same frequency over and over or something like that.   I am having to use a SA to write the code to see what it is doing and it seems to just sweep the same frequency over and over before moving to the next location.  Really odd. 

If I set the start at say 100MHz, 10KHz step, 400 sweep points and 1 value per frequency, the sweep rate is VERY slow.  Maybe 2-3 seconds.   Maybe 4-6 for the V2P.    I don't see anything about a sweep time or a way to set the IF filter....   I was expecting it to sweep well below a second based on the new specs.   I'm not understanding something.

I have been playing with the V2P4.  I had a quick look at the V2P.  It appears the only way to tell them apart is by looking at the hardware revision.  My V2P reports 3 and V2P4 reports 4.  I assume there could be a rev 4 of the V2P and so on.  What is the proper method to detect the device type.  I was guessing the Variant but it appears fixed.
Title: Re: NanoVNA Custom Software
Post by: OwO on November 01, 2020, 06:32:40 am
Before it enters "USB mode" you can't read any S parameter data from the FIFO. There is no way to get data out while the UI is active, and this is by design because either the UI is "attached" to the VNA or the host is, never both at the same time. Data points over USB are always uncalibrated. Basically you need to think of it as a USB-only VNA when programming for it, nothing the user does on the device UI ever affects or is visible over USB.

valuesPerFrequency is what it says, values to obtain per frequency. If you set it to 2 the data points will be f0, f0, f1, f1, etc. This is what nanovna-qt uses to implement averaging. Each returned data point has the frequency embedded in it, and this is what you need to use to determine where you are in the sweep. The sweep is always ongoing and can not be paused, so there is no such thing as an on-demand "single sweep". To get a close approximation of a single sweep, simply read sweepPoints*valuesPerFrequency points from the FIFO in total, but before you do that you have to make sure the FIFO is drained (the FIFO will overflow and be filled with stale data if you don't keep reading it).

If I set the start at say 100MHz, 10KHz step, 400 sweep points and 1 value per frequency, the sweep rate is VERY slow.  Maybe 2-3 seconds.   Maybe 4-6 for the V2P.    I don't see anything about a sweep time or a way to set the IF filter....   I was expecting it to sweep well below a second based on the new specs.   I'm not understanding something.

That is about right, look at the specifications here:
https://nanorfe.com/nanovna-v2.html#specifications
The sweep speed below 140MHz is 200 points/s because the si5351 can not be controlled very fast.
400 points @ 200 points/s = 2 seconds.
Averaging over many points is equivalent to reducing IF filter bandwidth, and you can use valuesPerFrequency to do that.

rawSamplesMode gives you raw ADC samples, and this was for debugging only. In newer devices this is broken because USB can't keep up with the higher sample rate.

Hardware revision is what you use to tell between V2_2, v2plus, and v2plus4. That is the revision, so there is no such thing as newer revisions of the v2plus, if there was it should be invisible to the software anyway.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 01, 2020, 02:18:46 pm
Thanks for taking the time to answer my questions.  This was very helpful.  Your one comment
Quote
Data points over USB are always uncalibrated.
was going to be my next question. 

I am curious why the need for a valuesperfrequency.  Was the thought that holding steady at each frequency yields a higher throughput because you don't need to wait for the system to settle?    I was thinking I would just read the whole data set multiple times if I wanted to average.   

The whole idea of a free running system is fine.  Had you thought about using some sort of index (starting frame) followed by the data without sending up the frequency for each sample?  It would seem like you could improve on the throughput removing this data but then again, it may help the software keep in sync when using the valuesperfrequency.   

Hope to really put in some effort in a few weeks.  For now, I'm just trying to understand enough to give me an idea how to code it.  If you do decide to change the firmware (add a READ8 or just a generic READn commands, other),   if you are posting this somewhere, it would be good to know ahead of time.   

You should have your company make up some decals for them to bling them out a bit.  I keep thinking to letter mine but if you are planning to come out with something I would wait.

***
Trying it at 500MHz, 100 points, 1 sample per point, it does seem to sweep in about a half second.   Is the slow sweep rates due to settling time or other hardware or a limitation of the USB bus?

When using the valuesperfrequency >1,  if you collect all the sweeps and perform the average for each discrete point and download it once rather than having the PC perform the average,  would this be faster?     

It looks like mine is about a -10 dBm at 100MHz and -20 at 4GHz. Any idea what the compression is at the two extremes?  Any way to adjust the level?

It appears I can program the frequency up to about 4.6GHz   I assume I could run it up this high with a very reduced performance as long at I use this as the stop frequency, or is there something that would prevent it?   

Is there any sort of diagnostic information that can be queried over USB? 

****
You have a ReadFIFO command that accepts an address and one byte for the number of values.  However SweepPoints is a uint16.  So, to pull down the entire sweep could require several reads which are all out of sync?  So after some chance, we have the full amount of data for a sweep but really don't know which sweep which segments went with?   

I just tried the ReadFIFO command telling it to read a single sample.  Each time I do this, the index increments.  I would assume doing this slower than the sweep time would cause each value to be from a different sweep.   From your last post, this would seem to be the case but I just want to make sure I understand it.

Looking at the FIFO data format you define Bytes 1a..1f as reserved.   However, it seems that the last byte may be a checksum for the packet.  If this is a checksum, could you please provide how you calculate it?

Sadly, the official support group was locked for viewing messages so I joined hoping that others have already asked you similar questions.   After joining, I didn't find a lot of details. If there is a better group where you have already covered these questions,  just let me know.

Thanks again for your help.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 08, 2020, 03:05:33 am
I joined nanovnav2@groups.io and picked up a few pointers from a member OneOfEleven.   They explained the undocumented checksum and the data format.   I have a pretty good idea now how to structure the software.   So I thought I would run a quick test to make sure I understood.   

Frame ms is the time to read a single data point.  Sweep ms is the time to read the full sweep.  So 1.95 seconds when starting at 1MHz and sending 400 data points.     There are currently two FIFOs.  There is a receiver thread that constantly reads in single data points and places them into the first FIFO (assuming we have a good checksum).   A second thread, stitches the data together and to form a competed sweep data set that then gets placed into a second FIFO.  A third thread then processes the data.    It seems very stable and robust.   

I need to add support for the average and I need to arrange where some of the processing is done to make better use of the memory. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 08, 2020, 10:41:57 pm
Spent the day working on the software.  The new average feature doesn't appear to offer any performance gains.  For example running a sweep that required 1.62 seconds with valuesperfrequency set to 1, required 16.2 seconds with it set to 10.   

Because the V2+ is so different, I will just use a different program to support it rather than trying to support both VNAs with one program.   I already had ported the code to support my old HP boat anchors anyway. 

Here's the first real test.  The V2+ was calibrated then a 100 ohm resistor installed an ran for several minutes to check how stable the readings were.   For now, I am just using my PCB standards.   

Seems very stable (firmware, hardware and my new code).   A good start anyway.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 09, 2020, 01:46:58 am
I have been testing the V2+, not the 4.  Now trying to run some narrow band tests.   The data is very poor compared with my original Nano.   Both units set to 5MHz.

Also shown attempting to look at a 3.68 crystal using the same jigs and cables I have shown in the past with the Nano.   It is stable enough to track the drift from touching the crystal's case but there's far too much error to make use of it.  Wasn't expecting this.   Maybe there is some setting to tame the phase noise.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 09, 2020, 01:05:56 pm
I don't have a battery for the V2P and was running it from the PC's USB port.   The data for the original Nano was with it running standalone. 

Curious to see if the poor phase noise was just a bad unit.  This is the V2 Plus 4, running standalone. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 09, 2020, 01:27:47 pm
Quote
The Si5351 covers frequencies up to 140MHz, and the rest are covered by the ADF4350s.

Curious to see if the phase noise was improved above 140, shown is my original Nano compared with the V2+4.  Both running from battery, no connections to the PC.  CW mode set to 150MHz. 

I also repeated the test, looking at the 3.68MHz crystal.    Note the difference of the Span setting, due to the lower phase noise.   Crazy.   

I would have assumed, if you were going to come out with a new product to compete with something as popular as the original Nano, you would start by use it as the baseline for your requirements.   You may improve, or have the same performance but I'm surprised it would ever be worse.   
Title: Re: NanoVNA Custom Software
Post by: thinkfat on November 09, 2020, 01:41:29 pm
"CW" mode is really CW output with the V2 now? Not in the original software IIRC, there was a patch from a forum member implementing actual CW output, but I don't know if it has been pulled. If not, even in CW mode there's some (a lot) AM on the signal.

PS: I checked on my V2+4 unit, it's not actually CW, it's pulsed. This explains the spectrum you see.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 09, 2020, 10:55:37 pm
Yes, it's pulsed.  I haven't thought much about how this will play into testing active devices.  Right now I am just trying to perform some basic narrow band measurements and can't pull it off.   It may be possible that they don't allow it to settle long enough on each state.    As it stands now, it's useless for making these measurements.  That or I am missing something, which is also very possible.   

I personally don't have much of a need for a CW mode but the modulation may be a problem, even if the system could settle enough to get some decent data off it. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 12, 2020, 01:24:01 am
I had made up a few microwave experiments to show off the V2 and had planned on doing a sort of shootout video where I was going to compare it against the other old vintage VNAs I have, including the new boat anchor.   Sadly, I wasn't able to find a work around for the poor phase noise and I doubt anyone is interested in seeing another low frequency video of the old Nano.   Writing software to support the V2 wasn't a huge investment in time and I wasn't expecting a whole lot from the V2 to begin with, so lesson learned.   

That original Gen 1 Nano flipper sent me is still the clear winner for me.  I'll take less slow data over fast poor data any day of the week.  Too bad, but it was only $120 bucks.   
Title: Re: NanoVNA Custom Software
Post by: OwO on November 12, 2020, 06:48:24 am
V2 can not resolve frequencies beyond 10kHz accuracy because the frequency step of the ADF4350 is 10kHz, not because there is significant phase noise (you can't look at the output on a spectrum analyzer because the signal is pulsed and the pulse period is not fixed). The quick switching of the ports does affect ability to measure very narrowband devices (less than 1kHz bandwidth), but this wasn't considered an issue because you only have 10kHz resolution at the upper frequencies anyway. If it can even track the drift of a crystal it's beyond my expectations, since it was not designed for this use case at all.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 12, 2020, 11:44:25 am
V2 can not resolve frequencies beyond 10kHz accuracy because the frequency step of the ADF4350 is 10kHz, not because there is significant phase noise (you can't look at the output on a spectrum analyzer because the signal is pulsed and the pulse period is not fixed). The quick switching of the ports does affect ability to measure very narrowband devices (less than 1kHz bandwidth), but this wasn't considered an issue because you only have 10kHz resolution at the upper frequencies anyway. If it can even track the drift of a crystal it's beyond my expectations, since it was not designed for this use case at all.

While being able to detect some drift may exceed your expectations and you may not consider your designs inability to be used for narrow band work an issue but I do.  It makes the product far less useful.  I assumed you would have understood the market well enough to know what requirements would be important.  Had you used the original Nano for your design criteria and met or exceeded every aspect of it,  I think you would have a great product.   It's also possible that I am not part of the targeting market.     

After being so impressed with the original Nano,  I bought yours to have a little fun with and maybe do a little promotional video for it.  It's a low cost analyzer and in this case performs like one.  I'm out a bit of cash and a couple of days work is all.  Could be worse.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 13, 2020, 01:33:23 am
How bad is the V2P, following showing my old boat anchors, the original NanoVNA and the V2P.   Same fixture and 3.686MHz crystal. 

The two vintage analyzers are fairly close.  The original Nano is off by around 0.2dB.  I may have messed up the cal.   Then we have the new V2P.   The span of the V2P is set to 2KHz rather than 1KHz like the other three VNAs so at least you could see something.     
Title: Re: NanoVNA Custom Software
Post by: OwO on November 13, 2020, 04:02:10 am
Your span is 2kHz. That means the step size is 20Hz. This is not supported, as the ADF4350 step is 10kHz, and even in the si5351 region stepsizes < 1kHz are not supported (because of the high measurement bandwidth). It looks like I will have to include a check in the firmware preventing setting the span this narrow, to prevent people from accidentally setting the parameters to give meaningless readings.
Title: Re: NanoVNA Custom Software
Post by: OwO on November 13, 2020, 04:08:45 am
Anyway this is the first time I've heard of building a filter with ordinary crystals (more common is using an off-the-shelf SAW filter). 1kHz passband @ 150MHz is 0.0007% fractional bandwidth. Basically no physical filter can achieve that except for electroacoustic filters, and even those are generally built to give a wider, flat passband instead. So far no one else has talked about this issue so I think it's an extremely niche use case that happens to be better suited to the V1 Nano. Personally I think it's a matter of using the right tool for the job, just as a cheap LCR meter will beat any VNA measuring impedances > 10k ohms. I could design a VNA that will work for very narrowband measurements, but to do that and *also* measure up to 3GHz, have high dynamic range, and still be able to adjust the sweep speed up would mean it would cost at least 10x what it costs now.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 13, 2020, 01:34:42 pm
It looks like I will have to include a check in the firmware preventing setting the span this narrow, to prevent people from accidentally setting the parameters to give meaningless readings.

I'm not aware of any error checking in the firmware outside of the undocumented checksum.   You should add that information BTW.   Adding range checks is fine but I would suggest you send a return message when each command is set so the software knows that something went wrong.   I created a simple regression test for the original Nano when the firmware was in such turmoil.  With the V2+ not supporting any boundary checks, I decided against implementing any sort of automated  tests. 

Anyway this is the first time I've heard of building a filter with ordinary crystals (more common is using an off-the-shelf SAW filter). 1kHz passband @ 150MHz is 0.0007% fractional bandwidth. Basically no physical filter can achieve that except for electroacoustic filters, and even those are generally built to give a wider, flat passband instead. So far no one else has talked about this issue so I think it's an extremely niche use case that happens to be better suited to the V1 Nano. Personally I think it's a matter of using the right tool for the job, just as a cheap LCR meter will beat any VNA measuring impedances > 10k ohms. I could design a VNA that will work for very narrowband measurements, but to do that and *also* measure up to 3GHz, have high dynamic range, and still be able to adjust the sweep speed up would mean it would cost at least 10x what it costs now.

I really don't know what the communications hobbyists, like the amateur radio operators, are up to.  I had received comments that the Nano was designed for tuning antennas and that was really it's only intended use.   That seems to represent the majority of the amateur group. 

Someone asked me about home made crystal filters and it's common enough that there have been several articles published about them over the years.   I created a thread to talk about them and to your point, it wasn't very popular. 

https://www.eevblog.com/forum/rf-microwave/fun-with-crystal-filters/msg3036196/#msg3036196 (https://www.eevblog.com/forum/rf-microwave/fun-with-crystal-filters/msg3036196/#msg3036196)

Right tool for the job in my case was helping my friend flipper learn a little about VNAs before they leaped into buying one.   The original Nano works well for that.  As I have shown in several test cases, as long as I stay below 300MHz, it throws up some very impressive data for $50.   For 3GHz, I haven't done anything outside of measuring the included loads. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 14, 2020, 12:12:13 am
Let's have a a little fun with some higher frequency bandpass filters.  While the original Nano can actually make some measurements in excess of a GHz, it does a poor job at best so I'll leave it out of the mix.   

For starts, this is a TOKO dielectric 915MHz band pass filter, PN# 4DFA-915E-10.    Both my old boat anchor and the NanoV2+ were swept from 700MHz to 1.1GHz.  Looking good.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 14, 2020, 12:17:07 am
Sweeping both VNAs from 890MHz to 940MHz.   Again, looks decent. 

Let's have a look at something with a bit sharper skirt.   In the last attachment, Yellow is the TOKO part we just looked at.  Red is a 9 element interdigital filter.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 14, 2020, 12:21:15 am
Let's start by sweeping from 800MHz to 1.4GHz.    Ignore the floor, really it doesn't look too bad.   This filter has a fairly flat pass band.  Maybe a tenth.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 14, 2020, 12:31:53 am
Odd, not sure what the security issue is.

Sweeping from 1.01GHz to 1.135GHz.   I had ran the Nano a few times. 

***
Just for fun, I have attached the data using the original NanoVNA. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 14, 2020, 08:47:56 pm
I recently finished repairs of a "working" 100W JFW attenuator.   I changed it to use a 20dB, 150W network.   While the original attenuator was rated for 1GHz,  the new network was spec'ed to a dB up to 3GHz.  I tried it and even with the poor launch (new part is not a perfect fit), it's basically a dB out. 

So hows the Nano V2+ compare?  Not too bad. 

Data was collected using the supplied cables.  I replaced the supplied thru with a higher grade part that can be torqued.  The load was replaced with the second best Mini-Circuits ANNE I had sorted.     

https://www.eevblog.com/forum/rf-microwave/fixed-attenuator-repair-mods/ (https://www.eevblog.com/forum/rf-microwave/fixed-attenuator-repair-mods/)

One thing I have ran into twice now with the V2+,  if I set the samples to 400 and less, the unit appears VERY stable.  I've never seen it crash after several hours of operation.   Setting it to higher values, for example 800 was used for this test, seems to cause problems where the unit will no longer communicate.  I have to power cycle the V2+ in order to recover.    Outside of that,  I haven't seen anything else I would consider a bug when using the USB. 

****
Make that three times now.  The unit basically stops sending all data.   Looking at capture.png, I was sweeping from 300KHz to 4.58GHz (unit becomes unstable above the frequency).  Sending 800 data points per sweep, it hung after 22 sweeps.   I would guess I have ran it at least 3 hours solid at 400 points.  It does not appear to be tied to the frequency range.    This graph BTW, is looking at the thru.  The unit has a but of noise at the low end it increases as we move beyond 3GHz. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 14, 2020, 11:38:27 pm
I dialed back the sample points to try and get a better look at the noise.


Noise1:  1200 sweeps 300K to 4.58GHz.
Noise3:  To zoom into the area of the low band, changed the start and stop to 99.847MHz to 99.852MHz
Note the spur is close to 99.85MHz. 

Noise4/5:  Even with 100 samples and such a narrow sweep, the spur isn't always captured.  It looks like one particular frequency.  It's amplitude varies a fair amount. 

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 15, 2020, 12:28:36 am
Narrowing the span much further, reducing the number of points to 4, turning off the color mesh, we can clearly see this is a single data point.  Oddly of the 3800 sweeps, there appears to only be three states. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 15, 2020, 03:10:06 am
Running similar tests with the V2+4.  First thing I noticed is that using the same 800 data points has yet to cause it to hang.    I also found that this particular unit would go unstable at a much lower frequency.   4.4GHz seems to be stable.

Noise7:  Sweep 300K to 4.4GHz, 800 points per sweep.   Notice the very low frequency noise is gone.  We can also see the unit drifting a bit as it warms up.  Something is happening around 900MHz.

Noise8: Looking below 1GHz.  Pretty decent.   
Noise9: Sweeping from 850 to 950, looking at raw data, we can see some short of shift happening at 910MHz.  Shouldn't cause any problems.


I like the speed of the V2+4 and having the ability to pull more samples without crashing.   I was sweeping in small segments with the original Nano to increase the resolution in order to look at narrow band parts.   Now I have all these samples and can't put them to use.   I want my cake and to be able to eat it too!! 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 15, 2020, 06:35:43 pm
I wanted to try running something a bit closer to the 4GHz limit of the V2plus4.    Shown are the S21 plots for the V2+4 compared with one of my old VNAs.   

Cal:  Showing both units after calibration.  The Nano is using the cables supplied with the unit.  The cal kit was changed as mentioned previously.   The Nano looks pretty good.  Consider in the previous plots the amount of noise above 3GHz.   

Notch: Showing a 3.8GHz notch filter (stub).   The two VNAs track fairly close except for the notch where we see a 4dB difference. 

MidWest: Let's have a look at Midwest Microwave DC-18GHz 40dB attenuator. 

See Posts below for corrections:
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3341186/#msg3341186 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3341186/#msg3341186)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 15, 2020, 10:04:03 pm
Using the V2+4 to look at a small preamplifer.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 16, 2020, 12:06:03 am
No real point to this exorcise other than just playing with the Nano and testing my software.   I'm sure a few of you wonder if I have a CB radio.   :-DD  I don't.
   
Looking at a small power amplifer.  The total attenuation between the amplifier and Nano is 60dB.   The step attenuator was then set to 0dB and a amplifier was bypassed to get a relative measurement from the Nano.   The step attenuator was then set to 30dB (90dB total) and the amplifier installed.   The total gain is about 80dB which is close to the limit of the Nano.  Note the 1dB steps.  Starts to compress above 7dB.   
Title: Re: NanoVNA Custom Software
Post by: Kean on November 16, 2020, 01:20:31 pm
Note the spur is close to 99.85MHz. 

Not a local broadcast station is it?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 16, 2020, 02:57:42 pm
Note the spur is close to 99.85MHz. 

Not a local broadcast station is it?

It's possible it's an external source. 0.3dBm is up there pretty high. Seeing the three states is also really odd.  I would expect it to be random.   A thru was installed to collect this data.  The v2+4 does have a metal case, vs the v2+'s plastic.  I could install the V2+ into a shielded case and see if anything changes.   If I had the battery pack, I could also try it stand alone.  Maybe something from the PC getting in through the USB cable.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 16, 2020, 06:28:59 pm
Case is made from PCB, soldered together.  Lined with Teflon.  Ferrite added internal and external on the USB cable.  Case grounded by large braid.   Section of semi-ridged used for through.  No calibration performed.  Showing the raw data.   

Swept the V2+ from 90 to 110MHz.   Started test with cover open to get a baseline.  At roughly half way through the test (750 sweeps), the enclosure was sealed off.  There appears to be no difference.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 17, 2020, 03:09:26 am
I used a small USB battery to power the v2+, then used the menus to program the start/stop.  Turned off all other traces.  Couldn't sort out how to get a good scale and reference. So cal'ed it with a thru only and set it to 0.1dB/div.  Sure enough, I can see the spike randomly show up.  Tossed it all into the shielded box and watched it through the screen.  Still does it.   Should be easy enough to reproduce. 

You may have seen they claim the v2+ is rated for 3GHz, where the v2+4 is rated for 4GHz.  I have been meaning to go back and repeat the 40dB attenuator test with the v2+ and see what difference there is.   It actually looks like my v2+ is slightly better with this test than the v2+4.   I doubt anyone is expecting them to perform as well as my vintage Agilent.   

Seeing a claimed 4GHz system off by 20dB below that, well...  Pretty much what I have been saying about keeping the original Nano below 300MHz, goes for the Plus.  Stay below 3GHz, don't expect to do anything narrow and if you use the V2+, stay with a smaller number of points (maybe these lockup problems can be corrected with firmware).   It's pretty good for only $120.       
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 22, 2020, 04:33:28 am
The 3GHz upper limit of the v2+ and v2+4 improves the TDR.  512 steps per unit length or 0.025.  After 200 samples, the standard deviation is 0.0018".   The histogram and unit length per sample are much more stable now.   It would be interesting to see how it would perform with a commercial airline rather than my homemade one.  Still, a big improvement over the original Nano.   

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 22, 2020, 06:32:18 pm
Looking through some older data for the original Nano, it appears I had ran a test using increments of 0.010".    I replicated this test with the V2P and the results were nearly identical.    I repeated the test with the V2+ set to 900MHz and 101 data points like the original Nano.   

It's very possible that the mechanical hardware is the limiting factor. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 22, 2020, 07:19:27 pm
Tried a few tests with the +4.  Added a digit to the standard deviation which is a bit lower.  We can see the p-p is also slightly better.   Could just be a matter of running the slide. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 22, 2020, 08:07:18 pm
Continuing to play with the software and slide. 
Sweeping the V2+4 100K to 3GHz and incrementing the slide by  0.100".   Looking at the return loss, we can see how the travel effects the reflections.  As the number of sweeps increases, so does the distance from the V2+4 to the end of our airline.     
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 23, 2020, 12:57:22 pm
They claim the lower limit of the V2+/+4 is 50KHz. 

Looking at a 5.6pf between port1&2.   The V2+ was swept from 50KHz to 5MHz.  No calibration was performed.  The USB has proven to be unreliable with this unit and I am using 101 data points (like the Nano).  Strange as the V2+4 has never hung.  Maybe a bad unit? 

Notice how bad the noise is as we go below 500KHz. 

The second plot is looking at the same capacitor but I have now calibrated the unit and am sweeping from 2MHz to 10MHz.  The jig adds a bit of error but no matter.  Notice it really doesn't settle until 6MHz or so.  Below 500KHz or so there's a lot of error.  Difficult to calibrate noise out. 
Title: Re: NanoVNA Custom Software
Post by: OwO on November 23, 2020, 01:43:06 pm
The attenuator measurement doesn't look right; here is what I'm getting with a 40dB attenuator 3-4GHz, calibrated with the cal kit supplied with the V2 plus4, and no averaging:

(https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/?action=dlattach;attach=1116746;image)

Please check your measurements with NanoVNA-QT, right now even nanovna-saver does not implement the isolation calibration correctly. If you are not sure how to implement it, check the code here: https://github.com/nanovna/NanoVNA-QT/blob/master/libxavna/calibration.C#L63 (https://github.com/nanovna/NanoVNA-QT/blob/master/libxavna/calibration.C#L63)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 24, 2020, 12:07:56 am
I tried to run the software again and it basically seems to hang.  When I select various menus nothing happens.   After several seconds it will flash up the menu, then it goes away.   

The software doesn't show a version number anywhere on it.  There appears to be no text files included with it that provide any details about the software.   I am running Windows 10.  LabView talks just fine to the device (when it doesn't hang).  So it doesn't seem hardware related.    If you have better software or know of a way to get this version working, let me know and I will try it. 

*****
Playing around a bit more, I finally was able to get it to select the communications port.  It started sweeping but came up with this error.   
Title: Re: NanoVNA Custom Software
Post by: Mechatrommer on November 24, 2020, 06:39:43 am
have you updated the driver to the one given/suggested by the SW documentation? CH340 iirc. that message appeared to me when i disconnected Nano while the SW is sweeping.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 24, 2020, 01:17:20 pm
have you updated the driver to the one given/suggested by the SW documentation? CH340 iirc. that message appeared to me when i disconnected Nano while the SW is sweeping.

As I have mentioned a few times, the V2P appears to hang when using the USB.  Again, maybe firmware or a defective unit.  It's possible this could have caused the error but it happened pretty fast and normally when it see it I am using large data sets.

I have attached a screenshot of the driver.   Is this what you are using?  It's what they had when I downloaded the software.  When I first plugged in the device, Windows recognized it but their software was hanging.  When I changed to this diver, I saw no difference. 

Again, their software hangs with both the V2+ and +4.   

I tried to follow the undocumented code and it does appear that the could be the problem.  I ignore the leakage terms with my software.   It may be faster to add this to my software than spend time trying to get their software working.   I didn't have any luck with the original Nano's software as well.  I have not tried this new software on a different PC. 
Title: Re: NanoVNA Custom Software
Post by: Mechatrommer on November 24, 2020, 03:53:17 pm
yes thats the same driver but i'm on Win7.. havent played much with large dataset but i just tried 5000 points, it took a while before the sweep starts, but i dont wait until completion. communication interruption (esp USB) is likely due to the driver or the USB IC or the how your PC is setup. too many USB devices and data transfer may affect that channel too? is there such thing as dropped USB packets?  :-//. it could be out of the HW designer's hand as well or the NanoVNA-QT. you may ask the original programmer (xaxaxa) maybe? lets hope OwO frequently reply to Q&A.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 24, 2020, 05:41:47 pm
I still have a Windows 7 PC that I could try. 

I am seeing the V2+ crash with even 400 points.  But again, I am running it non-stop for hours on end.  It does appear to have something to do with the number of points.  The average time between crashes seems to increase with the number of points selected.   The V2+4 has yet to crash with my software.     I've been unsuccessful in finding a way to cause the V2+ to crash at will.     

That VNA's communications is very slow.  It's hard to believe it's a driver or hardware problem as LabView talks to it V2+4 just fine even with 800 points selected.  LabView isn't known for it's ultra fast speeds.   

Adding support to my software to include the crosstalk error terms isn't a big deal.  It would still be nice to be able to compare the data from my software with the included software.   

The one thing I noticed in their software was the ability to change the power level.   I didn't see anything in their documentation about how to change this setting.   Like the checksum, it may just be another undocumented feature.   I would like to add support for it.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 25, 2020, 01:15:16 am
I added support for the leakage and repeated the test with the 40dB attenuator sweeping 3 to 4GHz.     I then repeated the test sweeping up to 4.4GHz as before. 

Looks MUCH better!   Thank you very much for that little hint OWO! 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 25, 2020, 05:00:30 am
I loaded the software onto my Windows 7 PC and it seems to work fine.  This PC has an old i7 2630QM processor where the Window 10 PC uses a Xeon E5-1650 v4.

Attempting to sweep down in the 50KHz range where the worse noise is but their software appears to limit it to 100KHz.   

Before digging into their source code, I tried adjusting the Ouput Power but it appears to have no effect.   My guess is that it's not supported and that's why there is nothing in the documentation about how to set it.   

****************
Talking with a friend today about the USB problems with this V2P hanging.   Apparently they ran into a similar problem with Windows 10 USB selective suspend causing them problems.  They suggesting disabling all of the USB power saving features.  I tried it and the V2P has been collecting 400 point datasets for a bit over an hour and a half now without a fault (using my software).   This is the longest I have seen it run with this amount of data but I'll let it continue to run just to make sure.   
****************
It made it to two hours and I aborted the test.   I restarted collecting with 800 data points.  It finally hung at 2200 cycles.  It collects at roughly 17 sweeps per minute with 800 points.   So roughly 129 minutes until it failed. 
*****************
The next attempt to run am 800 point test, the unit crashed after 210 sweeps.   I tried it one last time and it made it to 4500 sweeps or around 4 hours before it crashed.

When the Nano crashed, it still shows the USB menu but doesn't respond to any USB commands.  The PC still see's the port.   The only way I have found to recover from it is by power cycling the Nano V2+.   

After several attempts to get the VNA View (VNA QT) software to run on this PC, I did eventually get it to sweep.  There isn't any way to tell how many sweeps it has ran.  I'll check on it over the day and see if it has hung or not.

*****************
I ran their software for roughly seven hours and the V2P never crashed using the same PC, driver, cables, Nano.  I started my software and the Nano crashed within a half hour.  So it's not the USB power savings features in 10.   

My software is pretty simple.  When it causes the Nano to crash, it's just asking for a single data point and reading it.   


Title: Re: NanoVNA Custom Software
Post by: Darko8 on November 26, 2020, 12:49:00 pm
Hi,

I checked few pages of this long forum thread, but I could not find any application attachment or link. Is this application going to be released or is it just for internal use? Or maybe I missed link/attachment?

I would gladly try it on my new SAA2 v4 which I got yesterday :)

Regards, Darko
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 26, 2020, 07:18:37 pm
Hi,

I checked few pages of this long forum thread, but I could not find any application attachment or link. Is this application going to be released or is it just for internal use? Or maybe I missed link/attachment?

I would gladly try it on my new SAA2 v4 which I got yesterday :)

Regards, Darko

Reading has become a lost art. 

I have no plans of making my software available.  However, I understand there are a few open source packages that are well supported and excellent to use.  You should join one of the many groups for the Nano as I am sure many people would provide you with any help you need getting it setup.  There was one person that dropped me a couple of bread crumbs on the V2+ interface.  It sounded like they were working on their own program for it as well.   Check them out. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 27, 2020, 04:51:53 pm
I ran a few more tests trying to sort out why my software can get only the V2+ to hang.  First, I would never expect firmware to get into a state where it would require a power cycle to recover.   I have no desire to have to unplug my appliances or countless other embedded devices.   But it seems like there is something that I am doing that causes it, at least with this PC.

If you have a V2+ (not the +4), and know a bit about Labview,  I have attached a simple program that sets the Nano to sweep from 1-900MHz, 800 points, 1 sample per point.  It then just reads data from it until you press Stop.   It may need to run for several hours as I've seen the V2+ run anywhere from 15 minutes to 5 hours before it locks up.   Once it locks up, there is nothing I can do to recover outside of power cycling the Nano.

I have also built the program as an EXE.  These are created with 2011 so if you wanted to run the EXE you would need the 2011 runtime.    If you use something other than COM4, just stop the app, select the port and run it.  You should see roughly 3.8 seconds per frame. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 27, 2020, 09:22:52 pm
I had ran it one last time for over three hours with my software and the V2+ did not hang.   |O

It makes no sense that their software wouldn't cause the problem but maybe it has something to do with them plotting the data real time and it just slows it down enough.

I changed that test code to try to force the fault.   You can play around with more data, and throttle it.  The  Nano will stop sending data but it seems I can always get it to recover.   Maybe it has to sit in this mode for a long time before it hangs. 

Back to testing with their software.  Note the 98MHz glitch I saw with my software.  Totally random.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 28, 2020, 03:23:32 am
I think I may have stumbled onto a way to recover from the lockup.   If you run that last program, bump the elements to 2, it should lock.  Most likely it will recover just by starting and stopping the Labview software.  When I see the V2+ lock, resetting Labview has no effect.   I have have had this program cause it to lock this way as well by doing what I describe. 

I mentioned earlier that the port appears to still be open.   Requesting a read from the FIFO with the number of elements set to zero will recover from a soft lockup.   Seems very easy to replicate.   

Imagine telling someone driving down the highway that they need to pull off to the side of the road and disconnect their battery terminal to reset the ECM fault.   

I've added this simple change to the main program and will let it run overnight.  With any luck it may be a work around. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 28, 2020, 05:23:11 am
That was a bust.   The V2+ still locked up as before and the 0 element trick didn't help.   The last thing I thought to try was removing the Cypress drivers and going back to the original Microsoft driver.   This is version 10.0.18362.1. 

***************
The MS driver made no difference.    Another possible clue, when looking at the sweep time plot, it never misses a beat.  Also, looking at the data over these long runs, it appears stable.  There are no signs of a problem until the V2+ locks up. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 30, 2020, 04:52:10 am
Trying a 25 point sweep overnight to see if the V2+ will lock.  It's always hung with larger sets but I just want to make sure.   I basically let the Nano throttle the speed, so Labview is asking for data as fast as what the Nano can supply it.  I've tried slowing down the requests before but it didn't seem to make a difference.    The +4 continues to be a rock star and has never locked and it can stream the data about 2X faster.   

Video clip showing it running.   
https://www.youtube.com/watch?v=pbK4xXuyins (https://www.youtube.com/watch?v=pbK4xXuyins)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on November 30, 2020, 02:04:09 pm
After 4.6 hours, it also locked up with the smaller data sets and required the V2+ be power cycled.   

At least we now know it has nothing to do with the number of data points.   Interesting is that I have been using the V2+ for the last few days and didn't have a single lockup. The difference is I was making short tests.  Maybe 10 minutes long at the most.     
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on December 03, 2020, 12:48:38 pm
After a full day of extended testing on the V2+4, it didn't lockup like the V2+.   I think the longest I have seen the V2+ run was maybe 6 hours. 

Looking in the area of 80 to 140MHz on the V2+4, there are two spurs rather than the one seen with the V2+.   The frequency is a little off between the two VNAs.   More interesting is the V2+ spur  would show up at random times, the spurs seen with the V2+4 are always present.    As with the V2+, it doesn't appear to be a local source.   

*****
The V2+4 has now been running for almost 35 hours non stop.   My software treats both VNAs the same. 

Looks like a few people downloaded the test program but with no responses,  I assume no one else was able to replicate the lockup.  It could be that I received a bad unit.  This came right from the main supplier which I understood was the only way to make sure you were getting a quality product.  I'll take it apart and see if there looks like any problems with their soldering.   

****
The soldering seems fine so while it was apart, I connected only the control board to the PC (no LCD).  It's been running about 4 hours now.  I'll let it run overnight and see if this tells us anything.   

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on December 04, 2020, 02:07:26 pm
Running it without the display made no difference.

One difference is that I am still running the V2+4 with a battery installed.   So I installed this LG battery from an old cell phone.  A bit of Kapton tape and some memory foam to hold things in place.   Doubt this would have anything to do with it locking up but if the designers decide to try and correct it, may as well provide as much data as possible.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on December 04, 2020, 10:40:36 pm
Not surprising, adding the battery pack had no effect on my V2+ lockup problem. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on December 05, 2020, 10:11:37 pm
Made some progress on a manual.  I know it's a total shit show but feel free to suggest additions, changes and what not.     

https://github.com/joeqsmith

****
New draft, needs a lot of work..

****
Added TDR section plus a few others.   

****
Added Interpolation

Title: Re: NanoVNA Custom Software
Post by: joeqsmith on December 12, 2020, 12:42:18 am
I have gone ahead and wrote some test software to support the offset loss. 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on January 18, 2021, 08:50:50 pm
Working on my review of the new 4GHz NanoVNA V2 Plus 4.

https://www.youtube.com/watch?v=JgMVYEoA1Zc (https://www.youtube.com/watch?v=JgMVYEoA1Zc)
Title: Re: NanoVNA Custom Software
Post by: Grandchuck on January 18, 2021, 09:43:10 pm
Oh, how often that has happened to me!
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on January 20, 2021, 04:02:28 am
If I needed a set of cables, at $60 I would most likely just purchase a second V2+.  I could then check if the lockup problem is unique to mine.   Plus I don't mind supporting their efforts.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on January 20, 2021, 01:20:02 pm
For the review, I plan to focus on the V2+4 due to the problems with the V2+.   I'll run the same circuits used with the original Nano plus a few others.   I then plan to run a few experiments with it.

If you have any suggestions on what you would like to see,  feel free to ask.   
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on January 22, 2021, 02:54:55 am
Updates to the manual reflect the revision of software used for my upcoming review.   
 
https://github.com/joeqsmith/NanoVNA_V2Plus
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on January 23, 2021, 04:08:41 am
Review of the new NanoVNA V2 Plus 4

https://www.youtube.com/watch?v=XaYBpPCo1qk (https://www.youtube.com/watch?v=XaYBpPCo1qk)
Title: Re: NanoVNA Custom Software
Post by: KE5FX on January 23, 2021, 08:20:13 am
Looks like a great contribution, Joe -- especially nice to see the automated crystal measurement functionality.  Shame about the artifacts you were seeing in narrow spans.  I wonder if slowing down the sweep would help with those?

How exactly is the software installed?  Looks like there are 18 files with .zip.xx suffixes...? 
Title: Re: NanoVNA Custom Software
Post by: Belgarath on January 23, 2021, 05:33:01 pm
Hi Joe,

Thanks very much for the exhaustive review, nice to hear about real world measurements.

I just downloaded and installed your software. I will play with it in the next days.

I use a V2+4, I bought a couple weeks ago to play with. About the narrow band measurement, I was having problems for the past week trying to draw a crystal filter using the vna_qt software.

Using the NanoVNAv2+4 in stand alone mode brought some light when used with the averaging (cf. attached pictures). Indeed measurements have been made with fresh SOLT calibration. The filter is a Yaesu 455k 500Hz.

Could this behaviour be caused by clock jittering within the nano ? If so, the various software might benefit to implement the averaging parameter.

Best Regards, 73's

François / F4HTX


update 1 : Added the same measurement with joeqsmith software (450 to 460kHz / 1024pts)


Title: Re: NanoVNA Custom Software
Post by: joeqsmith on January 30, 2021, 04:09:43 pm
Someone had pointed out that VISA was missing from the installer.  I have rebuilt the installer to include it.   No changes were made to the NanoVNA software.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 07, 2021, 06:01:10 pm
A few people have asked me about the software missing.  It was moved to released. 
Title: Re: NanoVNA Custom Software
Post by: KE5FX on February 07, 2021, 06:43:42 pm
A few people have asked me about the software missing.  It was moved to released.

Gotta say, I still have no idea what to do with 21 .zip files.  How about a standardized installation procedure? :)
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 08, 2021, 04:23:21 am
It's just a spanned zip file to get around Github's file size limitation.   

https://sourceforge.net/p/sevenzip/discussion/45798/thread/9cefe2c2/
Title: Re: NanoVNA Custom Software
Post by: Adiy on February 26, 2021, 02:02:53 pm
The program seems to be a great tool for NanoVNA  :) and I am able to run V2+ with the LabVIEW code without any hardware issue as of now.
I want to perform S11 sweeps continuously and store the files therefore I want to know the following:
1. How can I change the frequency sweep?
2. How can I can get the real and imaginary parts of the data? I use the USB sniffer software (device monitoring studio) to monitor the port (COM 3 in my case) but still unable to decrypt from the long strings of data (up and down)
3. In the program there are some hex numbers passed to the serial port like 2300 4042 0F00 0000 0000, what is the reason of this arrangement? is there any command list documentation available?


A reply would be really appreciated.

Best Regards
Adiy 
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 26, 2021, 05:56:26 pm
The program seems to be a great tool for NanoVNA  :) and I am able to run V2+ with the LabVIEW code without any hardware issue as of now.
I want to perform S11 sweeps continuously and store the files therefore I want to know the following:
1. How can I change the frequency sweep?
2. How can I can get the real and imaginary parts of the data? I use the USB sniffer software (device monitoring studio) to monitor the port (COM 3 in my case) but still unable to decrypt from the long strings of data (up and down)
3. In the program there are some hex numbers passed to the serial port like 2300 4042 0F00 0000 0000, what is the reason of this arrangement? is there any command list documentation available?


A reply would be really appreciated.

Best Regards
Adiy 
I wouldn't be at all surprised to hear about problems with that software.   It's really an engineering tool that I put together to evaluate the Nano.   

It sounds like you haven't actually taken the time to read the manual or even watch the video as both certainly cover your first question.  I suggest you start there. 

I don't understand what you are asking with your second question.   Combined with your third question, it sounds like you would like to write your own software.  The best thing to do may be do download the open source code and start there.  There are also several groups for the various versions of the Nano that you may want to consider joining.   If that's your end goal, I would not waste your time with the manual or video as I don't go into any details about the protocol or any of the math behind it. 

Yes, the designer's of the V2+ made a command document available that everyone may freely download from their site.     
Title: Re: NanoVNA Custom Software
Post by: Miti on February 28, 2021, 07:43:56 pm
Looking in the area of 80 to 140MHz on the V2+4, there are two spurs rather than the one seen with the V2+.   The frequency is a little off between the two VNAs.   More interesting is the V2+ spur  would show up at random times, the spurs seen with the V2+4 are always present.    As with the V2+, it doesn't appear to be a local source.   

@joesmith,

I can't duplicate the spurs that you see on my V2+4. The first time I tried, there was a clear single spur around 136MHz, but after a power cycle, it was gone. After each power cycle I get (or not) different spurs in different places. See below.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on February 28, 2021, 10:16:21 pm
I wonder if you were to increase the number of sample points like I show if you would see two of them.
https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3352770/#msg3352770 (https://www.eevblog.com/forum/rf-microwave/nanovna-custom-software/msg3352770/#msg3352770)
Title: Re: NanoVNA Custom Software
Post by: Miti on March 01, 2021, 01:07:25 am
Wouldn’t reducing the span achieve the same thing? Unless these spurs are dependent on frequency and span settings and the moon phase, which I’ve seen on an HP SA at work (there’s an internal spur that shows up only at a narrow range of center frequency and span settings), reducing the span around the frequencies of interest would give me more resolution.

Edit: The forum does whatever it wants when posting from mobile. I couldn't get it to attach two different pictures. Now should be correct.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on March 01, 2021, 01:55:15 am
I have no idea but if you wanted to try and replicate what I have, I would start with the same settings.  If you like, I could also try running mine in other configurations as well.   

I haven't seen the V2+4 available for some time.   We are now waiting to see one of these 6GHz units on the market.   
Title: Re: NanoVNA Custom Software
Post by: Miti on March 01, 2021, 02:09:01 am
How do I do that, I thought you don’t share your SW.
Title: Re: NanoVNA Custom Software
Post by: Miti on March 01, 2021, 11:41:27 pm
Here are some screen shot using the crappy "VNA View" with 401 and 600 points.
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on March 06, 2021, 11:00:20 pm
Ever wonder how much torque it takes to rip an end launch connector off a circuit board? 


https://www.youtube.com/watch?v=HiJVeQvqtsM (https://www.youtube.com/watch?v=HiJVeQvqtsM)
Title: Re: NanoVNA Custom Software
Post by: DrNefario on March 07, 2021, 07:47:04 pm
Great work!  Thank you very much.  I successfully installed the NanoVNA V2 Plus ver 0.10 and ran the setup.
I know that the manual says that the software supports both the NanoVNA V2+ and V2+4, however I see from some of the posts (i.e. reply # 716, 3p68xtal_originalNano.PNG ) that the original NanoVNA seemed to have some support.  I have the original and not the V2+ or V2+4 yet. I would like to add a transfer relay to be able to get 4-port S-Parms, so I tried to run with v0.10 and don't get the green light on the "Link" command button.  It does seem able to communicate with it as in the status window I see "NanoVNA V240+,Protocol 241, FW 243.244".  Note that I had upgraded the FW a couple of times and have been using it with NanoVNA-Saver.
My question: is there any way to get this to work with your software or is support for the original not planned?  - Maybe with different firmware?
Title: Re: NanoVNA Custom Software
Post by: joeqsmith on March 07, 2021, 10:56:15 pm
Dr Nefario,

Great work!  Thank you very much.  I successfully installed the NanoVNA V2 Plus ver 0.10 and ran the setup.
I know that the manual says that the software supports both the NanoVNA V2+ and V2+4, however I see from some of the posts (i.e. reply # 716, 3p68xtal_originalNano.PNG ) that the original NanoVNA seemed to have some support.

You are correct that the manual mentions and this thread certainly covers that I did write some software to support the original Nano.    You are also correct that my manual states:

•   Supports both the NanoVNA V2+ and V2+4

It also states in the scope:

Quote
This software can be viewed as an engineering tool at best.  Its primary use was to extend the author's understanding of V2+.  It was never intended to be used as a general tool for radio hobbyist to tune their antennas.  The software is fairly buggy and not very robust.  Even under normal conditions, expect to run into several problems if attempting to use this software. It’s a very poor choice for the beginner. 

I will assume that paragraph doesn't pertain to you personally. 

I have the original and not the V2+ or V2+4 yet. I would like to add a transfer relay to be able to get 4-port S-Parms, so I tried to run with v0.10 and don't get the green light on the "Link" command button. 

Seems normal.  I didn't try to run this software with anything except what the manual calls ou