Posted on January 26, 2013 at 01:26Somehow 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