2022-04-26 04:27 AM
Hello STM32-Community,
I'm currently using the SPH0641 Microphone alongside DFSDM. My DFSDM settings are:
Sinc filter: Sinc 3 Filter
IOSR: 8
Divider = 79
FOSR = 37
with a clock frequency of 48 MHz and as a clocksource for DFSDM I've a sample rate of about 2052 Hz.
After collecting 4096 datasets I'm doing a 4096-FFT to get the main frequencies of the audio signal. I'm using a sound generator to generate sound in any frequency. On the following image you can see, that the frequency of 500 Hz simulated by me and it isn't correctly displayed by the collected data of the DFSDM. I've also done an FFT with the raw microphone data and also get a main frequency of about 504 Hz after doing an FFT with Matlab.
And this error is increasing by about 0.7 Hz every 100 Hz. Eg with 100 Hz sound I receive a mainfrequency of about 100.69 Hz. At 200, it's 201.39 Hz. At 300 Hz it is 302.58 and so on. The bigger the frequency, the higher the discrepancy between simulated sound and measured one.
Edit: I checked how long the micro controller takes to collect 4096 data samples. Expected is a time of about 1.996 seconds (4096/2052). Measuring it with a Logic Analyzer returns about 2.013 seconds, while a 1 ms-Tick counter returns 1996. Why is there such a big discrepancy?
Anyone knows what I'm doing wrong?
Kind regards
Solved! Go to Solution.
2022-04-26 10:12 AM
MSI in 'L4+ has a factory error of +-1.3% at normal VCC/temperature:
You are experiencing a 0.7% error. It's normal.
Use HSE/crystal for better precision.
JW
2022-04-26 05:33 AM
-
2022-04-26 07:47 AM
Which STM32?
> with a clock frequency of 48 MHz
What's the primary clock source?
RC oscillators are not precise.
JW
2022-04-26 08:18 AM
I'm using STM32L4R9 with MSI as a clock source. DFSDM-clock also uses the system clock.
2022-04-26 10:12 AM
MSI in 'L4+ has a factory error of +-1.3% at normal VCC/temperature:
You are experiencing a 0.7% error. It's normal.
Use HSE/crystal for better precision.
JW
2022-04-26 10:19 AM
Thank you very much!