cancel
Showing results for 
Search instead for 
Did you mean: 

Hello ST Experts I have a query on mems mic interfacing STM32f466re nucleo board i am getting a PCM data in PCM_buffer .Now How do I acquire this data and convert it to dB and print serially for every 1 second or 5 seconds .

SG.4
Associate II

the noise intensity level print on serially on monitor . from this the threshold has to be set to detect pleasant noise or harmful noises for further coding and analysis.

I am stuck at a point in PCM audio data out conversion to dB i.e noise level .

Below is a image attached on how I am getting the PCM values in buffer. And I am not sure how to validate whether this is correct or wrong.? and after this if any voice or variations in the mic should be showing alterations in the noise level intensity printing serially.

I am a beginner with audio mems mic and audio processing.

Please help .this project is on urgent requirement.

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @Community member​ ,

I checked by our ST experts, and here you can find their feedback.

  • It is not clear if the data you are showing are correct or not, if limited to a screenshot of the debugger... at first glance, they looks wrong, since they are saturated between +-32768, but if this is the very first frame it could be correct to have such numbers, since you have to wait that the CIC filter is converging. In any case, the suggestion is to try to stream the data in some different ways than the debugger (e.g. USB, UART if you are fast enough), in order to have a more complete picture;
  • For the dBSPL calculation, there are a couple of libraries: one in the source code of the FP-AUD-SMARTMIC1 function pack (C\Middlewares\ST\STM32_AcousticDB_Library) and the other one in binary format in the STM32L4Cube firmware package, that you can use when you are able to extract correct data.

Please let me know if these suggestions help.

-Eleon

View solution in original post

8 REPLIES 8
Eleon BORLINI
ST Employee

Hi @Community member​ ,

I checked by our ST experts, and here you can find their feedback.

  • It is not clear if the data you are showing are correct or not, if limited to a screenshot of the debugger... at first glance, they looks wrong, since they are saturated between +-32768, but if this is the very first frame it could be correct to have such numbers, since you have to wait that the CIC filter is converging. In any case, the suggestion is to try to stream the data in some different ways than the debugger (e.g. USB, UART if you are fast enough), in order to have a more complete picture;
  • For the dBSPL calculation, there are a couple of libraries: one in the source code of the FP-AUD-SMARTMIC1 function pack (C\Middlewares\ST\STM32_AcousticDB_Library) and the other one in binary format in the STM32L4Cube firmware package, that you can use when you are able to extract correct data.

Please let me know if these suggestions help.

-Eleon

Hi Eleon,

1)Well even am not clear of the data shown . may be the inputs and suggestions will be considered further .

Thanks to the ST experts and you.

2) Well there are lots of libraries firmware packages your guiding through.

If any assistance needed further will definitely get back.

gregstm
Senior III

I can only offer a few suggestions based on my experience so far with MEMs microphones. Note, I write directly to registers and don't use any libraries:

  • use 32 bit arrays so you can see what the raw data from the microphone looks like
  • you will need a simple filter to remove the DC offset (search for "DC blocking filter Knowles")
  • capture a 1000 or so samples at full speed and download it to a spreadsheet to see what the waveform looks like
  • a tuning fork is handy for producing a test tone
  • your db calculations will depend on the sensitivity of your microphone, I swapped from a -36dBFS to a -26dBFS to get around three times more resolution at low volumes (note a more sensitive microphone will give you less dynamic range)
  • reading "Understanding Microphone Sensitivity by Jerad Lewis" might help
  • beware... I have had some mems microphones fail slowly (probably because they were improperly loaded/washed when they were made) - I hand solder my prototype mems microphones myself now...
  • if you get to product stage, probably best to put the mems microphone on a daughter board for easy replacement

Hi @Community member​ ,

Well thanks a lot for your hands on suggestions based on your experiences.

To be frank I am a total newbie to these MEMS mic audio processing and STM32s MCUs and IDEs.

But your suggestions will definitely save the time I guess.

Thanks once again.

Hi @Community member​ ,

In the above section you have mentioned of using 32 bit arrays and capturing 1000 samples , could you please elaborate a bit more and provide any links further in support to it. I am using MEMS mic ICS43432 and STM32f466 re nucelo board.

Thanks in advance.

Hi Eleon,

To get the data frames of pcm audio from buffer to display on UART,

If possible can you just support through or could you provide if there are any links in support of it.

Thanks in advance.

I found it useful to take the raw 32 bit data from the DFSDM and save it into a buffer (the size 1000 was just a manageable number), without any processing. Then I used my own routines to "print" the data to a serial port - I then pasted that data into a spreadsheet and used the graphing tools of the spreadsheet to see what is going on. I save the spreadsheets for later reference. It is easy to make assumptions about the raw data and mess up the initial processing. I sometimes use spreadsheet calculations to emulate my software algorithms - so I can test the processing with known data and graph the results. I have just realised you are using an I2S microphone, I moved to the PDM microphones to give me a greater range of high performance microphones (but understanding and getting the DFSDM going at a register level was a struggle) - I hope some of this helps, but possibly not, I am also new to MEMs microphones and have found it a bit of a slow process to get things right - but I can think of many good applications for these things so I will keep persisting...

SG.4
Associate II

Hi @Community member​ ,

Thank you for the response. Your last words like keep persisting which says keep trying. well will definitely do that.

thanks for the analysis explanation. well even this mems mic i2smems mic to gives a 1 bit data PDM output too.