ttrftech / NanoVNA

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

Rework bandwidth, Faster sweep on 96kHz ADC, lower noise on ADC, 800Hz low limit, variable sweep points, fix linear interpolation #130

Closed DiSlord closed 4 years ago

DiSlord commented 4 years ago

Faster i2c bus (now 600kHz, allow more faster add settings) Add i2c command (disabled by default) Little fix stat command Rewrite button input functions, made more compact, better debounce Little increase repeat speed

variable sweep points support Increase ADC from 48kHz to 96kHz More stable si5351 work (add additional bands), not use power change Set low limit freq 800Hz (add bandfor 800-10kHz range) Fix init AIC settings as in datasheet Fix interpolation near harmonic change point Allow more fast trace measure if select only CH0 or CH1 trace data (only for stand alone use) Add sin_cos table for 6 or 12kHz offset for dsp Add support direct clock for AIC3204 from si5351

DiSlord commented 4 years ago

I work under bandwidth patch, and wait adding my previous PR

Add my fixes from you bandwidth branch

DiSlord commented 4 years ago

Rewrite button input functions, made more compact, better debounce Little increase repeat speed

DiSlord commented 4 years ago

Revert use direct SIN and COS calculations in ttf Now use tables, full size table req 1964 = 784 flash size (minus sin/cos call and multiplie) ~ 730 bytes, but possible use only 65 table indexes, it allow decrease size on (196-65)4 = 524, and this not decrease speed

At result need only 208bytes flash, but speed increase from 6500systick to 2035

DiSlord commented 4 years ago

Just for info: In code sin and cos used only in

static void apply_edelay_at(int i)
{
  float w = 2 * VNA_PI * electrical_delay * frequencies[i] * 1E-12;
  float s = sin(w);
  float c = cos(w);

It require 6.5 kB flash size.. Possible use table and interpolation, it allow save big amount of flash and save ~5kB, also possible speedup (yes get little mistake in calc, but i think no bigger then 0,00001 if use FFT sin cos table and linear interpolate)

DiSlord commented 4 years ago

Additional All rotating, atan2, sin, cos, log functions require big size tables (in math lib) Need try use CORDIC methods for compute it https://en.wikipedia.org/wiki/CORDIC It can be faster, compact and more correct

DiSlord commented 4 years ago

Finish work under: Change AIC3204 dac from 48kHz to 96kHz (it allow more fast measure) Use 10kHz IF freq (5kHz before) Add 2kHz bandwidth option Move bandwidtth setting to config (now allow save setting config->save)

As result: 2kHz bandwidth sweep speed increased on 2x (yes little noise exist) 1kHz bandwidth sweep speed increased on 1.5x (noise level not change)

Need made tests (i not on work due to COVID, then a can i test it), if all work fine i add new PR

DiSlord commented 4 years ago

Upload all my last fixes for: variable sweep points support Increase ADC from 48kHz to 96kHz More stable si5351 work (add additional bands), not use power change Set low limit freq 800Hz (add bandfor 800-10kHz range) Fix init AIC settings as in datasheet Fix interpolation near harmonic change point Allow more fast trace measure if select only CH0 or CH1 trace data (only for stand alone use)

DiSlord commented 4 years ago

That is the 800Hz...300MHz test is handled by fundamental signals, the 300..900Mhz test is handled by 3rd and 5th harmonics, the 900...1500Mhz test is handled by 7th and 9th harmonics and finally the 1500...2100MHz test is handled by 9th and 11th harmonics.

Yes signal source and process as before (but IF change from 5kHz to 10kHz) Also AIC src freq change from 8MHz to 10.752MHz (not use fractianal multiplier in AIC PLL)

Pmax65 commented 4 years ago

Thank you again.

DiSlord commented 4 years ago

SD card support code ready, i think soon add it

DiSlord commented 4 years ago

Add SD card support At this moment disabled by default, but code work good as i see. At my last test on good SD card allow get ~1Mbyte/sec read and at ~600kByte/sec write speed (it very good speed for SPi mode) Support all SD cards size and Fat16/32 exFat filesystem H version have limitation only Fat16/32 filesystem support (not enouth flash size for add it) so only 32Gb cards (or need format it and add 1 partition to 32Gb Fat32 filesystem)

RTC clock need for better add filenames and creation time Possible add external quartz on 32.768 on PC14 and PC15 CPU legs and use LSE mode For compile LSE variant for RTC and external quarz uncomment in Makefile

UDEFS+= -DVNA_USE_LSE

DiSlord commented 4 years ago

Implement new UI style, this also allow save some flash