2025-08-14 11:03 PM
Hello,
I am blocked with a personnal project using a STM32F769I-DISCO, TouchGFX and audio: DMA IT is not triggered. I have no idea why, no idea how to investigate more in the code. I will provide few things in my question, not because I don't want but because I don't know yet what to provide.
I created a project with TouchGFX Designer and now I want to add the BSP code to play audio. My code initialize all devices (created by the tool) and try to play audio
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DSIHOST_DSI_Init();
MX_LTDC_Init();
MX_FMC_Init();
MX_QUADSPI_Init();
MX_DMA2D_Init();
MX_I2C4_Init();
MX_LIBJPEG_Init();
MX_CRC_Init();
MX_USART1_UART_Init();
MX_DFSDM1_Init();
MX_SAI1_Init();
MX_I2S1_Init();
MX_TouchGFX_Init();
/* Call PreOsInit function */
MX_TouchGFX_PreOSInit();
/* USER CODE BEGIN 2 */
/* Init audio */
initAudio();
playAudio();
while(1);
Audio code
/**
* @brief Plays the audio file
* @PAram None
* @retval None
*/
void playAudio(void)
{
// BSP_AUDIO_OUT_Play((uint16_t*)&ptrAudio, sizeAudio);
BSP_AUDIO_OUT_Play((uint16_t*)&A_subtle_radar_ping_wav, A_subtle_radar_ping_wav_len);
}
/**
* @brief Initialize the audio player
* @PAram None
* @retval None
*/
void initAudio(void)
{
GetFileInfo(info);
BSP_AUDIO_OUT_Init(OUTPUT_DEVICE_AUTO, uwVolume, info->SampleRate);
}
With this code, the audio file is played, nice. But it's played in a loop which is not what I want. If it could play only once, it would be nice.
So I created a smaller project with CubeIDE to learn. Same DFSDM1, SAI1, I2S1 init, same "audio code": audio loops as before.
I found an ugly way : IT number 57 (DMA2_Stream1)is fired, which then call a callback
/**
* @brief Calculates the remaining file size and new position of the pointer.
* @PAram None
* @retval None
*/
void BSP_AUDIO_OUT_TransferComplete_CallBack(void)
{
BSP_AUDIO_OUT_Stop(CODEC_PDWN_SW);
}
Ugly, but audio is then stopped and I also know that DMA IT is also working.
But when I try to do the same in my previous big TouchGFX code, I saw (debug) that IT is enabled but never fired.
So, questions are:
- Is there a way to specify to configure the DMA not as a loop but a single shot?
- Why IT is not fired? What should I investigate? Even if there is a positive answer to my previous question, I would like to understand what is wrong witht the IT