Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

SD card controller in vhdl

Hey everyone!

I'm currently trying to develop a sdcard controller in vhdl to just read data off the sd card using spi transmission. The board im using is DE1 educational board. I have been trying to get my sd card into spi mode for months but cant seems to get it to work. Is there any1 out there who has experience coding the sd controller in vhdl? i would like to seek some advice and help.

When im trying to change my sd card from sd bus mode into spi mode can i straight declare my controller as an spi master and send data using data spi protocol?

YangZ86

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hey everyone,

    Found out that it there is not much difference with the port assignment for sd bus mode and spi. However i have a new question. Hope some one will help me out :). In spi mode for sd card protocol, is it possible to shift data and read data at the rising edge of the SCK? I have studied spi master module and i find out that data usually is sampled at the rising edge and shifted at the falling edge for CPOL =0 and CPHA =0. But i just wanted to know if i were to sample and shift at rising_edge for sd card spi protocol will that cause me a problem when sending and receiving data?

    Regards,

    Yangz86
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    We've successfully used Altera's standard SPI Core with SD Cards.

    There are open source file system libraries that do the necessary SD card accesses.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hey StefanLevie,

    Thanks for your reply. may i know where i can get the SPI core with SD card? Are those codes in vhdl?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    SPI is a standard component provided by Altera within SOPC Builder under Interface Protocols -> Serial

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Stefan,

    Where can I find the File System 'open source'? I need to OPEN and READ binary files from an SD card on my NEEK.

    Thanks!

    Mike
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Stefan, how did you make the clock phase and clock polarity of the spi master? I am trying to initialize the SD card but I could not achieve. The card does not respond me. Have you a NIOS code for this applicaiton?

    Thanks

    Best Regards