cancel
Showing results for 
Search instead for 
Did you mean: 

SAI4 Receiving, DMA Busy, No Buffer Update? (STM32H747I-DISCO)

miloa
Associate II

Hello,

I'm slowly losing my sanity so I figure I'd make a post here. I set up SAI4 to interface with BDMA, hoping to retrieve data from the onboard MEMS microphone and store it in a buffer in RAM_D3. Ideally I'd like for that data to be processed by the CPU, but I can't even get the buffer to fill up.

The following code produces the output below:

audio_buffer[0] = 5;
audio_buffer[1] = 6;
audio_buffer[2] = 7;
audio_buffer[3] = 8;

// ...
// Inside main loop:
printf("SAI State: %d \r\n", HAL_SAI_GetState(&hsai_BlockA4));
printf("SAI Error: %lu \r\n", HAL_SAI_GetError(&hsai_BlockA4));
printf("SAI Buffer Address: 0x%08lx\r\n", SAI4_Block_A->DR); 
printf("DMA State: %d \r\n", HAL_DMA_GetState(&hdma_sai4_a));
printf("DMA Error: %lu \r\n", HAL_DMA_GetError(&hdma_sai4_a));
printf("Pointer location: %p \r\n", audio_buffer);
printf("Audio Buffer Data:\r\n");
for (int i = 0; i < 10; i++) {
	printf("[%d]: %d\r\n", i, audio_buffer[i]);
}

miloa_1-1753220830572.png

 

As you can see, SAI4 is in HAL_SAI_STATE_BUSY_RX and BDMA is in HAL_DMA_STATE_BUSY. However, audio_buffer is not being filled. It's worth mentioning that there doesn't even seem to be zeroes coming into the buffer, as the values I set manually are never changed.

Does anyone know what may be causing this? I'll drop my CubeMX configuration, in case it is useful:

miloa_2-1753221044535.png

miloa_3-1753221057415.png

miloa_4-1753221072094.png

miloa_5-1753221083533.png

 

Thanks in advance :(

 

0 REPLIES 0