Skip to main content
Biohazard
Associate II
December 16, 2020
Question

Correct way to end DMA

  • December 16, 2020
  • 2 replies
  • 929 views

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.

This topic has been closed for replies.

2 replies

KnarfB
Super User
December 16, 2020

> our code receives the interrupt and handles it

By using HAL_MMC_RxCpltCallback or not?

Biohazard
BiohazardAuthor
Associate II
December 16, 2020

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