Why is my DMA interrupt handler getting called when I have disabled interrupt checking?

I am trying to do SPI communication using DMA. This is the DMA configuration I am using for DMA channel 5:

#define DMA_SPI_CFG (DMA_DEST_ADDR_STEP_SIZE_1 |
DMA_SRC_ADDR_STEP_SIZE_1 |
DMA_DEST_ADDR_POS |
DMA_SRC_ADDR_POS |
DMA_LITTLE_ENDIAN |
DMA_DISABLE_INT_DISABLE |
DMA_ERROR_INT_ENABLE |
DMA_COMPLETE_INT_ENABLE |
DMA_COUNTER_INT_DISABLE |
DMA_START_INT_DISABLE |
DMA_DEST_WORD_SIZE_32 |
DMA_SRC_WORD_SIZE_8 |
DMA_SRC_SPI0 |
DMA_PRIORITY_0 |
DMA_TRANSFER_P_TO_M |
DMA_DEST_ADDR_INC |
DMA_SRC_ADDR_STATIC |
DMA_ADDR_LIN |
DMA_DISABLE)

As can be seen, only ERROR and COMPLETE interrupts are enabled.

However, I have found that my program calls the interrupt handler for DMA channel 5 [void DMA5_IRQHandler(void)] when neither of these interrupts have occurred. For example if I check the value of DMA->STATUS[5] inside the DMA interrupt handler, it’s value is is 0x42, which means only START_INT_STATUS bit is 1 and both ERROR and COMPLETE status bits are 0. Then why is my program going inside DMA5_IRQHandler()?

Hi @mahaju,

Can you please try calling the 'Sys_DMA_ClearChannelStatus(uint32_t num) ’ function prior to starting your DMA transfer. It is possible that there are residual statuses that are left in the DMA registers after being configured.

It is also recommended that you manually clear the registers using the same function call every time the DMA Compete Interrupt is triggered.

Hopefully this is able to remedy the problem, but if you continue to see issues please let us know and we can work to reproduce and fix the issue on our end.