Correct xAxis settin

pull/13/head
boblark 3 years ago
parent 70b8ce6c44
commit 4a260d2748
  1. 17
      analyze_fft4096_iqem_F32.cpp
  2. 26
      analyze_fft4096_iqem_F32.h

@ -1,5 +1,5 @@
/*
* analyze_fft4096_iq_F32.cpp Assembled by Bob Larkin 9 Mar 2021
* analyze_fft4096_iq_F32.cpp Assembled by Bob Larkin 18 Feb 2022
*
* External Memory **** BETA TEST VERSION - NOT FULLY TESTED **** <<<<<<<<<<
*
@ -12,7 +12,7 @@
* * Future: Add outputs for I & Q FFT x2 for overlapped FFT
* * Windowing None, Hann, Kaiser and Blackman-Harris.
*
* Conversion Copyright (c) 2021 Bob Larkin
* Conversion Copyright (c) 2022 Bob Larkin
* Same MIT license as PJRC:
*
* Audio Library for Teensy 3.X
@ -73,6 +73,11 @@ void AudioAnalyzeFFT4096_IQEM_F32::update(void) {
}
// Here with two new blocks of data. These are retained until the FFT
// but with new pointers, blocklist_i[] and blocklist_q[].
uint32_t tt = micros(); Serial.print(state);
switch (state) {
case 0:
blocklist_i[0] = block_i; blocklist_q[0] = block_q; // Copy 2 ptrs
@ -144,7 +149,7 @@ void AudioAnalyzeFFT4096_IQEM_F32::update(void) {
blocklist_i[16] = block_i; blocklist_q[16] = block_q;
// Now work on the FFT output data. This was created in case 31.
// This next forming of the sumsq[] takes 48 uSec
// This next forming of the sumsq[] takes 66 uSec (was 48 uSec with local memory)
count++;
for (int i = 0; i < 2048; i++) {
// Re-arranging the coefficients. These are bin powers (not Volts)
@ -315,7 +320,7 @@ void AudioAnalyzeFFT4096_IQEM_F32::update(void) {
case 31:
blocklist_i[31] = block_i; blocklist_q[31] = block_q;
// Copy 8192 data to fft_buffer This state==31 takes about 500 uSec, including the FFT.
// Copy 8192 data to fft_buffer This state==31 takes about 530 uSec, including the FFT.
// i & q interleaved data.
copy_to_fft_buffer1(pFFT_buffer+0x000, blocklist_i[0]->data, blocklist_q[0]->data);
copy_to_fft_buffer1(pFFT_buffer+0x100, blocklist_i[1]->data, blocklist_q[1]->data);
@ -424,6 +429,10 @@ void AudioAnalyzeFFT4096_IQEM_F32::update(void) {
state = 16;
break; // From case 31
} // End of switch & case 31
Serial.print(","); Serial.println(micros() - tt);
} // End update()
// End, if Teensy 4.x
#endif

@ -1,5 +1,5 @@
/*
* analyze_fft4096_iqem_F32.h Assembled by Bob Larkin 9 Mar 2021
* analyze_fft4096_iqem_F32.h Assembled by Bob Larkin 18 Feb 2022
*
* External Memory **** BETA TEST VERSION - NOT FULLY TESTED **** <<<<<<<<<<
*
@ -20,7 +20,7 @@
* * Multiple bin-sum output to simulate wider bins.
* * Power averaging of multiple FFT
*
* Conversion Copyright (c) 2021 Bob Larkin
* Conversion Copyright (c) 2022 Bob Larkin
* Same MIT license as PJRC:
*
* From original real FFT:
@ -90,17 +90,23 @@
*
* x-Axis direction and offset per setXAxis(xAxis) for sine to I
* and cosine to Q:
* If xAxis=0 f=0 in middle, f=fs/2 on left edge
* If xAxis=1 f=0 in middle, f=fs/2 on right edge
* If xAxis=2 f=0 on right edge, f=fs/2 in middle
* If xAxis=3 f=0 on left edge, f=fs/2 in middle
*
* If xAxis=0 f=fs/2 in middle, f=0 on right edge
* If xAxis=1 f=fs/2 in middle, f=0 on left edge
* If xAxis=2 f=fs/2 on left edge, f=0 in middle
* If xAxis=3 f=fs/2 on right edgr, f=0 in middle
*
* If there is 180 degree phase shift to I or Q these all get reversed.
* xAxis=1 is a mathemetically consistent method. It has positive frequencies
* on the right and negative ones on the left. The center is half the sample
* rate, both + and -. Uniormly sampled data lives in this circular world.rate.
*
* Timing, max is longest update() time:
* T4.0 Windowed, dBFS Out, 987 uSec <<<<<<CHECK
* Timing, maximum microseconds per update() over the 16 updates,
* and the average percent processor use for 44.1 kHz sample rate and Nave=1:
* T4.0 Windowed, dBFS Out (FFT_DBFS), 710 uSec, Ave 4.64%
* T4.0 Windowed, Power Out (FFT_POWER), 530 uSec, Ave 1.7%
* T4.0 Windowed, RMS Out, (FFT_RMS) 530 uSec, Ave 1.92%
* Nave greater than 1 decreases the average processor load.
*
* Windows: The FFT window array memory is provided by the INO. Three common and
* useful window functions, plus no window, can be filled into the array by calling
@ -131,6 +137,8 @@
* removing 66.2 dB. With floating point, the dynamic range is maintained
* no matter how it is scaled, but this factor needs to be considered
* when building the INO.
*
* 22 Feb 2022 Fixed xAxis error.
*/
/* Info
* __MK20DX128__ T_LC; __MKL26Z64__ T3.0; __MK20DX256__T3.1 and T3.2
@ -270,7 +278,7 @@ public:
// xAxis, bit 0 left/right; bit 1 low to high; default 0X03
void setXAxis(uint8_t _xAxis) {
xAxis = _xAxis;
xAxis = _xAxis ^ 0X20; // Change bit 1 to be consistent with other IQ FFT
}
virtual void update(void);

Loading…
Cancel
Save