cancel
Showing results for 
Search instead for 
Did you mean: 

Correct way to end DMA

Biohazard
Associate

Our STM32F7 no-OS system calls HAL_MMC_ReadBlocks_DMA() to read multiple blocks of data from eMMC storage.

The STM HAL sets the MMC state machine SDMMC_DTIMER register at the start of the DMA.

The DMA completes and our code receives the interrupt and handles it, however if nothing is done to reset the SDMMC state machine the DTIMER still counts down and after 90 seconds it times out, setting a flag and raising a timeout interrupt. This condition prevents subsequent DMA transfers from starting.

Our solution is to call HAL_MMC_Abort() when handing the DMA complete interrupt, which aborts the current transfer and disables the MMC. This seems to work ok and can now start other DMA transfers without a problem, but the description makes it sound like it might be overkill.

Is there a better way to end the DMA transfer?

Is the symptom perhaps indicating a problem elsewhere?

Thanks,

Greg.

2 REPLIES 2
KnarfB
Principal III

> our code receives the interrupt and handles it

By using HAL_MMC_RxCpltCallback or not?

Biohazard
Associate

Yes. We implement HAL_MMC_RxCpltCallback() which then calls our ReceiveComplete() which calls the HAL_MMC_Abort.