Skip to main content
Visitor II
April 22, 2021
Question

STM32F7 SPI & DMA: HAL_SPI_TxCpltCallback race condition in HAL Library

  • April 22, 2021
  • 0 replies
  • 593 views

My setup:

SPI(Tx only) + DMA (not circular) and no FIFO

Now HAL_SPI_TxCpltCallback() is executed only if the transfer-complete-flag is also set before HAL_DMA_IRQHandler() is handled for "half transfer complete interrupt"

Problem is:

in HAL_DMA_IRQHandler():

hdma->ErrorCode |= HAL_DMA_ERROR_FE;

triggers because the FIFO is off and should be ignored because FIFO is not used.

But it triggers the error routine at the end of HAL_DMA_IRQHandler() and causes the problems.

Workaround:

Always activate the FIFO.

    This topic has been closed for replies.