Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12435 Discussions

How to initialize SD-Card with SPI Command?

Altera_Forum
Honored Contributor II
821 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
97 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 :)
Reply