cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with reading PDM data from digital MP34DT06J microphone using SAI

Shivam1282
Associate II

I am currently working on a project that involves reading PDM (Pulse-Density Modulation) data from a digital MP34DT06J microphone and converting it to PCM (Pulse Code Modulation). However, I am encountering difficulties when attempting to read data from the PDM buffer using SAI (Serial Audio Interface).

To provide some context, I have successfully tested the microphone using the I2S (Inter-Integrated Sound) interface, where everything works as expected. However, when I switch to the SAI interface, I am unable to read any data from the PDM buffer.

Here are the specifics of my setup:

  • MCU: STM32L431KBU6.
  • Microphone: MP34DT06J
  • L/R channel selection: Connected to GND
  • FS (Frame Sync) pin: Left as NC (No Connection)

Despite configuring the SAI interface according to the relevant specifications, I am still unable to retrieve any data from the PDM buffer. I have double-checked the connections and reviewed the documentation, but I have not been able to identify the root cause of this issue.

If possible, I would greatly appreciate it if someone could provide an example or code snippet demonstrating the correct setup and configuration of the MP34DT06J microphone with the SAI interface. This would greatly help me in resolving the problem and understanding any potential errors I may have made in my implementation.

Thank you in advance for your assistance. I look forward to your valuable input.

2 REPLIES 2
LCE
Principal

You should post the relevant code snippets here:

- SAI init
- DMA init
- buffer init
- SAI / DMA start
- IRQ handlers

Shivam1282
Associate II

Hey! @LCE, I'm attaching the code main.c file below. Please have a look.
Also, the MX_PDM2PCM_Init function definition is given below for reference.

 

void MX_PDM2PCM_Init(void)

{

PDM1_filter_handler.bit_order = PDM_FILTER_BIT_ORDER_LSB;

PDM1_filter_handler.endianness = PDM_FILTER_ENDIANNESS_BE;

PDM1_filter_handler.high_pass_tap = 2104533974;

PDM1_filter_handler.in_ptr_channels = 1;

PDM1_filter_handler.out_ptr_channels = 1;

PDM_Filter_Init(&PDM1_filter_handler);

 

PDM1_filter_config.decimation_factor = PDM_FILTER_DEC_FACTOR_64;

PDM1_filter_config.output_samples_number = 16;

PDM1_filter_config.mic_gain = 24;

PDM_Filter_setConfig(&PDM1_filter_handler, &PDM1_filter_config);

}