STM32H747 - I2S Fullduplex with DMA is not working
I'm trying to build an audio project using STM32H747 MCU.
I wish to configure the cortex M7 to process the audio in and out buffers.
I'm trying to work with double buffers of input and output. the DMA should handle the transactions to and from the i2s peripheral.
HAL_I2SEx_TransmitReceive_DMA(&hi2s2, (uint16_t*)&outBuffer[0][0], (uint16_t*)&inBuffer[0][0], AUDIO_BUFFER_U16_STREAMS/4);
and the half & full complete callbacks are:
void HAL_I2SEx_TxRxHalfCpltCallback (I2S_HandleTypeDef *hi2s) {
pInBuffer = &inBuffer[0][0];
pOutBuffer = &outBuffer[0][0];
// SCB_CleanDCache();
// SCB_InvalidateDCache();
dataReadyFlag = true;
}
void HAL_I2SEx_TxRxCpltCallback (I2S_HandleTypeDef *hi2s) {
pInBuffer = &inBuffer[1][0];
pOutBuffer = &outBuffer[1][0];
// SCB_CleanDCache();
// SCB_InvalidateDCache();
dataReadyFlag = true;
}
and all I'm doing in the super loop is to copy the input to the output when I have dataReadyFlag == true.
I hooked all the I2S lines to a data logger and the peripheral seems to work.
but whenever I get a new buffer from DMA it is Empty and all set to '0'.
Why this is happening ?
please help me with e full explanation on how to fix this.
as you can see I already tried setting the buffer to a specific RAM location to prevent DMA and Catch issues but it didn't help. maybe I did it wrong.
