Skip to main content
JWill.12.264
Visitor II
April 28, 2022
Question

I'm having issues with the DMA Callback functions never being called after triggering the "HAL_SAI_Transmit_DMA" function.

  • April 28, 2022
  • 1 reply
  • 4111 views

Situation - I'm combining code examples from the STM32WB Opus Library code, with that of the Echo Cancellation (AEC) Function Pack. Using the code base to have support for a microphone, speaker, and Bluetooth.

When implementing the code for the CCA01M1 board from the AEC example into the BVOPUS_Peripheral Example, I'm not seeing correct behavior when initializing the SAI/DMA and initiating a transmit function. The DMA callback never fires, which leads to it being unprocessed, and the SAI handle staying in a locked state.

Any ideas where to look would be really appreciated. Attached are the cca01m1_audio.c and .h files.

Relevant functions are:

CCA01M1_AUDIO_OUT_Init() // Top level init

SAI_MspInit() // DMA Config

HAL_SAI_Transmit_DMA() - Function called presenting the issue.

I am expecting to see breakpoints being hit in callback functions specified in the HAL_SAI_Transmit_DMA() function here. When watching breakpoints in these three functions, I'm never seeing them triggered.

Finally, thinking this was a problem with circular buffers, I tried setting it to normal as a sanity check. I'm not seeing these triggered in either case.

 /* Set the SAI Tx DMA Half transfer complete callback */
 hsai->hdmatx->XferHalfCpltCallback = SAI_DMATxHalfCplt;
 
 /* Set the SAI TxDMA transfer complete callback */
 hsai->hdmatx->XferCpltCallback = SAI_DMATxCplt;
 
 /* Set the DMA error callback */
 hsai->hdmatx->XferErrorCallback = SAI_DMAError;
 
 /* Set the DMA Tx abort callback */
 hsai->hdmatx->XferAbortCallback = NULL;

Code to initiate audio transfer after configuration:

CCA01M1_AUDIO_OUT_Play();

After initiating with the above "Play" function, I planned to use the half complete ISR callback to do a ping/pong buffer implementation to continuously stream audio.

Any help would be appreciated. I've been banging my head against this one for a few days.

This topic has been closed for replies.

1 reply

waclawek.jan
Super User
April 28, 2022

Read out and check/post the SAI/relevant DMA registers content.

If you see the respective DMA HT and TC status bits set and still no interrupt, debug it as the "usual" interrupts-not-firing case.

JW

PS. Maybe the "DMA initialization order" Cube-MX bug?