Showing results for 
Search instead for 
Did you mean: 

SPI doesn't work with PDM mic

Associate II

Hello guys,

I'm testing a PDM mic with the nucleo-h723gz to capture in polling mode. Now I tested it with the I2S peripheral and I don't have any problem at all. But when i try to use the SPI I don't get any data: my buffer remain empty and the register happen to be cleared (after the initialisation). Every time my project get stuck in the timeout management in the ***_hal_spi.c (the RXWNE/FRLVL flags are always zero). I thought the problem can be that the PDM fail to deliver any data cause it isn't clocked properly, but I tried already various combination for the clock.

My PDM mic works when it has a clock 1-3 MHz. So the only thing necessary is a baud rate 1-3 Mbits/s, isn't?

Or I have to set the peripheral clock to a right value?


This is my clock configuration.

PS. also I attached the main.c

Associate II

I forgot to say that I adjusted the baud rate prescaler at 128, in order to have a baud rate of 1,56Mbits/s.

My work is also stuck on whether spi can drive PDM microphones, so have you verified this conclusion in subsequent work? I also want to ask, do you only need to configure the clk clock frequency at 1~3Mhz to drive a PDM microphone to make it work? Or does the PDM microphone have drivers and files (low-level register files) to make the microphone work properly? I look forward to your answer, this is really important to me. Thanks