The below code is FFT filter code for SAM4SD32C
"<
uint32_t ifftFlag = 0;uint32_t doBitReverse = 1;uint32_t fftSize = 1024;
#define TEST_LENGTH_SAMPLES 2048
for(xt=0;xt<2048;xt++) { mt[xt] = adc_get_channel_value(ADC, ADC_CHANNEL_0);
testInput_f32_10khz[xt] =(0.6-((float)mt[xt]/4100.00))*16.00; delay_us(10); arm_cfft_f32(&arm_cfft_sR_f32_len1024, testInput_f32_10khz, ifftFlag, doBitReverse); arm_cmplx_mag_f32(testInput_f32_10khz, testOutput, fftSize); arm_max_f32(testOutput, fftSize, &maxValue, &testIndex); maxi = maxValue; printf("Maxi %d test Index %d\n",maxi,testIndex); }
>"
I trying to work out the same code in SAM4S2A controller
But the output values maxi and testIndex are changing.Due to this output is not as getting and testIndex value is getting 0.
can any one help me out to resolve the issue.
hello can any one please check and give the response asap
So what checking have you done?
You have a "working" example, and a "non-working" one - step through them both, and see where they diverge ...
I checked in the way you said for both codes...
But, the below line out parameter is not giving result as expected it is returning zero.
arm_max_f32(testOutput, fftSize, &maxValue, &testIndex);
there is no changes in both the codes.
Are you sure that the data you're passing into that function is valid?
To compare the STM32 & SAM4 versions, you need to ensure that you are using the same input data !
mt[xt] = adc_get_channel_value(ADC, ADC_CHANNEL_0);
Are you sure this is actually giving you good data?
Maybe the maximum of that data is really zero ?
After verifying all the above, try steppping into that function to see what's happening