How to know the when the DMA transfer done?
Hi.
I use a trigger source to trigger SPI tx/rx linked-list DMA (not circular). But have no clues how to jude if the tx/rx DMA is done. I traced the IRQ handler, it calls, the code below:
/**
* @brief DMA SPI transmit receive process complete callback.
* hdma: pointer to a DMA_HandleTypeDef structure that contains
* the configuration information for the specified DMA module.
* @retval None
*/
static void SPI_DMATransmitReceiveCplt(DMA_HandleTypeDef *hdma)
{
SPI_HandleTypeDef *hspi = (SPI_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
if (hspi->State != HAL_SPI_STATE_ABORT)
{
if ((hspi->hdmarx->Mode == DMA_LINKEDLIST_CIRCULAR) &&
(hspi->hdmatx->Mode == DMA_LINKEDLIST_CIRCULAR))
{
#if (USE_HAL_SPI_REGISTER_CALLBACKS == 1UL)
hspi->TxRxCpltCallback(hspi);
#else
HAL_SPI_TxRxCpltCallback(hspi);
#endif /* USE_HAL_SPI_REGISTER_CALLBACKS */
}
else
{
/* Enable EOT interrupt */
__HAL_SPI_ENABLE_IT(hspi, SPI_IT_EOT);
}
}
}
It seems only when the DMA is configured as 'DMA_LINKEDLIST_CIRCULAR', the 'HAL_SPI_TxRxCpltCallback()' get called.
But in other situation, it only enable the EOT interrupt and simply return.
