Skip to main content
ARicc.1
Associate
January 8, 2021
Question

Is there any SAI PDM example for STM32MP1?

  • January 8, 2021
  • 3 replies
  • 2268 views

I'm looking for device tree configuration to acquire 4/6 PDM microphones resulting in an ALSA tdm stream. It's mentioned in the official documentation here(https://www.st.com/content/ccc/resource/training/technical/product_training/group0/30/7d/ca/21/db/00/4c/d2/STM32MP1-Peripheral_Serial_Audio_Interface_SAI/files/STM32MP1-Peripheral_Serial_Audio_Interface_SAI.pdf/jcr:content/translations/en.STM32MP1-Peripheral_Serial_Audio_Interface_SAI.pdf) and in AN5027 but no reference to MP1 code

This topic has been closed for replies.

3 replies

PatrickF
ST Employee
January 11, 2021
In order to give better visibility on the answered topics, please click on 'Best Answer' on the reply which solved your issue or answered your question.Tip of the day: Try Sidekick STM32 AI agent
ARicc.1
ARicc.1Author
Associate
January 12, 2021

Hello Patrick,

thanks for sharing all the documentation.

Unfortunately I could not find any information (or example) about SAI PDM in the official Wiki.

As I've read in your application note(AN5027) it seems to be possible, but there are no tips on implementation on MP1. Do you have any more information about this?

Thanks,

Aldo

PatrickF
ST Employee
January 12, 2021

Although SAI HW support PDM microphones, this mode is only usable with Cortex-M4 using HAL (you might find examples on STM32H7 Cube).

SAI Linux driver does not support PDM microphones.

Under Linux, you should use DFSDM IP, which is much more powerful than SAI when using digital microphone (HW filtering) and you could connect up to 6 microphones using only 3 pins + 1 clock.

for HW example, 4 x microphones connected to DFSDM are available on STM32MP157x-EV1 board.

There is no SW example, but this is fully supported using ALSA and DFSDM driver as described in Wiki.

Regards.

In order to give better visibility on the answered topics, please click on 'Best Answer' on the reply which solved your issue or answered your question.Tip of the day: Try Sidekick STM32 AI agent
ARicc.1
ARicc.1Author
Associate
January 12, 2021

just replied off thread, sorry. Please read the post here below.

ARicc.1
ARicc.1Author
Associate
January 12, 2021

Hi Patrick,

thanks for the detailed info about SAI PDM.

Actually we have been through DFSDM, and we're looking for a solution to connect multiple PDM microphones (4/6) to STM32MP1 ALSA, to obtain a single multi-channel inteleaved input. The goal is to have a single card/device that records an interleaved stream of N microphones.

We have our own PCB based on STM32MP1 and we've connected 4 mics on DFSDM, but the result has been of 4 separate ALSA card/devices (following ST device tree for STM32MP157x-EV1)

Is there a way to make them interleaved at driver level? We'd like to avoid using ALSA's multi or similar.

Thanks,

Aldo

Christophe Guibout
ST Employee
January 13, 2021

Hi @ARicc.1​ ,

I got feedback from audio team which is in line with @PatrickF​ comment :

  • Recommanded way to use PDM microphones is DFSDM
  • The way to interleave inputs is through ALSA (not possible inside kernel driver)
  • If you don't want to use ALSA to interleave inputs, it can be done inside an application running on M4, but this needs some development and it will involves a latency to forward interleaved signal from M4 to virtual Alsa sound card on A7.

BR,

Christophe

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.