2018-02-21 04:26 AM
Hello.,
I need to write test code for Audio codec which is interfaced through SAI interface . For this I am generating 1KHz sine wave using DAC and given to codec input and capturing the same through SAI interface . Now how to conclude that signal frequency is 1Khz by using SAI captured samples.
I was suggested to do FFT on those samples ,
>> Is it possible to do FFT on captured sample from SAI interface.
>> To do this Is there any inbuilt algorithm available in CMSIS library. If so which one to use and how to use can anyone suggest me .
#sai #stm32f72018-02-21 05:13 AM
It's just 'data' why wouldn't you be able to process it any way you choose?
CMSIS provides a DSP Library, perhaps review that
STM32Cube_FW_F7_V1.8.0\Drivers\CMSIS\DSP_Lib\Examples\arm_fft_bin_example
2018-02-22 01:24 AM
http://www.keil.com/pack/doc/CMSIS/DSP/html/index.html
- a free textbook!2018-02-22 01:50 AM
I'm not sure how a FFT on the target is supposed to do good in this case, i.e. serves the test of the audio codec.
2018-02-22 05:48 AM
Yes. And there are others as well.
You have a few options. Cmsis dsp is one. It has more functionality thanjust fft.
St itself has an appnote on fft as well. Highly specialized. And very fast.
Or you can roll your own. Fft is fairly easy to do.
2018-02-22 06:38 AM
Sounds like the OP intends to do an FFT of the codec output, to see the output spectrum is 'pure' ... ?
2018-02-22 07:13 AM
But why on the target ?
I would have exported sampled analog data to a PC, and done the spectral analysis there.
Last time I checked, the CMSIS_DSP was limited to 2048 point - if I remember correctly.
2018-02-22 09:06 AM
I'm sure you would. But that doesn't mean everyone else should for everyone of their applications.
Different people have different needs in different applications, you know.
2018-02-22 10:18 AM
It might have to do with a different understanding of what 'testing' in this context means.
Having additional (and rather complex and complicated) code running on the DUT as part of a verification does not tend to make things easier.
2018-02-22 10:47 AM
Just measure the frequency?
Apply the digital analog of the window filter. The window filter has a phase delay, this is exactly what you need. You need two filters. The first will cut off high-frequency oscillations, the second will be used to control the direction of the phase. To do this, you need to take the data from the first filter and compare it with the output of the second filter.With apparent simplicity, your measurements can not occur in real time. Therefore, the time stamp at the time of the phase change must be taken from the report number and the system time. Having a real phase transition time - you can calculate the frequency. For reliability, you can accumulate many reports, then the result will have increased accuracy.Phase transition control takes precedence over the threshold detector - switching always occurs at the top of the wave. And so is the advantage over FFT - you need much less computing and memory.
The window filter works very simply. This is the sum of the reports divided by their number. You do not need to apply a filter to every cycle of the ADC; it's simpler: a new report is added to the sum and the old one is subtracted, the amount is divided by the number of reports, and the cycle repeats.