Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw s21 phase at low frequencies #81

Open
owenduffy opened this issue Jun 8, 2024 · 8 comments
Open

Raw s21 phase at low frequencies #81

owenduffy opened this issue Jun 8, 2024 · 8 comments

Comments

@owenduffy
Copy link

I am using NanoVVNA-H4 v4.3 and firmware v1.2.30.
I expected that raw (ie uncorrected) s21 phase would be close to 0°.

nanovnah4_20240608_132439i

Instead, it is close to 180°.

Looking at the schematic:

Screenshot-240528110137

The polarity of Port 2 connection to the mixer is opposite to Port 1 which I assume needs to be undone in the firmware... but is it?

Owen

@DiSlord
Copy link
Owner

DiSlord commented Jun 8, 2024

Yes, measure S21 L/R pins swapped on AIC codec input, not possible change this by software
Need swap RAW data, but this need more processor time
Anyway this fixed by calibration

@owenduffy
Copy link
Author

...
Looking at the schematic:
...
The polarity of Port 2 connection to the mixer is opposite to Port 1 which I assume needs to be undone in the firmware... but is it?

Rechecking the schematic, the polarity of the signal path for mixers U6 and U8 appear correct, yet measurement of raw s21 saved by the firmware is of opposite phase to that expected as in the screenshot.

Nevertheless, raw s21 is opposite phase to expected as show in the screenshot.

Yes, correction masks the problem... but if one wants to extract raw measurements to correct elsewhere, then all the s21 figures have to been inverted to make sense.

So the question is why is s21 inverted, and it seems as I understand it, the fix involves multiplying the raw Port 2 measurement complex value by -1, so real and imaginary parts each *-1... or undoing where they are incorrectly inverted in the current firmware?

The discussion at An experiment with NanoVNA and series through impedance measurement shows that the 'corrected s21' from the firmware is flawed which leads to the reported values of series through R and X being wrong.

Owen

@DiSlord
Copy link
Owner

DiSlord commented Jun 9, 2024

I double-checked everything and didn't find any errors.
Measurements of S11 and S21 take place along the same path, the inputs are switched in the audio codec. Reference channel IN2 is always connected to the left channel of the codec, and IN1 (reflected signal) to the right, alternately with IN3 (THRU)

At the same time, when changing channel 1, there are no problems with the phase, but in channel 3 it is rotated 180 degrees, as if the differential inputs R and L were reversed. There is no way to programmatically connect them differently

@owenduffy
Copy link
Author

owenduffy commented Jun 9, 2024

Thanks for the checking.

Let me try to explain the schematic given earlier.

Let's look at the AC voltage applied to mixer U6 (call it Vs), pin A is high, pin B is low so Va-Vb is approximately in phase with the CLK1 voltage.

Let's put a short on the TX jack, so the AC voltage on mixer U7 (call it Vr) pin B is low and pin A is high... so Va-Vb is approximately in phase with the CLK1 voltage.

Now this Vr is in phase with Vs, so to correctly calculate s11 (which is -ve for a short), the code must calculate -Vr/Vs. (The raw s11 saved to a .s1p file for short is correctly a -ve value.) Somewhere s11 calculation must include an inversion, as you note it is not in the schematic.

Now look at mixer U8 used for s21. Va-Vb is approximately in phase with RX voltage, and in phase with TX voltage and CLK1 if Port 1 is connected to Port 2 with a very short cable... so no inversion is required to calculate s21.

Perhaps what is happening is that both s11 and s21 calcs invert when only the s11 should invert (ie multiply by -1) and s21 should be non-inverting?

@owenduffy
Copy link
Author

owenduffy commented Jun 13, 2024

It appears that this is fixed in v1.2.32???

Thanks.

Owen

@franciscosalvat
Copy link

where do I download version 1.32? I only see 1.2.29, thanks

@Ho-Ro
Copy link
Contributor

Ho-Ro commented Jul 9, 2024

The latest released version from April 8th is still at 1.2.29.

To get the very latest version you should build it on your own. Just follow the instructions of the README.md. The current GitHub version, i.e. at the time of writing this comment, is

#define VERSION "1.2.36"

If you do not need the bleeding edge you can download the FW from my repo where I provide quite recent builds from DiSlord's original FW, you can get e.g. NanoVNA-H.bin and NanoVNA-H4.bin as well as *.hex. and *.dfu files - on the main page left click on the file name

image

and select Download on the next page

image

Currently at 1.2.33, will be updated during the next few days.

And if you have an older -H without SD card you can use my modified FW that supports 8 calibration slots instead of the 5 original ones - current build is from DiSlord's latest version 1.2.36.

@franciscosalvat
Copy link

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants