cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 SPI & DMA: HAL_SPI_TxCpltCallback race condition in HAL Library

cfischbeck
Associate II

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.

0 REPLIES 0