Skip to main content
Hemanth Sundaresh
Associate II
January 27, 2017
Question

STM32F4 DMA interrupt not generated all the time

  • January 27, 2017
  • 6 replies
  • 2014 views
Posted on January 27, 2017 at 11:16

Hello All,

I am using STM32F407 discovery board. I am using SD IO card with this board.

I tried configuring DMA for data transfer.

I observed that the interrupt (DMA interrupts) are not generated after Transfer complete evertime.

After fresh compilation in IAR workbench, the interrupt are generated correctly, but subsequent runs the DMA interrupt is not generated despite data transfer done.

I have a blocking condition check that wait for the completion of SDIO data transfer.

In most of the case it is waiting endlessly here because of no Transfer complete interrupt generation by DMA.

Sometimes if halt the controller and double click of register veiw of DMA2 (DMA2_S3M0AR), the interrupt is generated correctly!!

After this there are no more DMA interrupt issues.

//configure dma for rx

SD_LowLevel_DMA_RxConfig(data, count);

//flag to check transfer complete

DMAEndOfTransfer = 0;

//enable dma streaming

DMA_Cmd(SD_SDIO_DMA_STREAM, ENABLE);

//enable dma in sdio

SDIO_DMACmd(ENABLE);

while(!DMAEndOfTransfer);

//dma disable rx

SDIO_DMACmd(DISABLE);

//enable sdio interrupt

SDIO_ITConfig(SDIO_IT_SDIOIT, ENABLE);

No issues are observed in Non-DMA case

I am using Std Peripharal library

https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-libraries/stsw-stm32065.license%3d1485511120029.html

Could some one help me for this strange issue??

Thanks!!

Regards,

Hemanth
    This topic has been closed for replies.

    6 replies

    T J
    Senior III
    January 27, 2017
    Posted on January 27, 2017 at 13:02

    There was an issue mentioned here last week, where DMA interrupts are flakey when there are 2 concurrent DMA transfers on DMA 2 whilst another is transferring  on DMA 1.

    sometimes the interrupts wont fire...

    are you running multiple streams simultaneously  ?

    Hemanth Sundaresh
    Associate II
    January 27, 2017
    Posted on January 27, 2017 at 17:55

    No, I am using only one stream.

    No other peripheral is configured for dma usage.

    Same stream is used alternately for Reception and Transmission of SDIO data.

    T J
    Senior III
    January 28, 2017
    Posted on January 28, 2017 at 00:01

    I guess that you are not servicing every interrupt.

    generally you would check the DMA has completed, clear the interrupt flag and then initiate a new transfer.

    if you clear the flag after you initiate the transfer, this will be the problem.

    a higher priority interrupt will interrupt your lower priority interrupt process.

    thereby sometimes in the middle of your low priority interrupt, you may be waiting 1 - 2mS.

    so before you leave this interrupt process, your new DMA transfer has already completed. then if you clear the DMA interrupt flag, you wont get a interrupt, since the new DMA transfer has already completed.