Author Topic: NanoVNA Custom Software  (Read 464033 times)

0 Members and 2 Guests are viewing this topic.

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1650 on: February 02, 2022, 05:02:14 pm »
It's a round robin average.  While you are always getting the averaged data at what ever rate the VNA is sending it, if it's 10 deep and the Nano sends data once a second, it will take 10 seconds to rifle through (think step response).  If you are tuning a filter (or anything else with trimmers) I would imagine you want instant feedback.  You may be able to reduce the number of data points to obtain acceptable feedback but I doubt it.  You may also be able to give up the average features but if you are working with communications, again I doubt it.  Even with average, I doubt they are good enough for this kind of work.   I think its a case where you would need something better than the Nano.  This is something the CB and amateur radio hobbyist would need to chime in on. 

I do not understand what you are trying to do with these delay lines you keep mentioning which is why I had asked you once to explain it.  It should be obvious that the more you extend them, TDR would show a longer time of flight.   Maybe just post a short video clip of your setup and what it is doing.  Then explain in text what you feel it should be doing.   

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1651 on: February 02, 2022, 11:57:57 pm »
DH7DN had posted an article about using the V2Plus4 with my software. 
https://physik.co-i60.com/2022/01/new-addition-to-the-lab-nanovna-v2-plus4/

Quote
First steps

Buy NanoVNA, plug in the USB cable and turn it on. If you’re using Windows 10, the device should be recognized as USB CDC (Communications Device Class) on a virtual serial port (e. g. COM6). Next steps will be a little bit annoying: create an account on the National Instruments (NI) homepage, download and install the NI LabVIEW Runtime Engine (Version 2011 SP1 32-bit, size ca. 215 MB) and NI VISA. I have installed VISA v17.0 which is a 750 MB chonker.  It contains drivers for USB/Serial communications any many others (also some important drivers for my obsolete GPIB test equipment which aren’t supported in the newer versions anymore). Install VISA and the Runtime Engine and spend your precious life with many reboots. I highly recommend to read Joe Smith’s User Manual, otherwise you may run into problems.

Word of advice, take the time to read the README file.  I'm impressed that they were able to get it all working. 
« Last Edit: February 03, 2022, 12:01:01 am by joeqsmith »
 
The following users thanked this post: DH7DN

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1652 on: February 04, 2022, 01:31:24 am »
Dislord,

I am planning to add the ability to reprogram the VNA from my software.  Looked simple enough... 

What are the userArguments e8..eb that passed to the program upon soft reset?
When programming the device, what is the flashwritestart set to? 

I attempted to program the device using a start address of 0.  F0 - F4 appear correct. Minor revision reports 0.   I see the ASCII 2 for the indicate commands and am able to jump after the file has been loaded.   However, when I check the version in the menu it has not been updated.   

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1653 on: February 04, 2022, 05:58:07 am »
Sniffing the bus, the address doesn't appear to be 0 as I guessed.   I changed my start address to match but still no luck. 

***
Sniffing when their software is sending the programming file,  they appear to always append the array with 0x0d.  None of these basics appear to be covered in the documentation.   I don't see any other problems with my software and suspect this is the last problem. 
***
:palm: After some sleep, the 0x0d is the Indicate command... :-DD
« Last Edit: February 04, 2022, 03:25:16 pm by joeqsmith »
 

Offline realfran

  • Regular Contributor
  • *
  • Posts: 65
  • Country: gb
Re: NanoVNA Custom Software
« Reply #1654 on: February 04, 2022, 11:34:01 am »
This will be great!!! Especially the reset if it's possible to change de firmware from the PC without pushing the jog button on it.
This is for the people using Nano/Lite with the PC is very useful (for people with sigth problem like me great).
There is a possibility to enlarge the screen size to fit on the monitor?
Thank you for all your improvement on the software.  :-+ :clap:
 

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1655 on: February 04, 2022, 02:31:39 pm »
Firmware start address (uint32_t register 0xe0):  V2/Lite = 0x8004000, for V2Plus4 = 0x800C000 !! this value changed in Bootloader!! need write as for V2 = 0x8004000 (bootloader ignore less values for prevent write in it, this allow reduce chance erase bootloader code)

At device startup bootloader check pressed button (Right for V2 or Center on Lite) if pressed enter to firmware upload mode

In fw upload mode set this settings in Version registers:
   // set version registers (accessed through usb serial)
   registers[0xf0] = 2;   // device variant (NanoVNA V2)
   registers[0xf1] = 1;   // protocol version
   registers[0xf2] = 0;   // board revision (always 0 in bootload mode)
   registers[0xf3] = 0xff;   // firmware major version (0xff in bootload mode)
   registers[0xf4] = 0;   // firmware minor version

So you can read it and detect V2/Lite in firmware upload mode.

Write in 0xE4 register - write in flash

For exit booload mode (reset devide) need write in registers[0xef] = 0x5e
« Last Edit: February 04, 2022, 02:44:23 pm by DiSlord »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1656 on: February 04, 2022, 03:35:35 pm »
Dislord,

Thanks for saving me some time.  I wouldn't have guessed these would all require a different address.  Why doesn't the boot loader handle it?  Is there a way to query the address to make it more generic?  I have no idea what the V2 is.  Does it use the same protocol as the Lite and V2Plus4?

As realfran asked, is there a command in the application to drop to boot?  It would make sense to automate the whole process. 
 
Programmer is now working well (I tried 10 reloads, toggling versions with no errors). 

***
Wait... are you telling me I have to run the application first to determine what hardware is installed, then drop to the boot?   It sure looks like the Lite and V2Plus4 manuals are showing the same values for F0-F4 when the bootloader is running.  Surely with 5 locations we could sort that out. 
« Last Edit: February 04, 2022, 03:47:24 pm by joeqsmith »
 
The following users thanked this post: realfran

Offline realfran

  • Regular Contributor
  • *
  • Posts: 65
  • Country: gb
Re: NanoVNA Custom Software
« Reply #1657 on: February 04, 2022, 04:36:58 pm »
thank you.  :-+
 

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1658 on: February 04, 2022, 05:13:49 pm »
V2 - any NanoVNA V2.2 devices:
https://nanorfe.com/nanovna-versions.html

V2Plus4 bootloader contain all close source part for measure and DSP processing, this need more bigger size for it 48k for V2Plus4, and 16k For other), but for allow write by old software use 0x8004000 address. I can`t detail answer about V2Plus/Plus4 bootloader structure.

Rewrite bootloader - more difficult part, need use STLink. Used in V2/V2Plus/V2Plus4 GD32F303 MCU not contain DFU mode (not allow easy programm it over USB). So change bootloader/fix it more difficult.
Additional V2Plus/Plus4 boorloaders depend from MCU serial number - used for protect it from copy.

In LiteVNA used AT32F403
https://www.arterychip.com/en/product/AT32F403.jsp
Allow use DFU mode, but need ATlink software
https://www.arterychip.com/download/AT_Link_EN_20210427.zip
For enter in DFU mode need connect bootpins on board and power on.

You can`t detect hardware version in bootloader mode (all devices answer as i write)

I can add command for enter in booloaded mode in next version firmware, example write in registers[0xef] = 0x5e, but only on next firmware version.
« Last Edit: February 04, 2022, 05:28:34 pm by DiSlord »
 
The following users thanked this post: sarming


Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1660 on: February 04, 2022, 05:32:50 pm »
Thank you for providing these details.   That's too bad about the system architecture.  I'll just add a selection for the target device.   

I used the QT software to load your application code and every time, I cringe.   :-DD   I think it's safe now to get rid of it.

If you do decide to provide a unique ID within those 5 fields, let me know.  I still have that ST-link for programming the original NanoVNA.   

***
If you have any concerns about adding the drop to boot command, don't.   It would be nice to have but the V2Plus4 doesn't support it and I can imagine that it may be too confusing for the users. 
« Last Edit: February 04, 2022, 05:36:21 pm by joeqsmith »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1661 on: February 04, 2022, 11:30:57 pm »
FYI: a discussion about VNA calibration  error models goes here:
https://groups.io/g/nanovna-users/topic/34237712

This paper seems directly related to the Unknown Through Calibration error model, as I understand:
https://www.researchgate.net/publication/358164808_Measurement_Uncertainty_in_Network_Analyzers_Differential_Error_Analysis_of_Error_Models_Part_4_Non-Zero_Length_Through_in_Full_Two-Port_SLOT_Calibration

Thanks.  I had read that email chain and was talking with a friend about it the other day.  The translation makes it difficult for me to follow.   It will require I spend a lot of time to try and make sense of it. I did not download the tools and source code to try and replicate their tests.   I also didn't read their final report.  There were some other nuggets I found in that mail chain but again, it takes time to research.   Did you read it and attempt to follow? Were you able to rebuild their code as well?

I've read up to where they had started to post their BASIC programs.  I attempted to run some of what they have shown but I have not tried to feed in my own data.   So far, everything is a one port but I skipped to the end and see they also discuss a 2-port system.  While they mention the NanoVNA throughout the thread,  I have not seen where they added their algorithms to the open source software.   

Dislord, have you tried to port any of their work into the firmware?   

Offline Alextsu

  • Contributor
  • Posts: 42
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1662 on: February 05, 2022, 06:26:22 am »

I've read up to where they had started to post their BASIC programs.  I attempted to run some of what they have shown but I have not tried to feed in my own data.   So far, everything is a one port but I skipped to the end and see they also discuss a 2-port system.  While they mention the NanoVNA throughout the thread,  I have not seen where they added their algorithms to the open source software.   
It appears to be more a theoretical work, as far as they had published several scientific papers on the topic. I doubt it may have any practical implementation in low-cost VNA FW code.
Their last paper about 2-port systems analysis might trigger some discussion on the topic, but the subject seems too complicated to dive deep into details
 

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1663 on: February 05, 2022, 04:01:08 pm »
I use this as base for calibrations.

Also add calibration standard suport, for this part i use various sources.
I had to deduce some formulas myself and optimize the calculations. Since initially they were very cumbersome for calculations (a large number of calculations in complex numbers is quite resource-intensive for the microcontroller, especially since hardware support for floating point numbers is disabled in V2/V2Plus/V2Plus4, since not all GD32F303 processors have this module. The processor in Lite is faster and there support is always on).

For thru calibtaiton most good result show ISOLN/THRU calibration as on H/H4. It allow good remove leakage from measured data.
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1664 on: February 05, 2022, 04:40:11 pm »
It appears to be more a theoretical work, as far as they had published several scientific papers on the topic. I doubt it may have any practical implementation in low-cost VNA FW code.
Their last paper about 2-port systems analysis might trigger some discussion on the topic, but the subject seems too complicated to dive deep into details
I tend to agree with some of the comments posted in that chain.  It would have been very helpful had they started with a clear description of the problem they are trying to solve.  This should have been able to be boiled down to a paragraph.   

Minimize the errors introduced by existing  known models.  Provide an approach that allows the error model to run more efficiently.   Decouple the error model from the hardware used.    As an example.  I'm not suggesting these align with their goals.

One person was attempting to follow along which has helped me.  Several pages into it, they still seem unsure what the goals are, which is my take when reading it. 

With their emphasis on the NanoVNA,  I would assume the are suggesting their models offer some benefits.  At least for the single port error model they presented, it would be easy enough to experiment with.   

I use this as base for calibrations.

Also add calibration standard suport, for this part i use various sources.
I had to deduce some formulas myself and optimize the calculations. Since initially they were very cumbersome for calculations (a large number of calculations in complex numbers is quite resource-intensive for the microcontroller, especially since hardware support for floating point numbers is disabled in V2/V2Plus/V2Plus4, since not all GD32F303 processors have this module. The processor in Lite is faster and there support is always on).

For thru calibtaiton most good result show ISOLN/THRU calibration as on H/H4. It allow good remove leakage from measured data.

Thanks for the post.  Did you choose to follow their work because of it requiring less resources (memory, CPU...), or did it provide a more accurate result?   Both?   If you tried other methods when making the choice what model to use,  I would be very interested in seeing any metrics you collected along the way.   

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1665 on: February 06, 2022, 02:47:05 am »
I am curious if anyone else with the Lite had noticed a random shift problem?   It seems to be bimodal, or always recovers.  I've seen it when running various tests but it's been rare. 

***
Looking at other times I have seen it, the amount it shifts may be constant.
« Last Edit: February 06, 2022, 03:05:08 am by joeqsmith »
 

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1666 on: February 06, 2022, 06:29:40 am »
S11 or S21 measures? Frequency?

I never see phase shifts, on device or on NanoVNA-App.
I see amplitude shift on my test AGC variant (The problem is that the gain depends slightly on the frequency and it is difficult to correctly connect different levels, it runs up to 0.1dB of error)

PS i possibly know source of problem, but not sure. You see this on device stanalone?
« Last Edit: February 06, 2022, 08:43:23 am by DiSlord »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1667 on: February 06, 2022, 02:37:10 pm »
That was S21, 100MHz.  I don't normally use these devices standalone and have not seen it.  Again, it's rare and appears random.   After that post, I let it run that same configuration for about a half hour and never saw it. 

Anytime I have noticed it, it was a downward shift.  I think it is always the same width and height but am not sure.  I've been ignoring it. 

Of course, it is very possible it's my software but I am not sure what the cause would be.  My software checks each packet and it seem fine. This last example was without any calibration or normalization.  It's about as close as I can get to the raw data from the Lite.   

If there is something you would like me to try in order to isolate the problem, let me know.   

***
Also, this was with firmware LiteVNA64-220127.   I had tried the touchscreen test before and after this install and indeed, it works MUCH better now near the edges.   
« Last Edit: February 06, 2022, 02:43:00 pm by joeqsmith »
 

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1668 on: February 06, 2022, 04:34:50 pm »
On 100MHz device switch generator mode, so i think know source of problem.

In V2.2 / V2Plus / V2Plus4 used 2 generators

Si5351 - cover 2 bands:
< 100MHz use fixed PLL and variable multiplier for set frequency
>= 100MHz and < 140MHz use fixed divider and various PLL
On switch generator mode possible unstable work.
For >= 140MHz used ADF4350 (or MAX2871 in Lite)

In future for Lite i move switch to MAX generator to 100MHz (ADF not allow work on less 140MHz, MAX allow work from 26MHz)
 
The following users thanked this post: tungsten2k

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1669 on: February 06, 2022, 06:26:37 pm »
I tried several tests at 900MHz and could not reproduce the step.   Over the last few weeks, for the most part I have been testing below 100MHz.  I can believe it is somehow related to that.   

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1670 on: February 07, 2022, 01:50:26 pm »
I continued testing the entire day (12 or so hours, using the PC only) above 200MHz without a single problem.  Even with that rare step, the Lite with this version of firmware has been very stable. 
 
The following users thanked this post: realfran

Offline realfran

  • Regular Contributor
  • *
  • Posts: 65
  • Country: gb
Re: NanoVNA Custom Software
« Reply #1671 on: February 11, 2022, 10:26:25 am »
NanoVNA V2 Plus5 $329.00 difference:Max sweep rate: Specifications:

    Frequency range: 50kHz - 4GHz
    System dynamic range:
        90dB up to 1GHz (V2 Plus4, AVG=20)
        90dB up to 1GHz (V2 Plus5, BW=1.6kHz, AVG=5)
        80dB up to 3GHz (V2 Plus4, AVG=5)
        80dB up to 3GHz (V2 Plus5, BW=1.6kHz, NO AVG)
        S11 noise floor (calibrated): -50dB (up to 1.5GHz), -40dB (up to 3GHz)
       600 points/s (V2 Plus5)
 :-DD god business
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1672 on: February 11, 2022, 02:21:36 pm »
There is no mention of supporting the power setting,  solving or improving the noise when running from an external power supply.    Maybe its a firmware change.   I have no plans to purchase one.  If they made ANY changes that requires additional software updates, I will not be supporting it.   

Dislord,
When running CW, why isn't the data rate faster than with swept mode?  Is it throttled for a reason? 

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1673 on: February 11, 2022, 04:14:40 pm »
Quote
When running CW, why isn't the data rate faster than with swept mode?  Is it throttled for a reason?

By default point measure look like this:
1 - set frequency, disconnect output, connect reference trace to ADC
2 - wait lock time
3 - measure reference (in this measure output disconnected)
4 - connect output, and connect reflect trace to ADC
5 - wait N*IF period time (N - integer, need for phase sync)
6 - measure Reflect
7 - connect thru trace to ADC
8 - wait N*IF period time (N - integer, need for phase sync)
9 - measure Thru
.........
repeat

In CW mode step 1-4 made only for first point.
After need hope all switch for step 5-9 good phase sync, not lost any data. On device measure i can grab data and not lost sync. On usb, possible situation then buffer full, and need wait then CPU software grab data, at this moment possible lost it, and as result get wrong phase, so CW mode disabled for USB.

Anyway, at this moment i rewrite all DSP part (i add auto gain select for all measure phases), i hope this allow little faster sweep/more dynamic range in reflect measure, and solve some more problems. But need test it more.
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11737
  • Country: us
Re: NanoVNA Custom Software
« Reply #1674 on: February 11, 2022, 05:57:06 pm »
After our friend had posted about monitoring their heart rate and breathing, I had wondered why it would not be faster.  With you working on the firmware for the Lite, maybe you could improve it.   

It's odd that the software can not keep up.   Are you using my software or something else?   

For their heart rate experiment, it seems it was good enough but I have wanted to run similar experiments that would require a higher sample rate.   If you wanted to try sending the data up 2X, 4X, or even higher, I would certainly be willing to see if my software could keep up. 

Similar if you wanted to try and resolve the dip I see at the lower frequencies, I would certainly be willing to test it. 

***
For example showing MFSK and two chirp wave forms in sequence.  It's not a lot of data, 401 * 500 or 200,000 samples but software keeps up just fine.   
« Last Edit: February 11, 2022, 06:33:40 pm by joeqsmith »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf