arm_cfft returns improper fft

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
sccac_1236541
Level 4
Level 4

Hi all,

   

So I've been working on this small project here and there for awhile and I started taking a more in depth look at some of the results I was getting, and I realized that the arm_cfft_q15.c wasn't returning what it should be.

   

 

   

If I had

   

 

   

        q15_t ADC_samples[2048]

   

        q15_t mag_of_fft [1024]

   

 

   

and ADC_samples where samples of a 1kHz wave sampled at 10Khz you would expect the resulting peaks to be at 1/5 pi and 9/5 pi.

   

when I do

   

     

   

        arm_cfft_q15(&arm_cfft_SR_length1024, ADC_samples, 0,1);

   

 

   

which basically says compute the 1024 pt fft of ADC_samples, with the inverse fft bit false and the bit reversal bit true.

   

and

   

 

   

        arm_cmplx_mag_q15(ADC_samples,mag_of_fft,1024);

   

 

   

which says compute the magnitude of the 1024 pt fft in ADC_samples

   

 

   

I get peaks at 2/5pi and at 8/5 pi?

   

 

   

I have confirmed my results in matlab as well.  I have checked my ADC sampling, and just about everything I can think of.

   

I have also tried the example, but unfortunately they don't tell you the sampling rate and with the white noise they added in to their values it becomes pointless.

   

 

   

what am I doing wrong?  I can't imagine arm has got it wrong.  as my use is only for the relativity of results to each other and I can always just increase my ADC's clock, this isn't slowing me down, but it is very concerning that I may be mis-interpreting how one of these functions handles things.

   

 

   

Any help is greatly appreciated,

   

scarlson

0 Likes
1 Reply
Anonymous
Not applicable

Hello Scarlson,

   

Did you resolve the issue? If not, please create a case with the project attached.

0 Likes