cancel
Showing results for 
Search instead for 
Did you mean: 

DMA_ISR with active bits even if I didn't enable the interrupts

CGalv
Associate III

Hi,

I'm working with DMA on an STM32F745. I have enabled a DMA interrupt for Transfer Complete on SPI RX, when the data is ready to be read. To do this, I set the TCIE bit in the DMA_SCR register. In the interrupt routine I read the data and I disable the DMA until its time to fire it up again.

It works fine, however when the interrupt is fired, I notice that the half-transfer complete flag, HTIF, is active in the DMA_ISR register, even though I didn't enable that interrupt. TCIF is also active as expected.

Why is HTIF active even though I didn't enable its interrupt?

In addition, the reference manual says:

"All the stream dedicated bits set in the status register (DMA_LISR and DMA_HISR) from the previous data block DMA transfer must be cleared before the stream can be re-enabled"

This means I need to spend cycles clearing the HTIF (and potentially the error flags too) even though I never requested them to be enabled, every time I read data. Is that expected?

Thanks!

4 REPLIES 4
berendi
Principal

> Why is HTIF active even though I didn't enable its interrupt?

So that one can poll it even when no interrupts are used. Someone might find this useful.

> I need to spend cycles clearing the HTIF (and potentially the error flags too)

You can clear all the flags in one operation when you have to clear TCIF, so no cycles will be wasted.

TDK
Guru

> Why is HTIF active even though I didn't enable its interrupt?

Flags are still updated even if the corresponding interrupt enable bit is disabled. They won't trigger an interrupt, but they are still updated.

If you feel a post has answered your question, please click "Accept as Solution".
prain
Senior III

Don't worry, it is usuall. Flags are set but will not generate any interrupt until you set the corresponding interrupt enable bit.​

CGalv
Associate III

> You can clear all the flags in one operation when you have to clear TCIF

Of course, didn't think I could OR all the flags into one 🙂 I guess then it's just code clutter left, but I can live with that!

> Flags are still updated even if the corresponding interrupt enable bit is disabled

Ok! I was confused because the flag seemed to be associated with the interrupt as per the description, so I was expecting no interrupt => no flag update. I will just clear all the flags as suggested in the docs before re-enabling the DMA.