Code Monkey home page Code Monkey logo

Comments (13)

edy555 avatar edy555 commented on May 24, 2024 4

I found a failure. The expression in comment L1074 // Et = 1/(S21mt - Ex)(1 - Es) is incorrect, missing multiplier S11 for Es. The right is Et = 1/(S21mt - Ex)(1 - Es S11).
And assume S11 is 0 in treating thru as an ideal, it becomes Et = 1/(S11mt - Ex).

In short, the fixed code in NanoVNA-H is right.

from nanovna.

EB4FBZ avatar EB4FBZ commented on May 24, 2024 1

It's fixed! Thanks a lot @edy555

from nanovna.

qrp73 avatar qrp73 commented on May 24, 2024 1

yes, I can confirm, now error is smaller than 0.1 dB across entire bandwidth 0.05 - 900 MHz. For 0.05-300 even better - smaller than 0.01 dB :)

Thanks

from nanovna.

EB4FBZ avatar EB4FBZ commented on May 24, 2024

Same ripple present in 9508ea7. Attached photo. Scale is 0.5dB/div.
photo5787182004742238211

from nanovna.

EB4FBZ avatar EB4FBZ commented on May 24, 2024

More examples using both firmwares, allways using the original OSL kit but a quality RG316 50cm pigtail and quality adapters:

  • First test: calibrating for reflection at the end of the cable, using a F-F SMA adapter. Removing the adapter for THRU calibration.

    • Original firmware: orig_S11calCable

    • Commit 9508ea7: 0 1 1_S11calCable

  • Second test: calibrating for reflection at the end of the cable, using a F-F SMA adapter. But this time i add a male-male adapter for THRU calibration.

    • Original firmware: orig_S11calCable_MM

    • Commit 9508ea7: 0 1 1_S11calCable_MM

  • Third test: calibrating for reflection right at the CH0 SMA. Adding the pigtail for THRU calibration.

    • Original firmware: orig_S11calCH0

    • Commit 9508ea7: 0 1 1_S11calCH0

It's clear to me that something weird is happening in newer firmwares. Some wrong interaction between reflection and transmission cal coeffs maybe? If i reset calibration and run a THRU cal without OSL steps, S21 response is perfectly flat.

from nanovna.

qrp73 avatar qrp73 commented on May 24, 2024

Cannot reproduce with the latest change set.
Hardware: NanoVNA-H
CH0 to CH1 cable: 10 cm RG405, soldered SMA

I have -0.2 dB error at 0.05 MHz after calibration, but it is almost flat and smoothly going to +0.1 dB error at 900 MHz.

from nanovna.

qrp73 avatar qrp73 commented on May 24, 2024

When I use RESET and then CALIBRATE THRU only I get almost zero S21 error from 0.05 MHz to 900 MHz. For some reason with a full calibration, there is error from -0.2 dB at 0.05 MHz to +0.1 dB at 900 MHz

from nanovna.

qrp73 avatar qrp73 commented on May 24, 2024

I tried to split calibration into two stages:

  1. OPEN, SHORT, LOAD, DONE
  2. ISOLN, THRU, DONE

And got S21 error almost zero from 0.05 MHz to 900 MHz.

But S11 works wrong after such calibration.

from nanovna.

EB4FBZ avatar EB4FBZ commented on May 24, 2024

I think you are experiencing the same error, but with a shorter cable the ripple period is much longer and not so evident.

You can't calibrate in two stages, once you press DONE, starting a new calibration resets previous one.

from nanovna.

EB4FBZ avatar EB4FBZ commented on May 24, 2024

More examples, this time including phase trace:

  • Stock firmware with full calibration:
    orig_S11calCable_MM_phase

  • Commit 9508ea7 with full calibration. OSL al the end of the cable and then add a male-male adapter for THRU:
    0 1 1_S11calCable_MM_phase

  • Commit 9508ea7 with full calibration but reflection calibration right at the CH0 connector. Then add cable for THRU:
    0 1 1_S11calCH0_phase

  • Commit 9508ea7 with THRU calibration only:
    0 1 1_THRUcal_phase

Something is wrong.

from nanovna.

cho45 avatar cho45 commented on May 24, 2024

This may caused by difference between NanoVNA and NanoVNA-H.

NanoVNA-H does not use ETERM_ES (source match) for calculating ETERM_ET (transmission).

NanoVNA: https://github.com/ttrftech/NanoVNA/blob/master/main.c#L1058

// CAUTION: Et is inversed for efficiency
static void
eterm_calc_et(void)
{
  int i;
  for (i = 0; i < sweep_points; i++) {
    // Et = 1/(S21mt - Ex)(1 - Es)
    float esr = 1 - cal_data[ETERM_ES][i][0];
    float esi = -cal_data[ETERM_ES][i][1];
    float s21mr = cal_data[CAL_THRU][i][0] - cal_data[CAL_ISOLN][i][0];
    float s21mi = cal_data[CAL_THRU][i][1] - cal_data[CAL_ISOLN][i][1];
    float etr = esr * s21mr - esi * s21mi;
    float eti = esr * s21mi + esi * s21mr;
    float sq = etr*etr + eti*eti;
    float invr = etr / sq;
    float invi = -eti / sq;
    cal_data[ETERM_ET][i][0] = invr;
    cal_data[ETERM_ET][i][1] = invi;
  }
  cal_status &= ~CALSTAT_THRU;
  cal_status |= CALSTAT_ET;
}

NanoVNA-H: https://github.com/hugen79/NanoVNA-H/blob/master/main.c#L1103

// CAUTION: Et is inversed for efficiency
static void
eterm_calc_et(void)
{
  int i;
  for (i = 0; i < sweep_points; i++) {
    // Et = 1/(S21mt - Ex)(1 - Es)
   // float esr = 1 - cal_data[ETERM_ES][i][0];
    //float esi = -cal_data[ETERM_ES][i][1];
    float s21mr = cal_data[CAL_THRU][i][0] - cal_data[CAL_ISOLN][i][0];
    float s21mi = cal_data[CAL_THRU][i][1] - cal_data[CAL_ISOLN][i][1];
//    float etr = esr * s21mr - esi * s21mi;
//    float eti = esr * s21mi + esi * s21mr;
//    float sq = etr*etr + eti*eti;
//    float invr = etr / sq;
//    float invi = -eti / sq;
    float sq = s21mr*s21mr + s21mi*s21mi;
    float invr = s21mr / sq;
    float invi = -s21mi / sq;
    cal_data[ETERM_ET][i][0] = invr;
    cal_data[ETERM_ET][i][1] = invi;
  }
  cal_status &= ~CALSTAT_THRU;
  cal_status |= CALSTAT_ET;
}

from nanovna.

qrp73 avatar qrp73 commented on May 24, 2024

cho45, I also notice these changes in calibration calc, but I'm not sure - which version is better?

from nanovna.

edy555 avatar edy555 commented on May 24, 2024

Just fixed at 0b885f2

Please try recent master branch or binary in https://app.circleci.com/jobs/github/ttrftech/NanoVNA/84/artifacts

from nanovna.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.