I2S and DMA HAL problem (DMA trigger only once) STM32H7
Hello,
I'm trying to use the I2S transceiver on a STM32H7.
I did a first simple experiment using the HAL function: HAL_I2S_Receive_DMA
I use a basic loop in the main:
while (1)
{
if (i2s_bsy == 0) {
i2s_bsy = 1;
i2s_status = HAL_I2S_Receive_DMA(&hi2s1, samples, 512);
}
}
i2s_bsy is cleared in: HAL_I2S_RxCpltCallback
void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s) {
i2s_bsy = 0;
}
Doing that the call back is called only once, I found why, in HAL_I2S_Receive_DMA it is mentionned that the I2S core is kept enable to avoid losing sync but it seems that configuring the DMA while the I2S is enabled doesn't work.
If I test disabling i2s in the callback to be sure to reconfigure DMA each time with i2s disabled then it "works".
void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s) {
i2s_bsy = 0;
__HAL_I2S_DISABLE(hi2s);
}
I think either something is wrong in the HAL blocking the DMA from retriggering or it's not possible to retrigger DMA when I2S is enabled rendering it useless unless using circular mode.
