cancel
Showing results for 
Search instead for 
Did you mean: 

DMA to SDIO NDTR Problem

picguy2
Associate II
Posted on January 23, 2013 at 18:22

Somehow I can not reply to https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA%20to%20SPI%20NDTR%20Problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&c...

I have much the same problem as wilczewski.jeffrey.  I see it on my F4 Discovery board.  If his problem is the same then it�s the DMA2_S3CR_bit.EN = 1; line that makes the problem.  I have single stepped through my SD card assembly code and watched NDTR go from 0x0080 to 0xFFFF when setting EN=1.

With NDTR set incorrectly the DMA completion interrupt never happens.  Always I see 0xFF7F words remaining until DMA completion.  At least the data transfer part of DMA works.

I�ve tried several ways to set EN=1.  All useful ways cause the NDTR change including following the sample F4 Discovery code which uses bit band addressing to set EN=1.  (Using the debugger and playing around with the enable flag I was able to set things such that EN=1 and NDTR=0x0080.)

I tried the idea from van_hooft.frank.001.  Changing the flow controller did not work.  FWIW, sample F4 Discovery code sets the peripheral as flow controller.  

#dma-sdio-ndtr-problem
1 REPLY 1
dohzer
Associate II
Posted on November 22, 2014 at 07:06

I hope you figured this out, but I believe this is normal behaviour.

From what I can gather from section ''10.3.15 Flow Controller'' of the reference manual, the DMA's NDTR register does not determine when the transfer is complete.

Since the SDIO is the flow controller, the SDIO module signals to the DMA when the transfer is complete, so the NDTR doesn't really matter.