cancel
Showing results for 
Search instead for 
Did you mean: 

STMH743ZIT6: DMA + DFSDM configuration for MEMS microphones

MannyMarc35
Visitor

 

Hello everyone,

in my current project, I'm working with a Nucleo H743ZI2 (with an STMH743ZIT6). My goal is to read audio data from MEMS microphones using DMA and DFSDM filters. The ultimate aim is to build an 8-microphone array, but for the first step, I only want to read data from a single microphone. And this is exactly where my problem lies: currently, no data is being saved in RAM. I suspect the problem is with DMA, as I've observed the following:

DFSDM:

  • The following bits are set in the DFSDM control register: DFEN (DFSDM_FLT enabled), RCONT (continuous mode), and RDMAEN (DMA channel enabled to read data for the regular conversion).
  • The value of the RDATAR register changes continuously => data is being read by DFSDM.
  • In the ISR register, REOCF (end of regular conversion) is set, followed by ROVRF (regular conversion overrun) => REOCF should be cleared by DMA (it might be cleared and set again, which goes unnoticed during debugging, but i don´t think so as the DMA is not started correctly).

DMA:

  • The function HAL_DFSDM_FilterRegularStart_DMA() returns HAL_OK.
  • However, the EN bit in the configuration register is not set afterward.
  • The M0AR register (memory 0 address register) is correctly set => points to the address of the AudioBuffer.
  • The PAR register (peripheral address register) is correctly set => points to RDATAR of DFSDM.
  • The NDTR register (number of data register) does not change its value => no interrupt is triggered.

It seems to me that DMA is not starting correctly or that something in the configuration is incorrect. Even when I try to start the DMA manually by the following function, no interrupt is triggered:

 

void start_DMA1_Stream0(void)
{
  DMA1_Stream0->CR = 0;
  while (DMA1_Stream0->CR & DMA_SxCR_EN);

  DMA1_Stream0->PAR = (uint32_t)DFSDM1_FLT0_CR1; // Peripherie adress
  DMA1_Stream0->M0AR = (uint32_t)&audioBuffer; // buffer where the data shoul be stored
  DMA1_Stream0->NDTR = 1024; // Sample count

  DMAMUX1_Channel0->CCR = 101;

  DMA1_Stream0->CR =  (1 << 2)  | // Transfer error interrupt enable
                      (1 << 3)  | // Half transfer interrupt enable 
                      (1 << 4)  | // Transfer complete interrupt enable                      
                      (1 << 8)  | // Circular Mode 
                      (1 << 10) | // Memory increment
                      (1 << 12) | // Peripheral data size = word 
                      (1 << 14) | // Memory data size = word
                      (1 << 0);   // Enable
}

 

I have attached main.c below, maybe someone can help me with my problem. It also contains a few debugging functions that are not so important.

Thank you in advance.

 

 
0 REPLIES 0