diff --git a/os/hal/ports/STM32/STM32F1xx/stm32_dma.c b/os/hal/ports/STM32/STM32F1xx/stm32_dma.c index c3b39d37c..f6d8c8f49 100644 --- a/os/hal/ports/STM32/STM32F1xx/stm32_dma.c +++ b/os/hal/ports/STM32/STM32F1xx/stm32_dma.c @@ -472,7 +472,18 @@ void dmaStreamRelease(const stm32_dma_stream_t *dmastp) { "not allocated"); /* Disables the associated IRQ vector.*/ +#if !(STM32_HAS_DMA2 && !defined(STM32F10X_CL)) || defined(__DOXYGEN__) nvicDisableVector(dmastp->vector); +#else + /* Check unless it is 10 or 11 stream. If yes, make additional check before + disabling IRQ.*/ + if (dmastp->selfindex < 10) + nvicDisableVector(dmastp->vector); + else { + if (dma_streams_mask & (3 << 10) == 0) + nvicDisableVector(dmastp->vector); + } +#endif/* STM32_HAS_DMA2 && !STM32F10X_CL */ /* Marks the stream as not allocated.*/ dma_streams_mask &= ~(1 << dmastp->selfindex);