2017-01-27 02:16 AM
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 libraryCould some one help me for this strange issue??Thanks!!Regards,
Hemanth2017-01-27 04:02 AM
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 ?
2017-01-27 09:55 AM
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.
2017-01-27 04:01 PM
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.
2017-01-31 02:36 AM
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 Rx4. Enable DMA Tranfer Complete INT (Transfer complete interrupt mask)5. Enable DMA stream6. Enable DMA transfer in SDIO7. Wait for DMA Transfer Complete8. Disable DMA transfer in SDIO9. Disable DMA stream10. 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
2017-01-31 03:52 AM
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.
2017-02-08 10:57 PM
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.