2025-01-10 07:31 PM - edited 2025-01-10 07:43 PM
I'm testing whether HAL_I2S_TxCpltCallback or HAL_I2S_TxHalfCpltCallback is called properly by setting i2s to normal and periodically calling HAL_I2S_Transmit_DMA. However, HAL_I2S_TxCpltCallback or HAL_I2S_TxHalfCpltCallback is called only once and not again. I want to use i2s in normal mode, not circular mode, so I'm testing like below. Is there something wrong?
When I check the return value with status = HAL_I2S_Transmit_DMA(&hi2s2, audioBuffer, AUDIO_BUFFER_SIZE);, HAL_BUSY(2) is returned.
while (1)
{
HAL_I2S_Transmit_DMA(&hi2s2, audioBuffer, AUDIO_BUFFER_SIZE);
HAL_Delay(1000);
}
void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s)
{
dma_count++;
}
void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
{
dma_count++;
}
2025-01-11 12:57 AM
>I want to use i2s in normal mode, not circular mode, so I'm testing like below. Is there something wrong?
Nothing wrong.
I2S "normal" = standard, you have to use with all I2S DACs .This is the protocol of the transfer.
But the DMA mode is the point :
Start DMA in "normal" mode, transfers data one time. end.
In circular mode, its sending continuous. (the usual DMA mode for constant working DAC or ADC on I2S )
So - just your decision, what it should do: normal DMA = one block , circular DMA = continuous stream.
2025-01-11 03:09 AM
Thanks for your reply
Since you are calling HAL_I2S_Transmit_DMA every second
Shouldn't HAL_I2S_TxCpltCallback be called every second?