cancel
Showing results for 
Search instead for 
Did you mean: 

Under what circumstances could "__HAL_MMC_DMA_ENABLE(hmmc)" have a direct effect on NDTR value?

michael.kitz
Associate II

I observe issues with DMA transfer in a STM32F7.

the read from eMMC fails occasionally with a timeout. aborting transfer and DMA and trying again does not change this - if the timeout happened once, it happense almost with 100% again - if I do not use breakpoint in the right places.

Stepping through the ST library code I found that the NDT register is correctly set to 128 bytes (0x0080) but jumps to 0xFFFF immediately when stepping over _HAL_MMC_DMA_ENABLE(hmmc). putting the breakpoint after the call to HAL_MMC_ReadBlocks_DMA(..) shows that NDTR is sometimes 0xFFFF and sometimes 0xFF7F- In both cases the read command returned success. But continuing transfer of data will only be successful if the register showed 0xFF7F not if it showed 0xFFFF.

How could this happen?

I tried changing the value manually from 0XFFFF to 0xFF7F by a sequence of disable DMA, value change, enable DMA; but as soon as I continued the code, the register value changed back to 0xFFFF.

Could this be a side effect of another ressource using another DMA channel at the same time? Will a disable/enable have this effect? Is this a state arrising from a certain condition?

0 REPLIES 0