2017-04-20 07:11 AM
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/2UINT16 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 calculationstatus = 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 fl32ADCRaw50305070516051405240530053205370....//arm_cfft_radix4_f32 function fl32ADCRaw
388595000-11861163-108704.66130239e+011-4.66130239e+011-1186-11634.66130239e+0114.66130239e+011-4.66130239e+0114.66130239e+01100-4.66130239e+011-4.66130239e+0110000nan (0x7fffff)
nan (0x7fffff)
00nan (0x7fffff)
nan (0x7fffff)
nan (0x7fffff)
nan (0x7fffff)
2.48002616e+012//arm_cmplx_mag_f32 function fl32FFTOut data
5.66332883e+0115.68833212e+0111.86279645e+0187.30765853e+0111.86279645e+0181.86279645e+01801.86279645e+01800000001.16413673e+01301.67605685e+0126.25887412e+011inf1.60195215e+012infinf0inf000000inf0inf
inf
inf
inf
inf
inf
0
inf
0
#stm32f427 #fft-stm32f4 #fft2017-04-20 08:39 AM
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.
2017-04-20 09:01 AM
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
2017-04-21 04:23 AM
I did small mistake ..
I did not add arm_common_tables.c file. FFT is working with below required files.