Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
Should the builtin TDR mode compensate for FFT window / zero-padding losses?
#tdr
Hello,
please excuse if this has been discussed before ? perhaps I searched the list archive using the wrong keywords. Do you think that the time domain mode built into NanoVNA firmware (in my case: hugen79's version 0.4.5) should correct the displayed amplitude for losses in the IFFT due to windowing and zero-padding? Other VNAs do so: see the attached files, where the same DUT ? an open-ended coax cable ? was measured with a Rohde & Schwarz ZVA and with NanoVNA in time domain mode. Neglecting the (very small) cable losses, the DUT presents a total reflection and is shown as such (¡Ö 0 dB) by the R&S ZVA. In contrast, on the NanoVNA, the peak depends on the selected mode (bandpass, lowpass impulse or lowpass step) and on the selected window. This can be explained by looking at the signal processing performed by the NanoVNA firmware. For example, in bandpass mode with normal window, it applies a 101 point Kaiser window (shape factor 6) [1] and zero-pads to do a 256 point IFFT. Therefore, the loss is 20*log10(256/sum(kaiser(101,6))) ¡Ö 14.2 dB. Actually, the peak in the NanoVNA result (blue curve) reads as ca. -14.6 dB, which matches very well. Imho, the firmware should correct these systematic losses that happen purely by signal processing in order to give a result consistent to expensive VNAs. (Keysight does the same as R&S here. [2]) But maybe this topic was already discussed and a there was a good reason _not_ to correct the losses in NanoVNA? Regards Christian [1] [2] Keysight's time domain app-note even states "There is also some scaling and renormalization that takes place to ensure the value of the time domain transform retains its physical meaning. For example, the frequency response of the S11 of an ideal open circuit, with no delay, has a value of 1 for all frequencies; its inverse transform is a delta function. However, when the data is sampled and windowed, the time domain transform of the response of an open circuit will be spread by the windowing function and does not return an impulse of unity height. Therefore, it is necessary to renormalize to ensure that the time domain response of the open circuit has a value of unity." |
Christian,
toggle quoted message
Show quoted text
In the firmware (not necessarily the PC software), the "Low Pass Step" mode appears to give correct step reflection amplitudes when the selected format is "Real". I tend to treat the impulse modes as "indication only". --John Gord On Wed, Sep 23, 2020 at 12:52 PM, Christian Zietz wrote:
|
I might add that you need to remember, the Nanovna is an inexpensive hobby device and although it is quite accurate in many ways, it is not a lab grade device like R&S, Keysight, etc.??
toggle quoted message
Show quoted text
There was only so much memory space to work with at the time and the dev that added the fft routines did a great job.?? You may want to contact edy555 or DiSlord via issues in their Nanovna githubs if you think there is something that needs attention in the firmware.? On Wed, 23 Sep 2020 at 5:46 PM, John Gord via groups.io<johngord@...> wrote: Christian, In the firmware (not necessarily the PC software), the "Low Pass Step" mode appears to give correct step reflection amplitudes when the selected format is "Real".? I tend to treat the impulse modes as "indication only". --John Gord On Wed, Sep 23, 2020 at 12:52 PM, Christian Zietz wrote:
|
I'd think issues like this that don't affect many users may best be addressed
toggle quoted message
Show quoted text
in a program like nanovna-saver. There's not enough room in the ARM flash on the nanovna for everything. Nanovna-saver is open source, anyone really needing this $50 VNA to perform some particular function in the same manner as their $20k Keysight could just go ahead and hack at it. That will likely prove easier and quicker than convincing somebody else to do it. I would not advise pissing off coders currently working on nanovna-saver. They do this because they enjoy doing it, and will stop when they don't. A gentle suggestion might be ok. Jerry, KE7ER On Wed, Sep 23, 2020 at 03:18 PM, Larry Rothman wrote:
|
Thank you, everyone, for your comments.
However, imho, the fact that the NanoVNA is an inexpensive device is no excuse for not correcting a systematic error and not making the NanoVNA an even better device. In particular, if these systematic errors are easily correctable with only minor impact on code size / flash memory usage. (It's just a multiplication that needs to be done.) In any case, I have meanwhile changed/fixed this in a private version of the firmware. Now the peaks of my DUT (open-ended cable) show up as ¡Ö 0 dB in time-domain, regardless of mode and window settings - same as they would do on any other VNA. See attached screenshots. I might consider a Github pull request (with eddy555?) for my FW change. But if the prevalent opinion is that this would be "pissing off coders", I'll keep my change and all further improvements/bug-fixes to my private fork of the firmware. Regards Christian |
So Christian - you're telling the forum members that Nano's firmware is not accurate (in one area) and that you've fixed it in you own private repo, but you're not willing to share the changes with others in this forum that are able to compile the code themselves?
toggle quoted message
Show quoted text
"Pissing off coders" as only one member had opined is a lame excuse and that you >might consider< a pull request??? That's quite brash for someone new to the forum where everyone else shares their ideas and solutions quite freely.?? Think about it. On Thursday, September 24, 2020, 5:56:30 a.m. EDT, Christian Zietz <czietz@...> wrote:
Thank you, everyone, for your comments. However, imho, the fact that the NanoVNA is an inexpensive device is no excuse for not correcting a systematic error and not making the NanoVNA an even better device. In particular, if these systematic errors are easily correctable with only minor impact on code size / flash memory usage. (It's just a multiplication that needs to be done.) In any case, I have meanwhile changed/fixed this in a private version of the firmware. Now the peaks of my DUT (open-ended cable) show up as ¡Ö 0 dB in time-domain, regardless of mode and window settings - same as they would do on any other VNA. See attached screenshots. I might consider a Github pull request (with eddy555?) for my FW change. But if the prevalent opinion is that this would be "pissing off coders", I'll keep my change and all further improvements/bug-fixes to my private fork of the firmware. Regards Christian |
Larry,
I'm all for contributing changes back to the community. I'm a maintainer of multiple open-source SW projects, too. However, the feedback I got to my first email when I courteously wanted to discuss possible changes was only negative: - The NanoVNA is an inexpensive device, so I should not expect it to implement the time domain like a R&S/Keysight VNA would do. - It's not of interest to many users. - It should not be done in firmware for code size reasons. Maybe I'm misreading the emails but to me that's not the warmest of welcomes to someone new to the forum, either. This leads me to the question whether contributing my changes (via pull request) would only result in similar negativity/disinterest. So, why should I try it, then? |
Hi Christian,
toggle quoted message
Show quoted text
Only one member reply talked about 'pissing-off' the devs, which happened when a former forum member demanded that a dev share their code - and the dev shut down their repo to everyone.?? Also, as I had mentioned - almost all the users of the nanovna either didn't notice the issue or were discussing TDR at length in a current and very interesting thread on TDR.?? Remember, most members are Amateurs with minimal knowledge of VNAs and are learning from the various discussions, links and documents in the forum. There was no mention of TDR not being done due to memory constraints - I just said that the original implementation was squeezed into available flash space. Any FW bugs were fixed as they are found. If this is a bug - it should be reported as such so it can be fixed as well. If you know how to fix it, please open an issue on any of the 3 main github repos with an explanation and solution - as many other users have done. The 3 repos would be hugen79, edy555 and DiSlord/NanoVNA-D This forum has a number of retired engineers, PhDs and technologists (all Hams) with a enormous wealth of knowledge and experience that is being shared and discussed.?? Regards, Larry On Thursday, September 24, 2020, 8:33:03 a.m. EDT, Christian Zietz <czietz@...> wrote:
Larry, I'm all for contributing changes back to the community. I'm a maintainer of multiple open-source SW projects, too. However, the feedback I got to my first email when I courteously wanted to discuss possible changes was only negative: - The NanoVNA is an inexpensive device, so I should not expect it to implement the time domain like a R&S/Keysight VNA would do. - It's not of interest to many users. - It should not be done in firmware for code size reasons. Maybe I'm misreading the emails but to me that's not the warmest of welcomes to someone new to the forum, either. This leads me to the question whether contributing my changes (via pull request) would only result in similar negativity/disinterest. So, why should I try it, then? |
Some of the coders that contribute to this
toggle quoted message
Show quoted text
project are a bit thin skinned and people here are kind of protective of them. Anyway if you have found a flaw (which this is) you should definitely post your changes and do a pull request. Whether the maintainer wants to merge your changes is a completely different matter. Those that want your changes will import them in their repos. If enough people do that ... Anyway ignore what other people say and do your thing, this is OSS, anyone can fork ;) On Thu, 24 Sep 2020 at 14:33, Christian Zietz <czietz@...> wrote:
Larry, |
Hi Christian,
toggle quoted message
Show quoted text
my opinion is that your proposal to correct the artifact that currently are present on FW available versions is strongly welcomed! At least I strongly believe that any upgrade is welcome!? Please share your code modifications to every code developer. We must thank you and people like you!?? We are lucky to have in our community people able to share her/his experience and/or lab tests. Few weeks ago I got the beneficial support of Dave Lapp who replayed my call to have a FW version able to use the UART interface we can find on nanoVNA-H (pcb version 3.4). Was I "pissing-off" him? I believe that he was happy to devote his free-time to my request!? This is our hobby! Not only play with cable and connectors! Best regards Piero, I0KPT Il 24/09/2020 14:32, Christian Zietz ha scritto:
Larry, |
On 9/24/20 5:32 AM, Christian Zietz wrote:
Larry,All valid comments for one reason or another. Many folks do ask for improved functionality, and the relatively few people actively developing for the box as volunteers can easily feel like they're responding to customers, not colleagues. It's an open forum, not everyone is tactful <grin> That's sort of different from saying "hey, *I* am willing to implement the changes". Maybe I'm misreading the emails but to me that's not the warmest of welcomes to someone new to the forum, either. This leads me to the question whether contributing my changes (via pull request) would only result in similar negativity/disinterest. So, why should I try it, then?I think you should ask the owners of the various repos (perhaps offline) how they'd like to do it. It *might* be that you wind up forking, and publishing your own repo. Then, at some later time, yours could be pulled in with one of the others, or you could wind up being a major source. I'll just add there's a bit of history here too - there are, as in all online communities, differences in development methodology especially with distribution of trial executable versions vs publishing source tree updates. And, as well, some strongly held and not necessarily tactfully expressed opinions about such things, well beyond whether vi or emacs is the one true editor. Bear in mind that not everyone is comfortable with collaborative multideveloper work on a code base where multiple people are making changes and submitting back on a continuing basis. It does require a somewhat different style of working than cloning a repo and developing as a separate fork, single handedly. I suspect that the existing developers of firmware for the NanoVNA are used to "single developer, single tree" monolithic development. In such environments, you'll never worry about whether diff worked right, or resolving repo hiccups. It's just a directory full of code. Give it a shot - pick a repo from the three (I think there's three) as your base and go for it. |
Ok, as a first step I made my changes public in my own fork/repo: . Sorry, no prebuilt binaries; but this way at least those of you who compile their own FW can already try it. Please be sure to check out the "window_loss" branch, because this is where I committed my change.
Like with every OSS contribution I make, I need to test it more thoroughly myself first. After that, and assuming I don't find any issues with it, I can discuss with the respective repo maintainers if they're interested in incorporating my change. Regards Christian |
Thank you !
toggle quoted message
Show quoted text
I'm sure several of us will build/flash/play with it and provide feedback in the forum. Cheers, Larry On Thursday, September 24, 2020, 11:02:20 a.m. EDT, Christian Zietz <czietz@...> wrote:
Ok, as a first step I made my changes public in my own fork/repo: . Sorry, no prebuilt binaries; but this way at least those of you who compile their own FW can already try it. Please be sure to check out the "window_loss" branch, because this is where I committed my change. Like with every OSS contribution I make, I need to test it more thoroughly myself first. After that, and assuming I don't find any issues with it, I can discuss with the respective repo maintainers if they're interested in incorporating my change. Regards Christian |
Christian,
My apologies for the rather grumpy reply of my earlier post. If you have a fix, by all means submit it to the repositories. They will either include it or not. Imho, the firmware should correct these systematic losses that happen purelyIn my defense, that struck me as suggesting those working on the firmware should restructure their code to give exactly the same result as a high end VNA. All in a microprocessor with only 16k of RAM. Your later post suggests that is not at all the case: In particular, if these systematic errors are easily correctable with only minor impactThat sounds wonderful! I applaud your efforts, and wish to thank you for contributing to what is already an astoundingly useful device that brings VNA's within reach of experimenters. Jerry, KE7ER On Thu, Sep 24, 2020 at 05:32 AM, Christian Zietz wrote: I'm all for contributing changes back to the community. I'm a maintainer of |
Perhaps as a postscript an explanation why this is not merely an "academic" exercise but it has a practical application - at least to me. This is also how I found the discrepancy in the first place.
I have some devices that are basically lines with tunable delay and attenuation. I like to use time-domain transmission (i.e., S21 transformed) measurements in band-pass impulse mode, because these allow me to see both the delay and the average attenuation (over the frequency range chosen in the VNA) at one glance. See the screenshot for an example. This is especially important when tuning the lines because in that way I get an immediate feedback regarding the parameters I'm changing. But, of course, this then requires the magnitude of the impulse response to be free of systematic errors that merely occur due to the IFFT and related signal processing. I hope this explains why I wanted to fix this in the firmware. |
Christian,
toggle quoted message
Show quoted text
That's quite interesting. Having started on the path by using John's instructions to look at some cables here, I'm now quite curious what else can be done with Fourier Transforms on the nanovna. This may be the nudge I need to complete the Steven Smith book on Digital Signal Processing. Perhaps in a couple months when the foul weather hits and I can't work outside. Got about halfway through last year when I was down with a bad back, but will have to re-read and take some good notes as there is a lot of information to digest. The book is highly recommended, a relatively easy introduction to the nuts and bolts of how this sort of thing gets coded. And legally available as a pdf: My forum posts are usually not quite so grumpy as in that first reply to you. In the future, will remember to have a cup of coffee before posting. Jerry, KE7ER On Sat, Sep 26, 2020 at 04:02 AM, Christian Zietz wrote:
Perhaps as a postscript an explanation why this is not merely an "academic" |
You can check my last firmware v1.0.39
/g/nanovna-users/files/Dislord%27s%20Nanovna%20-H%20Firmware Added fixes for this compensation (thanks for OneOfEleven), but extended for use any points count/different FFT size (my firmware allow select different points, up to 401 for H4, also H4 use 512 FFT for support 401 points) |
Epilogue: Hugen has accepted my pull request. Thus, the compensation for TDR mode is going to be part of his next firmware release, I guess. And as mentioned before, DiSlord did also implement a similar correction in his firmware.
If you're curious, you can track further changes I make to the firmware in this Git branch: As of now, these are features I like my NanoVNA to have, and not bug-fixes. Note that while I test my changes on my NanoVNA-H, I still consider my firmware changes in that branch to be experimental. Use them at your own discretion. No binaries provided. Regards Christian |
to navigate to use esc to dismiss