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
that someone used double buffering when using SDIO concurrently with USB.

Is that the solution to my problem?