Skip to main content
seawwh
Associate II
February 9, 2009
Question

I can not use SDIO in 4bit Bus DMA mode

  • February 9, 2009
  • 11 replies
  • 1999 views
Posted on February 09, 2009 at 10:27

I can not use SDIO in 4bit Bus DMA mode

    This topic has been closed for replies.

    11 replies

    seawwh
    seawwhAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:59

    my test environment:

    STM3210E, 4G SD card , SDIO 4bits bus, DMA mode

    The Results are :

    1. R/W 512M SD card is ok.

    2. R/W 4G SD card is deadlock, at

    while (DMA_GetFlagStatus(DMA2_FLAG_TC4) == RESET);

    3. Change Bus to 1bit , R/W 4G SD card is Ok

    any one have passed R/W SDHC card by SDIO in DMA 4bits mode ?

    jj_it
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:59

    @relaxe-

    Good info (as usual) - thank you. Would you be so good as to tell us make/model of 4GB which worked? (we've found some brands ''buggy'' - could be us, though) Thanks...

    relaxe
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:59

    What version of the library do you use?

    Are you using the plain example from the SDIO folder?

    I currently play around with various SD and SDHC from 15mb to 4GB and everything works great.....

    Are you using the dev board, or do you have a voltage-translating buffer?

    Have you tried to apply power to the card (and wait), then remove-re-insert the card, then execute code? Solved some weird card initiation bugs...

    jj_it
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:59

    Don't have an exact answer/guidance - sorry.

    Believe that any SD card - 4GB & up - uses SD-HC. The HC requires a slightly different treatment. Seem to recall that STOne-32 posted a solution enabling SD-HC within the past 60 days. Good luck...

    jj_it
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:59

    @relaxe-

    Great - thank you. Lowest cost Micro SD 2GB we've found is PNY 11.88 USD Q 1. Trying to make quantity purchase for this forum - (like pulling teeth - glad some firm has money - PNY shows little interest in sales)

    relaxe
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:59

    Yeah sure!

    From lower to higher capacity:

    MicroSD 128MB, unknow brand came with STM3210E-EVAL: SMS128FFE5

    SD 2GB Kingston: MMAGF02GWWCA-NA , FB4L0000 804

    MicroSDHC 4GB Sandisk: No numbers, came in a bundle with a SD adapter

    SDHC 4GB Ultra: G04GNM26B0040

    SDHC 16GB Patriot: PSF16GSDHC6-PC

    .. I =THINK= (not sure) that I managed to get a A-Data/MyFlash SD 4GB working too. I know there are provision for those non-sdhc 4gb cards in the SDIO application exemple but I need 16GB and more anyway, so I don't bother.

    -Relaxe

    relaxe
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:59

    My guess is that you have a 4GB ''SD'' card, and not a 4GB ''SDHC'' card.

    I don't want to sound like a dick, but: Ditch the card, and get a new SDHC one. 4GB SD card are not ''SD Compliant'' by nature.

    Do you have the same problems with other cards? Is it a ''SDIO port'' problem, or ''Some specific card'' problem?

    What I used to read/write to SDcards is the same exact code than you.

    If you are able to just open the project file, and run it on the board, then you do the same exact thing as me.

    seawwh
    seawwhAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:59

    hi relaxe,

    Test environment:

    Hardware:

    EK-STM3210E MicroSD 4G Kinstone Mark:0850 K87866Y

    Test Code:

    um0427_Firmware library\FWLib\examples\SDIO

    sdcard.c V2.0.3 09/22/2008 MCD Application Team

    library:

    * File Name : stm32f10x_sdio.c

    * Author : MCD Application Team

    * Version : V2.0.3

    * Date : 09/22/2008

    Power: By USB Port Of PC;

    1. I can read or write 4G SD card with 1bits bus mode. it means power is ok.

    2. I use PC to read/Write this 4G SD card ,no any problem.

    3. Can you run your test code with 4bits bus mode or 4bits bus+DMA mode?

    4. would you show me your test code ?

    Thanks

    relaxe
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:00

    Hi there!

    Nope, my SDIO_DosFS_V02.zip does not have multi-block read/write, only multiple single blocks, as the DosFS library does not discriminate 1 or multi block in line. I am however working on a third version that may include that, as I need more speed for my projects.

    The Read/Write (single) code actually start a DMA transfer, then wait for the TX/RX_Empty flag from the DMA, in a blocking function.

    Maybe the read/write multi actually works in a similar way, but without the last ''wait''? Instead of a delay, if you looked at the DMA empty flags?

    -Relaxe

    seawwh
    seawwhAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:00

    I tested STM32 SDIO for several days and

    found the following appearance:

    1. while (1) {

    SD_ReadBlock();

    SD_ReadBlock();

    }

    Test Passed

    2. while (1) {

    SD_ReadMultiBlocks();

    SD_ReadMultiBlocks();

    }

    Test Passed

    3. while (1) {

    SD_WriteBlock();

    SD_ReadMultiBlocks();

    }

    Test Error: SD_START_BIT_ERR

    4. while (1) {

    SD_WriteBlock();

    Delay_ms(1000);

    SD_ReadMultiBlocks();

    }

    Test Ok:

    SD Card : KingSton 2G.

    SDIO Mode: DMA+4bitsBus

    I have read the relaxe's code ''SDIO_DosFS_V02.zip''. but not found any SD_ReadMultiBlocks/SD_WriteMultiBlocks in it.

    who can give me some helps about SD_ReadMultiBlocks/SD_WriteMultiBlocks Operation in 4bitBus+DMA mode ?

    Thanks a lot.