2024-08-10 10:00 AM
Still looking for ANY example showing a STM32G4 using a PDM microphone over SAI. ST sells both, and supposedly work together, but all I see in support forums is everyone (including ST employees) saying how they have to paste things together from unsupported other projects, (MEMSMIC is not a supported library in CubeIDE for G4) to add the PDMtoPCM support, then have tons of threads where they can't get it to work - clocking problems, build problems, etc. Does ST actually support PDM microphones on G4, or not? The data sheets say yes, the actuality of CubeIDE, support and examples say no.
Can anyone provide a ST supported example of a G4 capturing PDM microphone data (one channel will do) and storing / forwarding as PCM data?
2024-08-12 06:51 AM
Hello @TZiel.1,
Here are some specific application notes, tutorials, and resources that focus on PDM to PCM conversion and using STM32CubeIDE:
I hope my answer has helped you. When your question is answered, please select this topic as solution that answered you, it will help others find that answer faster.
Thanks for your contribution.
Dor_RH
2024-08-12 07:13 AM
I should have assumed you'd respond with that. To be more clear: have read AN3998, AN5027, and UM2372, at least a dozen times. I have built the MEMSMIC application - which doesn't use CubeIDE configuration or calls, or can be imported into a current project, by the way. I have read the PDM to PCM conversion tutorial, and I understand how it works. I have implemented the code, and setup a conversion exactly the same, data sizes, array sizes, pointers, decimation, filter constants, etc etc.
CubeIDE does not seem to let you set the output clock for SAI A/B to any reasonable frequency for STM32G4, nor does it allow you to select / use the PDM2PCM library natively. Putting that aside, I have gotten the clock working close enough by using a master clock divider, and gotten the library for G4 implemented in the code, and it isn't producing usable PCM conversion, even from the test tone examples.
As previously, it seems that there are no recent working examples of a STM32G4 or L4 CubeIDE project successfully using any PDM microphone that I can find, and all of the examples provided are 4-5 years old, do not match the current SAI, library or Cube implementation. Since you seem to imply that this is a very straightforward process - could you post a simple working STM32G4 PDM single microphone to I2S PCM speaker passthrough example, using the current tools?
2024-08-13 02:32 AM
Hello @TZiel.1,
Unfortunately, there is no PDM example currently available. But we are working on providing such example.
Thanks for your contribution.
Dor_RH