Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

How to initialize SD-Card with SPI Command?

Altera_Forum
Honored Contributor II
1,004 Views

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: http://www.altera.com/literature/ug/ug_embedded_ip.pdf 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
Altera_Forum
Honored Contributor II
280 Views

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