Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20693 Discussions

SD card controller in vhdl

Altera_Forum
Honored Contributor II
2,339 Views

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
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
977 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
977 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
977 Views

Hey StefanLevie, 

 

Thanks for your reply. may i know where i can get the SPI core with SD card? Are those codes in vhdl?
0 Kudos
Altera_Forum
Honored Contributor II
977 Views

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

0 Kudos
Altera_Forum
Honored Contributor II
977 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
977 Views

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
0 Kudos
Reply