ttrftech / NanoVNA

Very Tiny Palmtop Vector Network Analyzer
1.06k stars 297 forks source link

some measurement point sometimes has wrong value #72

Closed qrp73 closed 4 years ago

qrp73 commented 4 years ago

This is related with this issue: https://github.com/ttrftech/NanoVNA/issues/70

The bug didn't fixed. The spikes are reduced but don't disappears.

Try rollback your changes and apply my small fix, this fix completely eliminates instability bug: https://github.com/qrp73/NanoVNA/commit/2ba09fb637b8faf318e7a597177a3b510ad2c933

This is how it looks with my changes (cal reset, S21 ref point=9, center 450, span 100): delay-good

Now let's check the latest code from your master branch with the same settings and exactly the same conditions:

delay-bug

As you can see there is a spike at 450 MHz with your change, it is still unstable.

My fix looks very easy, but it don't means that it uses random values. I tested hard different delays in different modes. I tested similar delays that is used in your changes in different configurations. But after all I found stable and fast configuration. After that I tested it very hard with different values. And after all I got these "magic values" 3 and 8 :)

It's long story to explain all details. Just in short, use minimum delay = 3 even for channel switch. For pll reset, band change and gain change use delay = 8. It works great and pretty fast

qrp73 commented 4 years ago

More pictures.

My fix after calibration: delay-good-calibrated-fresh

Your latest version after calibration: delay-bug-calibrated

This instability is present even with patch for pll lock wait.

Regarding to the tlv320aic3204_select_in3. I tested it in separate function, it requires minimum wait_dsp( 3 ) in order to get stable switch (frequency and gain is not changed).