• AVR Freaks

SD Card with SDIO

Author
conprove
New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2009/03/30 12:00:08
  • Location: Brazil
  • Status: offline
2010/11/08 11:23:38 (permalink)
0

SD Card with SDIO

Hi all!
 
    I´m implementing a PIC32 hardware using a SDCard to store data. In SPI mode everything works fine, with SD, SDHC, reading, writing. But the speed of writing data on SD is too slow. With maximum optimizations I got 150KBytes/seg. Using the same SD Card on computer I got 5-6MByte/seg (20x faster).
 
    Reading many articles on internet I´ve found some comparatives tests and the results is always the same: in SPI mode maximum speed is 150-180KByte/seg. Using the SDIO protocol with 4 lines of data the transfer rate increase to near the nominal (5MByte/seg).
 
    The question is: does anybody has implemented a code to interface a pic32 to SDcard using SDIO protocol? What is the transfer rate?
 
    I´m sure that is note a single problem and lots of people are asking the same in others posts.
 
Thanks.
 
Cristiano
 
    
 
    
    

Cristiano Moreira Martins
R&D Engineer
Conprove Ind & Comercio Ltda
#1

9 Replies Related Threads

    bkamen
    Super Member
    • Total Posts : 822
    • Reward points : 0
    • Joined: 2010/01/26 12:39:27
    • Location: Central Illinois, USA
    • Status: offline
    Re:SD Card with SDIO 2010/11/08 11:31:34 (permalink)
    0
    Keep in mind your PIC is writing at 1bit/transfer speeds where as your PC is probably using both a higher clock rate (you can do this too provided the PIC supports it) AND the wider bus-width of 4bits. (Is sounds like you've already read the legal print with using the 4bit width, right?)

    The 1wire (SPI) mode is pretty much public domain whereas using the higher bandwidths (via 4bits) -- is proprietary requiring NDA's and fee's and such so that serious companies sign up and get the specs after sending in their check.

    So I'm SURE someone here has written the code to do it... but they can't give it to you... they might not even be able to sell it to you (depending on the reasons they wrote it).


    Cheers,

     -Ben


    #2
    threedog
    Super Member
    • Total Posts : 998
    • Reward points : 0
    • Joined: 2009/12/04 12:28:11
    • Location: Boise
    • Status: offline
    Re:SD Card with SDIO 2010/11/08 11:38:19 (permalink)
    0
    Did you use DMA?
    The 4 bit mode may even be slower because one cannot use a DMA peripheral.
    #3
    conprove
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2009/03/30 12:00:08
    • Location: Brazil
    • Status: offline
    Re:SD Card with SDIO 2010/11/08 12:04:10 (permalink)
    0
    Thanks for reply!
     
         I understand that there is differences between my computar clock and PIC, etc. The real problem is after I write a sector (512 bytes) PIC must to wait for a SDCard response to write data in a new sector. The SDCard takes lots of time for a write completion on SPI mode. Something like:
     
    -> less than 100us to write 512 byte of data (a sector)
    -> more than 5ms to write completion answer.
     
        I tried 2 differents SDCard: first is 1GB generic SDCard (has no trademark printed) and second is a 4GB kingston. On both cards i got the same behavior.
     
        After I send data to SDCard on spi mode the internal controller of SDCard takes lots of time to answer, in other words, pic has nothing to do until wait for the answer before write new data (considering my only task is write on sdcard).
     
       Afterall, thanks again for your fast reply and I´ll contact sdcard.org and get more informations.
     
    Cristiano
     

    Cristiano Moreira Martins
    R&D Engineer
    Conprove Ind & Comercio Ltda
    #4
    conprove
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2009/03/30 12:00:08
    • Location: Brazil
    • Status: offline
    Re:SD Card with SDIO 2010/11/08 12:10:32 (permalink)
    0
    Just a correction on times:

    -> less than 300us to write a sector (20MHZ spi)
    -> more than 5ms to receive the SDCard answer about write completion

    Cristiano
    #5
    tahi
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2009/10/01 21:53:33
    • Location: 0
    • Status: offline
    Re:SD Card with SDIO 2010/11/08 20:53:51 (permalink)
    0
    Hi Cristiano

    How to determine tranfer rate? Did you base on SPI rate?
    So, increase transfer rate you should attempt:
    - Increase SPI rate
    - Redesign PCB, shorter trace, source...etc
    - SD card type and capacity


    #6
    conprove
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2009/03/30 12:00:08
    • Location: Brazil
    • Status: offline
    Re:SD Card with SDIO 2010/11/09 03:10:37 (permalink)
    0
    tahi,

        I used spi in 20MHz, DMA to fast transfer the sector of 512 bytes. This way 

       ( 512 * 8 ) / 20MHz = 204,8us to transfer data from PIC to SDCard. Of course there a little more time to send commands, checksum (dummie), etc.

        The biggest problem is once the PIC send all block data and commands to SDCard,  the controller on front end of sdcard must to response that, sending the information of data correctly write on memory. SDCard spend so much time to give this answer. I don´t know why yet, but it´s look like a limitation on SDCard. 

        I´ll try another king of memories once that I need fast saving with large amount of data. To improve speed on SDCard I must to use the SDIO protocol (proprietary) and become a member and its look a little expensive for now.  Suggestions?
    #7
    rmteo
    Super Member
    • Total Posts : 1007
    • Reward points : 0
    • Joined: 2007/05/02 20:33:25
    • Location: Colorado, USA
    • Status: offline
    Re:SD Card with SDIO 2010/11/09 08:27:02 (permalink)
    0
    conprove ....I´ll try another king of memories once that I need fast saving with large amount of data. To improve speed on SDCard I must to use the SDIO protocol (proprietary) and become a member and its look a little expensive for now.  Suggestions?

    I would use an MCU that has a true (hardware) SDIO interface such as an STM32F103VET6.

    SDIO main features

    The SD/SDIO MMC card host interface (SDIO) provides an interface between the AHB
    peripheral bus and MultiMediaCards (MMCs), SD memory cards, SDIO cards and CE-ATA
    devices.
    The MultiMediaCard system specifications are available through the MultiMediaCard
    Association website at www.mmca.org, published by the MMCA technical committee.
    SD memory card and SD I/O card system specifications are available through the SD card
    Association website at www.sdcard.org.
    CE-ATA system specifications are available through the CE-ATA workgroup website at
    www.ce-ata.org.
    The SDIO features include the following:
    ● Full compliance with MultiMediaCard System Specification Version 4.2. Card support
    for three different databus modes: 1-bit (default), 4-bit and 8-bit
    ● Full compatibility with previous versions of MultiMediaCards (forward compatibility)
    ● Full compliance with SD Memory Card Specifications Version 2.0
    ● Full compliance with SD I/O Card Specification Version 2.0: card support for two
    different databus modes: 1-bit (default) and 4-bit
    ● Full support of the CE-ATA features (full compliance with CE-ATA digital protocol
    Rev1.1)
    ● Data transfer up to 48 MHz for the 8 bit mode
    ● Data and command output enable signals to control external bidirectional drivers.
    Note: 1 The SDIO does not have an SPI-compatible communication mode.
    2 The SD memory card protocol is a superset of the MultiMediaCard protocol as defined in the
    MultiMediaCard system specification V2.11. Several commands required for SD memory
    devices are not supported by either SD I/O-only cards or the I/O portion of combo cards.
    Some of these commands have no use in SD I/O devices, such as erase commands, and
    thus are not supported in the SDIO. In addition, several commands are different between SD
    memory cards and SD I/O cards and thus are not supported in the SDIO. For details refer to
    SD I/O card Specification Version 1.0. CE-ATA is supported over the MMC electrical
    interface using a protocol that utilizes the existing MMC access primitives. The interface
    electrical and signaling definition is as defined in the MMC reference.


    #8
    drjames
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2011/01/05 12:38:54
    • Location: Nevada, Washington, California, Bahamas
    • Status: offline
    Re:SD Card with SDIO 2011/01/05 12:50:10 (permalink)
    0
    Have you found a PIC stack for SDIO implementations?  I, too am embarking on this task and looking for an SD Host Controller implementation for the PIC.

    Dr. James
    #9
    rkrishnan7
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2011/06/27 21:22:29
    • Location: USA
    • Status: offline
    Re:SD Card with SDIO 2012/03/13 06:47:48 (permalink)
    0
    Same here!
    The important thing here is the time it takes for the SD Card to "be ready" for the next block of data after it has initiated an internal write of previously transferred blocks.
    All of the suggestions (DMA etc., ) talk of increasing the SPI transfer speed - however, my experience has been that every few blocks, the card will stay busy for several milliseconds while it completes the write op.
    Sure, multi-sector writes and caching the data in a rotary buffer will help, but in the RISC embedded world you are limited by Ram size and at some point it catches up!

    So, the short question(s) are:
    1. Has anybody implemented the Simplified SDIO (now available free from:
    https://www.sdcard.org/downloads/pls/simplified_specs/Part_E1_SDIO_Simplified_Specifcation_Ver3.00_20110225.pdf )
    2. That may still not solve the problem! - It may speed up the parallel transfer, but how about the internal delay. When using a PC , the driver may be using up gobs of PC memory to cache the write - hence the perceived throughput ?

    RK

    #10
    Jump to:
    © 2019 APG vNext Commercial Version 4.5