Showing results for 
Search instead for 
Did you mean: 

Has anyone got any examples of how to read the built-in PDM microphone of the Discovery IoT Board (B-L475E-IOT01A)?

Associate II
Associate II

Hi everyone,

I'm a complete noob to the world of STM32, which is why I have recently acquired a Discovery board to try some on-board sensors and output some readings.

I was a bit surprised to find that there aren't really any tutorials which can tell me how to read the PDM microphone that is onboard the Discovery Board (the physical MCU board has a PDM MEMS microphone soldered in).:

0693W00000KcOmtQAF.png0693W00000KcOnNQAV.pngAfter looking at the datasheet for the board, I managed to find the pins which are allocated to the MEMS microphone by default:


When initialize my code with the default peripherals set up, I noticed this variable is initialized:

0693W00000KcOmZQAV.png0693W00000KcOoLQAV.pngI would ideally like to convert the values from the MEMS microphone into I2S format, as I found an Open Source project which uses I2S audio data for custom functions.

I think the Serial Audio Interface (SAI) can be used to convert the data from its default PDM format into I2S format, but I'm not sure how this works in principle, let alone how to implement it.

I would like to repeat, I have no idea what I'm doing, I'm used to Arduino's abstracting all the lower level coding to interact with sensors, so this whole approach is new to me. As such, I would appreciate being able to see actual projects (especially main.c files) as opposed to being linked to different documentation pages online :loudly_crying_face:

There's a lot of info on the internet, I've read stuff about the pdm2pcm library, and DFSDM_Filter, but these haven't really looked like what I was hoping to find (working code examples for my board).

This is the closest match I've been able to find online, but even then there is no DFSDM channel that's initialized in this code so that still confuses me:

Any help would be greatly appreciated.