I am trying to implement this function but am not getting expected results.
I have no experience with FFTs beyond the basics.
I am not using complex sampling techniques. I am sampling real values for a 1024 point FFT. I have set a 2048 block of memory to load in 1024 complex pairs, I am taking the data sampled data and storing it in the following way in an ISR:
ls=readadc();
FFT_BUF[SIP]=(float) ls;
FFT_BUF[SIP+1]=0.0;
SIP +=2;
Which is essentially setting the real part to the sample and the imaginary part to 0.
When I have sampled the 1024 points in the main loop:
if(SIP==2048){
DSPF_sp_cfftr2_dit(FFT_BUF,TWIDDLE,1024); //Perform FFT
bit_rev(FFT_BUF,1024); //Bit reverse output
I execute the FFT.
The bit reversed twiddle factors were generated to an output file using the tw_r2fft.exe provided in support library dsplib\bin. The bit_rev function is also out of the book "The function bit_rev in dsplib\support\fft can be used to bit reverse the output
array to convert it into normal order".
Here is some data out of the functions:
| 1st sampling | 1st sampling | 1st sampling | 2nd Sampling | 3rd Sampling |
| FFT_Buf | FFT | Output Bit | Output Bit | Output Bit |
| complex pairs | Executed | Reversal | Reversal | Reversal |
| -3038 | 338105 | 338105 | -290228 | 218085 |
| 0 | 0 | 0 | 0 | 0 |
| -5543 | -3153 | 359273.7 | -214004.3 | 254320.6 |
| 0 | 0 | -7663.942 | -19492.41 | 13102.34 |
| -3736 | -3034 | 388040.6 | -256213.7 | 275259 |
| 0 | 5167 | -17795.71 | -24464.87 | -20146.1 |
| 535 | -3034 | 406778.7 | -245672.9 | 272153 |
| 0 | -5167 | -18274.34 | -39364.68 | -41923.55 |
| 4777 | -11423.71 | 406827 | -249245 | 274799.4 |
| 0 | 16266.23 | -20960.66 | -57278.16 | -56373.41 |
| 8904 | -2586.288 | 415304.1 | -255690.8 | 283111.3 |
| 0 | -1588.226 | -27263.58 | -66833.44 | -69459.13 |
| 12836 | -2586.288 | 441582.8 | -272289.9 | 269781.5 |
| 0 | 1588.226 | -55222.3 | -70711.03 | -87490.95 |
| 16491 | -11423.71 | 454954.7 | -259401.6 | 306316.5 |
| 0 | -16266.23 | -81433.65 | -131985.5 | -68774.82 |
| 19800 | -55086.15 | 482866.8 | -246195.6 | 392471.3 |
| 0 | 37454.99 | -121696.9 | -29612.78 | -110126.3 |
| 22698 | -2473.693 | 454207.4 | -311767.7 | 295269 |
| 0 | -2390.008 | -43609.31 | -182044.6 | -184659.8 |
| 25255 | -2104.652 | 467742.1 | -290084.3 | 305447.1 |
| 0 | 3152.816 | -28269.77 | -170482.2 | -169210.4 |
| 27081 | -4823.503 | 489846.6 | -286439.6 | 349202.8 |
| 0 | -8757.799 | -18095.82 | -188233.4 | -206999.3 |
| 28285 | -4823.503 | 527711.3 | -336273.2 | 336798.9 |
| 0 | 8757.799 | -56497.27 | -226202.8 | -230321.8 |
| 28948 | -2104.652 | 572148.1 | -357980.1 | 368848.4 |
| 0 | -3152.816 | -60404.96 | -258956.6 | -262332.1 |
| 29094 | -2473.693 | 623642.3 | -352535.8 | 413721.3 |
| 0 | 2390.008 | -55796.34 | -298238.6 | -321133.1 |
Can you see anything wrong with the methodology I am using?