Author Topic: NanoVNA Custom Software  (Read 523715 times)

0 Members and 2 Guests are viewing this topic.

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1650 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 #1651 on: February 04, 2022, 04:36:58 pm »
thank you.  :-+
 

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1652 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: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1654 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: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1655 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 #1656 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 #1657 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: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1658 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: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1659 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 #1660 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: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1661 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 #1662 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: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1663 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: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1664 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. 

Offline realfran

  • Regular Contributor
  • *
  • Posts: 65
  • Country: gb
Re: NanoVNA Custom Software
« Reply #1665 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: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1666 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 #1667 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: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1668 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 »
 

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1669 on: February 11, 2022, 06:15:42 pm »
You can increase sweep rate by use my debug registers.

0xE0 - for Si5351 (< 140MHz range)
0xE1 - for MAX (>140MHz)

This regisers by default = 15, set IF periods count for one measure
This mean for one point measure use 300 samples (for frequency > 400Hz, in this case one period = 20 samples, for less frequency one period 100 samples)
Average multiplie this value, so on 2xavg use 2x300 = 600 samples and so on

You can use any non zero value. !!! this registers i use for debug, so not check for 0)!!!

Use 1 allow get high sweep rate, but more noise (in this case sweep time limit only USB bus speed and wait/sync delays)

PS try use USB 2.0 port on CPU, as i see it allow get more sample rate then USB3.0
« Last Edit: February 11, 2022, 06:29:38 pm by DiSlord »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1670 on: February 11, 2022, 06:39:08 pm »
Thanks.  I will add the ability to change this setting and let you know how it works. 

My newer software supports sending the demodulated signals to the sound card.   Maybe we can do some audio. 

***
spelling
« Last Edit: February 11, 2022, 07:33:22 pm by joeqsmith »
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1671 on: February 11, 2022, 07:30:58 pm »
I added manual control to these two registers.   Changing from 1 to 15 seems to have no effect on the data rate to the PC.   I tried both synthesizers at 10MHz and 200MHz.  No change (except the slower sweep rate for the lower frequency). 

I still have LiteVNA64-220127.bin firmware installed.   Does the released code support it?   Do I need to be in a certain state before changing the registers for them to take effect?   

Offline DiSlord

  • Regular Contributor
  • *
  • Posts: 108
  • Country: ru
Re: NanoVNA Custom Software
« Reply #1672 on: February 11, 2022, 08:13:04 pm »
Hmm, i write to E0 (send 0x20 0xE0 0x01)

And get ~660 samples/sec sweep on 1xavg in < 400k range

Here is my last beta, in it i rewrite DSP part, now for all measures select best gain (before only for thru).
Also  must get little less noise floor and more linear thru measure on hi frequency, but this still beta, i want add more fixes.
 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1673 on: February 11, 2022, 08:26:13 pm »
It's very possible it's on our side.    At 10MHz, I was seeing an update rate of 1000ms for 401 data points, 1 avg at 10MHz.   Writing a one to E0, I still see 1000ms.   I'll try your current firmware. 

Offline joeqsmithTopic starter

  • Super Contributor
  • ***
  • Posts: 11716
  • Country: us
Re: NanoVNA Custom Software
« Reply #1674 on: February 11, 2022, 09:01:36 pm »
With the new firmware installed, it seems to speed it up about 100ms.   

If you turn off S11 and only send the S21 data, could you then skip all the delays?   Do you have have another debug register to select what data comes back? 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf