cancel
Showing results for 
Search instead for 
Did you mean: 

FFT problem on stm32427- solved

SAIDHI REDDY SAREDDY
Associate II
Posted on April 20, 2017 at 16:11

I have done fft computation but I got strange results.Please let me know if i did any mistake.

why I am getting the following strange results?

// ADC

&sharpdefine ADC_RAW_LENGTH 512

// FFT

//&sharpdefine FFT_SAMPLES 2048

&sharpdefine FFT_SIZE ADC_RAW_LENGTH/2

UINT16 ui16ADCRaw[ADC_RAW_LENGTH],ui16ADCCnt = 0,ui16Flag = 0, ui16CalibrateMaxValue = 0;

 

FLOAT32 fl32ADCRaw[ADC_RAW_LENGTH], fl32FFTOut[FFT_SIZE], fl32FFTMaxValue = 0;

 

UINT32 ui32FFTMaxIndex = 0;

arm_cfft_radix4_instance_f32 FFT_InitStruc;

 

arm_cfft_instance_f32 FFT_InitStruc_dsp;

 

arm_status status = ARM_MATH_ARGUMENT_ERROR; // default failure

//input data collection with timer interrupt from adc

void TIM2_IRQHandler(void)

{

UINT16 ui16ADC_Value = 0 ;

TIM_ClearITPendingBit(TIM2, TIM_IT_Update);

ui16ADC_Value = ADC_GetConversionValue(ADC1) ;

if((ui16ADCCnt < ADC_RAW_LENGTH) && (ui16ADC_Value > 500) )

{

if((ui16CalibrateMaxValue < ui16ADC_Value) ) {

ui16CalibrateMaxValue = ui16ADC_Value;

}

fl32ADCRaw[ui16ADCCnt] = (FLOAT32)ui16ADC_Value;

ui16ADCCnt++;

fl32ADCRaw[ui16ADCCnt] = 0.0;

ui16ADCCnt++;

}

}

// FFT calculation

status = arm_cfft_radix4_init_f32(&FFT_InitStruc,FFT_SIZE,0,1);

arm_cfft_radix4_f32(&FFT_InitStruc, fl32ADCRaw);

arm_cmplx_mag_f32(fl32ADCRaw,fl32FFTOut,FFT_SIZE);

arm_max_f32(fl32FFTOut, FFT_SIZE, &fl32FFTMaxValue, &ui32FFTMaxIndex);

// input sample data fl32ADCRaw

503

0

507

0

516

0

514

0

524

0

530

0

532

0

537

0

....

//arm_cfft_radix4_f32 function fl32ADCRaw

388595

0

0

0

-1186

1163

-1087

0

4.66130239e+011

-4.66130239e+011

-1186

-1163

4.66130239e+011

4.66130239e+011

-4.66130239e+011

4.66130239e+011

0

0

-4.66130239e+011

-4.66130239e+011

0

0

0

0

nan (0x7fffff)

nan (0x7fffff)

0

0

nan (0x7fffff)

nan (0x7fffff)

nan (0x7fffff)

nan (0x7fffff)

2.48002616e+012

//arm_cmplx_mag_f32 function fl32FFTOut data

5.66332883e+011

5.68833212e+011

1.86279645e+018

7.30765853e+011

1.86279645e+018

1.86279645e+018

0

1.86279645e+018

0

0

0

0

0

0

0

1.16413673e+013

0

1.67605685e+012

6.25887412e+011

inf

1.60195215e+012

inf

inf

0

inf

0

0

0

0

0

0

inf

0

inf

inf

inf

inf

inf

inf

0

inf

0

#stm32f427 #fft-stm32f4 #fft
3 REPLIES 3
Amel NASRI
ST Employee
Posted on April 20, 2017 at 17:39

Hello

SAREDDY.SAIDHIREDDY

‌,

You marked your question as '

ASSUMED ANSWERED

'.

Does this mean that you have no more problem with FFT?

What did you made to resolve it?

It is interesting to share your findings with other Community members.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on April 20, 2017 at 18:01

Are you sure it is not the forum software? I think it does this if other questions contain similarmaterial, and get answers, etc.

https://community.st.com/0D50X00009XkXxlSAF

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SAIDHI REDDY SAREDDY
Associate II
Posted on April 21, 2017 at 13:23

I did small mistake ..

I did not add arm_common_tables.c file. FFT  is working with below required files.

0690X00000603i7QAA.jpg