cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 DMA interrupt not generated all the time

Hemanth Sundaresh
Associate II
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
6 REPLIES 6
T J
Lead
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  ?

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.

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.

Posted on January 31, 2017 at 10:36

I have configured only 2 INT

1. SDIOIT (SD I/O received interrupt)

2. TCIE (DMA Transfer complete)

During DMA data transfer, SDIOIT is Disabled

Below is the sequnce for reading data

1. Disable SDIO INT (SD I/O interrupt received interrupt)

2. Send CMD53 (extended-Read CMD)

3. Config DMA for Rx

4. Enable DMA Tranfer Complete INT (Transfer complete interrupt mask)

5. Enable DMA stream

6. Enable DMA transfer in SDIO

7. Wait for DMA Transfer Complete

8. Disable DMA transfer in SDIO

9. Disable DMA stream

10. Enable SDIO INT (SD I/O interrupt received interrupt)

Problem is I am stuck in step 7 (DMA INT not generated)

Before step 6, I tried clearing all DMA & SDIO flag still same behaviour

Posted on January 31, 2017 at 11:52

We all have a steep learning curve, because there are so many branches of understanding to comprehend.

Did you use CubeMX to generate the startup file ?

Can you step by step in the program ?

I would suggest the DMA is not being fired or finishing before your ready to check it.

Posted on February 09, 2017 at 06:57

I figured a way around for this issue :)

The SDIO flag (DCRCFAIL -> Data block sent/received (CRC check failed)) was set.

Once I clear the flag and enable DMA stream it works fine.