AnsweredAssumed Answered

Problem with STM32F401 OTG FS MSC using SDIO uSD card

Question asked by harrison.david on May 26, 2015
Latest reply on May 28, 2015 by hwasti

Hi, all. I have an STM32F401Discovery Kit using an STM32F401VCT6.
I have wired an external SD card connector and have successfully implemented Elm-Chan's FATFs using the SDIO SD card interface. All works well, I can mount the card, and read files.

I have also successfully implemented a generic two way USB OTG_FS HID with IN and OUT Endpoints to transfer raw data buffers of 64 bytes both ways. So far so good.

The problem comes when I try the MSC class (taken from ST's MSC class library).
When the SCSI STORAGE_Read function calls SDReadMultiBlocks followed by SDWaitReadOperation(), SDWaitReadOperation() never returns - it blocks.

After putting in many printf statements it turns out that the SDIO DMA2_Stream3_IRQHandler is never fired, thus the DMAEndOfTransfer flasg is not set which is why SDWaitReadOperation() blocks. I am using Clive's SDReadMultiBlocksFIXED function to properly handle LBA addresses.

So my question is - why does the SDIO DMA read operation work by itself when called from FATFs, but not when called from the USB MSC Class?

I have read elsewhere in this forum
(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%5fmx%5fstm32%2fInprove%20the%20speed%20of%20the%20Mass%20storage%20%20as%20u%20disk&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=2050)
that someone used double buffering when using SDIO concurrently with USB.

Is that the solution to my problem?


Outcomes