From 19fe437fe48c70d890f8d3e0a016ea8168ee96d9 Mon Sep 17 00:00:00 2001 From: Vishwanath Martur <64204611+vishwamartur@users.noreply.github.com> Date: Sat, 2 Nov 2024 13:25:35 +0530 Subject: [PATCH] Fix DMA HAL enabling FIFO Error interrupt even if FIFO is not enabled Related to #76 Add condition to enable FIFO Error interrupt only if FIFO is enabled. * Modify `Src/stm32h7xx_hal_dma_ex.c` to check if FIFO is enabled before enabling FIFO Error interrupt. * Add condition to line 292 to enable FIFO Error interrupt only if FIFO is enabled (direct mode disabled). --- Src/stm32h7xx_hal_dma_ex.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Src/stm32h7xx_hal_dma_ex.c b/Src/stm32h7xx_hal_dma_ex.c index a134b4e..4ad87ce 100644 --- a/Src/stm32h7xx_hal_dma_ex.c +++ b/Src/stm32h7xx_hal_dma_ex.c @@ -289,7 +289,10 @@ HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_ { /* Enable Common interrupts*/ MODIFY_REG(((DMA_Stream_TypeDef *)hdma->Instance)->CR, (DMA_IT_TC | DMA_IT_TE | DMA_IT_DME | DMA_IT_HT), (DMA_IT_TC | DMA_IT_TE | DMA_IT_DME)); - ((DMA_Stream_TypeDef *)hdma->Instance)->FCR |= DMA_IT_FE; + if(((DMA_Stream_TypeDef *)hdma->Instance)->FCR & DMA_SxFCR_DMDIS) + { + ((DMA_Stream_TypeDef *)hdma->Instance)->FCR |= DMA_IT_FE; + } if((hdma->XferHalfCpltCallback != NULL) || (hdma->XferM1HalfCpltCallback != NULL)) { @@ -709,4 +712,3 @@ static void DMA_MultiBufferSetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddres /** * @} */ -