Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] SD Card Interface to FPGA

Status
Not open for further replies.

am85

Member level 2
Joined
May 30, 2011
Messages
46
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Germany
Activity points
1,661
Hi,
I am trying to implement an SD memory interface to be able to write the data, coming from an ADC to the FPGA, to an SD card. The data rate is 4 MB/s. Would SPI be sufficient to achieve this data rate or should I use the 4-bit SD interface. I am using Microblaze to handle the interface, so do i need to use and External Memory Controller core as well, and does it handle everything or do i still need to implement an algorithm.
I appreciate any help.
Thanks in advance.
 

A typical maximum clock speed number auf regular SD cards is e.g. 25 MHz, which means, that 4 MB/s can be only written in 4-Bit SD mode. Newer extra fast cards support clock speeds around 100 MHz and should be able to achieve the intended speed also in SPI mode. The speed capabilities of a specific card can be read from CSD register.

Data rates are primarly burst transmission rates, to reach it in sustained write, additional requirements have to be met, particularly writing full physical memory blocks by multi-sector write commands. I don't know however, if the existing Microblaze SD card driver will support optimized multi-sector writes.
 
  • Like
Reactions: am85

    am85

    Points: 2
    Helpful Answer Positive Rating
New SDHC or SDXC cards can achieve up to 45 MB/s write speed, but i was thinking maybe SPI wouldn't achieve such high rates.
I have checked several memory controllers in EDK and I found SDRAM and NOR flash but i didn't find controller mentioning SD memories, so do you know if these controllers such as AXI EMC or MPMC in EDK could be used. If i need to write the algorithm for writing to the memory myself, how complicated is it ?
thanks a lot for your help.
 

I expect the same clock speed offered in SD mode also available for SPI.

The memory controller is embedded in the SD card. You can access the storage using logical sectors similar to a hard disk drive. Apart from managing the SD card specific communication protocol, you mainly need to implement a FAT32 file system. To store raw data, you can possibly avoid the FAT implementation, either write raw data blocks that are read on the PC side by low level device commands, or use one or more preformatted files as placeholder.
 
  • Like
Reactions: am85

    am85

    Points: 2
    Helpful Answer Positive Rating
I just need to store all the digital values coming from an ADC on the SD card, then i want to read these values on the PC. Do u know any reference document that could help me write data blocks to the SD card?

Thanks
 

about 45 megabytes per second - a bold statement. I would write 160 000 megabytes per hour, which is not the same thing.
 

The present discussion is primarly targetting to SPI clock speed needed for moderate data rates of 4MB/s. The said 45 MB/s (you'll even find 90 MB/s mentioned for some products) are however burst rates. "Sustained" (continuous) write rates are another thing. I don't find sustained write rate specifications for the said high speed SD cards, which suggests to me, that they are not so mind blowing...
 

Yeah true the sustained speed might be lower than the mentioned speed, but for some products it is mentioned that the sustained write speed is at least 10 MB/s which is more than enough for my application.
Thank you very much for your help.
 

10 MB/s sustained write rated sounds good. As mentioned before, thinking about reasonable block sizes is most likely necessary to achieve it. See below two Sandisk application notes related to optimal card host behaviour. The CF application note has very impressive examples about speed variation with write block size, which should apply to SD cards as well, because they are mainly caused by the properties of the memory chips, that are standard NAND flash for both card types.
 

Attachments

  • AppNoteCFHostv1.1.pdf
    254.3 KB · Views: 159
  • AppNoteMMC_SDv1.0.pdf
    243.6 KB · Views: 193
That's a very helpful application note. Again, thank you so much. I will try to implement the VHDL code for the write process, and since it's my first time to do so, most probably I will be back here for help : )
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top