From 64b5137c3230f50e41ebbefe554c3fb2d09f4206 Mon Sep 17 00:00:00 2001 From: ik1xpv Date: Sun, 15 May 2022 18:08:21 +0200 Subject: [PATCH 1/6] define ht lenght #define HTLEN in fft_mt_r2iq.cpp allows manual test other lenght --- Core/fft_mt_r2iq.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/fft_mt_r2iq.cpp b/Core/fft_mt_r2iq.cpp index 9bcf5803..eb1b50d7 100644 --- a/Core/fft_mt_r2iq.cpp +++ b/Core/fft_mt_r2iq.cpp @@ -156,6 +156,7 @@ void fft_mt_r2iq::Init(float gain, ringbuffer *input, ringbuffer // DbgPrintf((char *) "RandTable generated\n"); +#define HTLEN (halfFft / 4 + 1) // filters fftwf_complex *pfilterht; // time filter ht pfilterht = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*halfFft); // halfFft @@ -166,7 +167,7 @@ void fft_mt_r2iq::Init(float gain, ringbuffer *input, ringbuffer } filterplan_t2f_c2c = fftwf_plan_dft_1d(halfFft, pfilterht, filterHw[0], FFTW_FORWARD, FFTW_MEASURE); - float *pht = new float[halfFft / 4 + 1]; + float *pht = new float[HTLEN]; const float Astop = 120.0f; const float relPass = 0.85f; // 85% of Nyquist should be usable const float relStop = 1.1f; // 'some' alias back into transition band is OK @@ -176,7 +177,7 @@ void fft_mt_r2iq::Init(float gain, ringbuffer *input, ringbuffer // to allow same stopband-attenuation for all decimations float Bw = 64.0f / mratio[d]; // Bw *= 0.8f; // easily visualize Kaiser filter's response - KaiserWindow(halfFft / 4 + 1, Astop, relPass * Bw / 128.0f, relStop * Bw / 128.0f, pht); + KaiserWindow(HTLEN, Astop, relPass * Bw / 128.0f, relStop * Bw / 128.0f, pht); float gainadj = gain * 2048.0f / (float)FFTN_R_ADC; // reference is FFTN_R_ADC == 2048 @@ -185,7 +186,7 @@ void fft_mt_r2iq::Init(float gain, ringbuffer *input, ringbuffer pfilterht[t][0] = pfilterht[t][1]= 0.0F; } - for (int t = 0; t < (halfFft/4+1); t++) + for (int t = 0; t < (HTLEN); t++) { pfilterht[halfFft-1-t][0] = gainadj * pht[t]; } From 4ad7556822ef962ed217a2a3be9379c1dcda48fb Mon Sep 17 00:00:00 2001 From: ik1xpv Date: Mon, 16 May 2022 15:06:55 +0200 Subject: [PATCH 2/6] HTLEN #define HTLEN in config.h --- Core/config.h | 2 ++ Core/fft_mt_r2iq.cpp | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/config.h b/Core/config.h index 5eacba42..973af173 100644 --- a/Core/config.h +++ b/Core/config.h @@ -53,6 +53,8 @@ inline void null_func(const char *format, ...) { } #define WIDEFFTN // test FFTN 8192 #define FFTN_R_ADC (8192) // FFTN used for ADC real stream DDC tested at 2048, 8192, 32768, 131072 +#define HALF_FFT (FFTN_R_ADC / 2) +#define HTLEN ( HALF_FFT / 4 + 1) // GAINFACTORS to be adjusted with lab reference source measured with HDSDR Smeter rms mode #define BBRF103_GAINFACTOR (7.8e-8f) // BBRF103 diff --git a/Core/fft_mt_r2iq.cpp b/Core/fft_mt_r2iq.cpp index eb1b50d7..8b46713b 100644 --- a/Core/fft_mt_r2iq.cpp +++ b/Core/fft_mt_r2iq.cpp @@ -156,7 +156,6 @@ void fft_mt_r2iq::Init(float gain, ringbuffer *input, ringbuffer // DbgPrintf((char *) "RandTable generated\n"); -#define HTLEN (halfFft / 4 + 1) // filters fftwf_complex *pfilterht; // time filter ht pfilterht = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*halfFft); // halfFft From 746d9ca980d6813a8f5676a3e0a154d35a10c630 Mon Sep 17 00:00:00 2001 From: ik1xpv Date: Sat, 21 May 2022 09:42:18 +0200 Subject: [PATCH 3/6] Soft tone generator #define _SOFT_TONE_DEBUG in config.h enables the generation of soft tone close to 1MHz with ADC clk 64MHz, the tone period is an integer factor of transferSamples. GUI Rand CheckBox activates the software generated tone. --- Core/config.h | 2 ++ Core/fft_mt_r2iq.cpp | 3 +++ Core/fft_mt_r2iq.h | 28 +++++++++++++++++++++++++++- Core/fft_mt_r2iq_impl.hpp | 8 +++++++- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/Core/config.h b/Core/config.h index 973af173..89c8f645 100644 --- a/Core/config.h +++ b/Core/config.h @@ -55,6 +55,8 @@ inline void null_func(const char *format, ...) { } #define FFTN_R_ADC (8192) // FFTN used for ADC real stream DDC tested at 2048, 8192, 32768, 131072 #define HALF_FFT (FFTN_R_ADC / 2) #define HTLEN ( HALF_FFT / 4 + 1) +#define _SOFT_TONE_DEBUG // Generate soft tone period transferSamples debug + // GAINFACTORS to be adjusted with lab reference source measured with HDSDR Smeter rms mode #define BBRF103_GAINFACTOR (7.8e-8f) // BBRF103 diff --git a/Core/fft_mt_r2iq.cpp b/Core/fft_mt_r2iq.cpp index 8b46713b..26693c94 100644 --- a/Core/fft_mt_r2iq.cpp +++ b/Core/fft_mt_r2iq.cpp @@ -40,6 +40,9 @@ fft_mt_r2iq::fft_mt_r2iq() : r2iqControlClass(), filterHw(nullptr) { +#ifdef _SOFT_TONE_DEBUG + genphase = 0.0; +#endif mtunebin = halfFft / 4; mfftdim[0] = halfFft; for (int i = 1; i < NDECIDX; i++) diff --git a/Core/fft_mt_r2iq.h b/Core/fft_mt_r2iq.h index 8aa6f766..b29fb655 100644 --- a/Core/fft_mt_r2iq.h +++ b/Core/fft_mt_r2iq.h @@ -26,7 +26,33 @@ class fft_mt_r2iq : public r2iqControlClass void TurnOff(void); bool IsOn(void); -protected: +protected: + +#ifdef _SOFT_TONE_DEBUG + double genphase; +#define PI ( 3.14159265358979323846 ) + float burst[transferSamples + HALF_FFT]; + void init_burst(void) + { + for (int m = 0; m < transferSamples + HALF_FFT; m++) + { + genphase += (PI * 2048.0) / (double)(transferSamples); + + if (genphase > 2.0 * PI) genphase -= 2.0 * PI; + + burst[m] = 32768.0F * sin(genphase); + } + } + void generate_float( float* output, int size) + { + for (int m = 0; m < size; m++) + { + output[m] = burst[m]; + // output[m] = 32768.0F; // generate DC + + } + } +#endif template void convert_float(const int16_t *input, float* output, int size) { diff --git a/Core/fft_mt_r2iq_impl.hpp b/Core/fft_mt_r2iq_impl.hpp index 7d9662b1..2532b0f6 100644 --- a/Core/fft_mt_r2iq_impl.hpp +++ b/Core/fft_mt_r2iq_impl.hpp @@ -9,7 +9,9 @@ plan_f2t_c2c = &plans_f2t_c2c[decimate]; fftwf_complex* pout = nullptr; int decimate_count = 0; - +#ifdef _SOFT_TONE_DEBUG + init_burst(); // if DEBUG_LENGTH +#endif while (r2iqOn) { const int16_t *dataADC; // pointer to input data const int16_t *endloop; // pointer to end data to be copied to beginning @@ -49,8 +51,12 @@ } else { +#ifdef _SOFT_TONE_DEBUG + generate_float(inloop, transferSamples + halfFft); +#else convert_float(endloop, inloop, halfFft); convert_float(dataADC, inloop + halfFft, transferSamples); +#endif } #if PRINT_INPUT_RANGE From ba50e580b9d40e4c93f7e1708e83f2330e4b2cf5 Mon Sep 17 00:00:00 2001 From: ik1xpv Date: Mon, 23 May 2022 14:03:49 +0200 Subject: [PATCH 4/6] HTLEN tests some defines in config.h HALF_FFT/4+1 HALF_FFT/2+1 -256 HLFT_FFT/2+1 --- Core/config.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Core/config.h b/Core/config.h index 89c8f645..22a0dc0d 100644 --- a/Core/config.h +++ b/Core/config.h @@ -53,8 +53,11 @@ inline void null_func(const char *format, ...) { } #define WIDEFFTN // test FFTN 8192 #define FFTN_R_ADC (8192) // FFTN used for ADC real stream DDC tested at 2048, 8192, 32768, 131072 -#define HALF_FFT (FFTN_R_ADC / 2) -#define HTLEN ( HALF_FFT / 4 + 1) +#define HALF_FFT (FFTN_R_ADC / 2) +//#define HTLEN ( HALF_FFT / 4 + 1) //= 1025 ok +//#define HTLEN ( HALF_FFT / 2 + 1 - 256) //= 1793 near ok ? +#define HTLEN ( HALF_FFT / 2 + 1) //= 2049 distortion at edges ???? + #define _SOFT_TONE_DEBUG // Generate soft tone period transferSamples debug From b8af5c930d1c4e39c96f922cc3335f0050508fa9 Mon Sep 17 00:00:00 2001 From: ik1xpv Date: Mon, 23 May 2022 14:30:11 +0200 Subject: [PATCH 5/6] Update config.h SWVERSION 1.3.3.Alfa --- Core/config.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Core/config.h b/Core/config.h index 22a0dc0d..a61383f5 100644 --- a/Core/config.h +++ b/Core/config.h @@ -45,7 +45,7 @@ inline void null_func(const char *format, ...) { } #define DbgPrintf DbgEmpty #endif -#define SWVERSION "1.3.0 RC1" +#define SWVERSION "1.3.3 Alfa" #define SETTINGS_IDENTIFIER "sddc_1.06" #define SWNAME "ExtIO_sddc.dll" @@ -54,12 +54,12 @@ inline void null_func(const char *format, ...) { } #define FFTN_R_ADC (8192) // FFTN used for ADC real stream DDC tested at 2048, 8192, 32768, 131072 #define HALF_FFT (FFTN_R_ADC / 2) -//#define HTLEN ( HALF_FFT / 4 + 1) //= 1025 ok +#define HTLEN ( HALF_FFT / 4 + 1) //= 1025 ok //#define HTLEN ( HALF_FFT / 2 + 1 - 256) //= 1793 near ok ? -#define HTLEN ( HALF_FFT / 2 + 1) //= 2049 distortion at edges ???? - +//#define HTLEN ( HALF_FFT / 2 + 1) //= 2049 distortion at edges ???? +#ifdef _WIN32 #define _SOFT_TONE_DEBUG // Generate soft tone period transferSamples debug - +#endif // GAINFACTORS to be adjusted with lab reference source measured with HDSDR Smeter rms mode #define BBRF103_GAINFACTOR (7.8e-8f) // BBRF103 From cc9f320472eec79018cf4a9da66c462740560add Mon Sep 17 00:00:00 2001 From: ik1xpv Date: Thu, 9 Jun 2022 17:54:01 +0200 Subject: [PATCH 6/6] large FFTN test Test in config,c FFTN_R_ADC (32768) htlen => 12289 --- Core/config.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Core/config.h b/Core/config.h index a61383f5..a5be10c1 100644 --- a/Core/config.h +++ b/Core/config.h @@ -52,11 +52,12 @@ inline void null_func(const char *format, ...) { } #define QUEUE_SIZE 32 #define WIDEFFTN // test FFTN 8192 -#define FFTN_R_ADC (8192) // FFTN used for ADC real stream DDC tested at 2048, 8192, 32768, 131072 +#define FFTN_R_ADC (32768) // FFTN used for ADC real stream DDC tested at 2048, 8192, 32768, 131072 #define HALF_FFT (FFTN_R_ADC / 2) -#define HTLEN ( HALF_FFT / 4 + 1) //= 1025 ok -//#define HTLEN ( HALF_FFT / 2 + 1 - 256) //= 1793 near ok ? -//#define HTLEN ( HALF_FFT / 2 + 1) //= 2049 distortion at edges ???? +//#define HTLEN ( HALF_FFT / 4 + 1) // ok +#define HTLEN ( HALF_FFT * 3 / 8 + 1 ) // ok +//#define HTLEN ( HALF_FFT * 7 / 16 + 1 ) // ok ? +//#define HTLEN ( HALF_FFT / 2 + 1 ) // distortion at edges ???? #ifdef _WIN32 #define _SOFT_TONE_DEBUG // Generate soft tone period transferSamples debug #endif