Showing results for 
Search instead for 
Did you mean: 
Honored Contributor I

How to initialize SD-Card with SPI Command?

Hi, I implemented the Altera SPI Core in my SoPC. Altera provides one access routine "alt_avalon_spi_command()". How exactly can I implement the typical SD-Card Initialization in my Code? 

Altera SPI Core: Chapter 8-8 


I thought the process of initialization is: 


1. set cs = low 

2. send cmd0 to slave 

3. wait for response 


How can I use the access routie of Altera in Eclipse. Please give an advice. I am stuck on this problem.
0 Kudos
1 Reply
Honored Contributor I

I was able to solve the problem. But now, when I try to read the MBR. I am only able to read the first 4-5 bytes of MBR. The other bytes are all 0xff. 

Could it be due to the speed of the SPI? The SPI speed is 200 KHz. I don't change the speed value at any time. I know that 400 KHz is max speed when initializing the SD Card. After initializing the SD Card, the SPI speed can be set (up to 25 MHz i guess) 


I don't know what else I can try to solve this problem. I would appreciate your help :)