2023-12-26 10:23 AM
Hello dear ST-Forum,
I have a problem that I can't solve, the sound coming from the microphones is very noisy and none of the acquired data sounds like a sound and this despite all the documentation (MP34DT01 datasheet, AN4990, AN5027, ...) and videos (STM on youtube) that I have seen.
I use an Octave program to retrieve the sound data from the UART port.
My DFSDM configuration is: 80MHz audio clock, divide by 40. So I have 2MHz PDM clock and I use a low-pass filter (Sinc 3 filter) with FOSR=125 so I capture a signal at 16 kHz. The card has 2 stereo microphones, so I didn't forget to put a channel on the rising edge and a channel on the falling edge.
Here's the code for the microcontroller program and for the Octave program.
For the variables:
#define AUDIO_REC 2048
int32_t RecBuff0[AUDIO_REC];
int32_t RecBuff1[AUDIO_REC];
int8_t FullConv0 = 0;
int8_t HalfConv0 = 0;
int8_t FullConv1 = 0;
int8_t HalfConv1 = 0;
int32_t PlayBuff0[AUDIO_REC];
int32_t PlayBuff1[AUDIO_REC];
I only use STM32CubeIDE debugger (Live Expressions for variable) and Octave to visualize the samples, but if there's a better way I'd like to hear it.
Solved! Go to Solution.
2023-12-27 01:01 AM
Ok, no audio-dac , but you have also the on chip dac , 2 x 12 bit.
I would try this to test the audio signal.
here:
on "Arduino connector" :
To use it, you have to modify the xx.ioc file, set PA4 + 5 : unused, then activate dac.
Then can see on a scope, what signal you producing or connect an amp, to listen...
2023-12-26 12:01 PM - edited 2023-12-26 12:01 PM
Hi,
to send the sampels on uart (16k x 32bit ->) need 1Mbit serial...what you use now ?
+
to hear it, i would connect an dac, maybe a old audio dac like TDA1387, or send data to on chip dac, for a test is the most easy - and you can hear, what comes out. (I am not sure - but most stm cpu have a 12bit dac )
And check with a scope.
2023-12-26 04:51 PM
Thank you for your answer ! I don't have any audio dac around me so it's will be difficult. I've tried to find solutions related to the DAC but I'm still looking for a way. Do you have an easy or inexpensive solution or do I have to use an external module?
(And for the sample on UART, you are right, as the comment on Octave, i have one 230400 bauds. I think it's not the best solution).
2023-12-27 01:01 AM
Ok, no audio-dac , but you have also the on chip dac , 2 x 12 bit.
I would try this to test the audio signal.
here:
on "Arduino connector" :
To use it, you have to modify the xx.ioc file, set PA4 + 5 : unused, then activate dac.
Then can see on a scope, what signal you producing or connect an amp, to listen...
2023-12-27 05:13 AM
Yes, I checked the documentation and there is a DAC on pins PA4 and PA5. I will try to use an amp. Thanks for the advice!