2009-11-11 03:40 AM
How to use STM32 DSP Library
2011-05-17 03:50 AM
Hi, I'm trying to use the cr4_fft_1024_stm32 function that comes with DSP Library, on Keil compiler but something is wrong.
I used:Code:
cr4_fft_1024_stm32 (y,x,1024);
x[1024], is an U32 input array with the data sampled of sinusoidal wave 10Khz,2Vpp (left adjust by 16, example: x[0]<I'm not sure but y[0]...y[1024] must contain the frequency that this signal has. But when I read the y[x] all vectors has something like 0xFFEFFF02, what does it mean? :o I only have to measure the frequency and amplitude of the signal, anyboy know how to use FFT/DFT to do this.2011-05-17 03:50 AM
The missing information is the sample rate
a 1024 point FFT will have 1024 outputs the first output will be the DC compenent, the second will be amplitude of the frequency compenent of fs/1024*1 Hz the third will be fs/1024*2 hz ... the last will be fs/1024*1023 hz where fs is the sample rate in hz the amplitude will be in Vp/2 units2011-05-17 03:50 AM
Hello,
I will be pleased if you could show your code where you make the imaginary part of the input signal? Kasper2011-05-17 03:50 AM
I didn't use the imaginary part, I left this part of array as 0x0000.
I saw in the example STMicroelectronics\STM32F10x_DSP_Lib_V1.0.1\DSP DEMO\project\RVMDK that they don't fill the array with the imaginary part. So the x[] (input array) is : x[1] = 0x0FE10000 (value 0FE1 the result of ADC conversion and 0000 imaginary part).2011-05-17 03:50 AM
Quote:
danielfpeixoto, I think you've made a small mistake: for each sample the real part is in the lowest 16-bit and the imaginary part is in the highest 16-bit, so: x[1]=0x00000FE1. sword_82 According to the source code of the function MygSin in the FFT demo, I think the real part must be in the highest 16-bit :Code:
for (i=0; i < nfill; i++) { fY = sin(PI2 * i * (fFreq1/fFs)) + sin(PI2 * i * (fFreq2/fFs)); fZ = fAmpli * fY; lBUFIN[i]= ((short)fZ) << 16 ; /* sine_cosine (cos=0x0) */ } or am I wrong ?2011-05-17 03:50 AM
Hi all,
kjepsen, The imaginary part of the input signal must be null. danielfpeixoto, I think you've made a small mistake: for each sample the real part is in the lowest 16-bit and the imaginary part is in the highest 16-bit, so: x[1]=0x00000FE1. regards sword_822011-05-17 03:50 AM
Ops, sorry.