Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
1182 Discussions

How do I make the SD card IP core work?

Altera_Forum
Honored Contributor II
4,633 Views

Hi, 

 

I'm trying to use the new Altera UP SD card IP core on my DE2 board, but having some problems. 

 

Has anyone got it working yet? 

 

 

I've installed the University Program package (altera_upds_setup.exe) along with Quartus and Nios 9.0 on my PC. 

 

Then I created a SoPC with the new SD card IP core in it and wired them up. (Nios CPU, On-chip mem, SDRAM, PLL, JTAG UART, LED RED, Altera_UP_SD) 

 

Then in Nios, I run something similar to the code in the documentation. I can see the correct 390KHz clock output using an oscilloscope, but it never reports that my card is inserted. Can anyone help me? 

 

int main() { unsigned int *aux_status_register = ((unsigned int *)(ALTERA_UP_SD_BASE + 564)); unsigned int status; printf("Hello from Nios II!\n"); printf("Address of aux_status_register: 0x%08x\n", (unsigned int) aux_status_register); do { // wait for SD card to be inserted status = *aux_status_register; printf("%d %d\n", status, *aux_status_register); *LED_RED = status; // display status on the board } while ((status & 0x02) == 0); printf("SD card inserted.\n"); return 0; }
0 Kudos
18 Replies
Altera_Forum
Honored Contributor II
2,730 Views

What SD card IP core do you mean? I've not seen any such university IP core. 

 

The SD card example for DE1 and DE2 boards are just a couple PIO's for the SD's DAT, DAT3, CMD and CLK lines. 

 

I've made my own SD card core which is more efficient. It will wait for the CPU to send a command, and then wait for the SD's response and data if needed in hardware. 

 

It's a pretty simple module, I've attached all the needed files to this thread if you need it. 

 

Hope you like it.
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

 

--- Quote Start ---  

ftp://ftp.altera.com/up/pub/university_program_ip_cores/90/sd_card_interface_for_sopc_builder.pdf 

 

ftp://ftp.altera.com/up/pub/university_program_ip_cores/90/altera_up_avalon_sd_card_interface.zip 

--- Quote End ---  

 

 

Yep, this is the one I'm working on. 

 

I got a partial workaround for this issue. It appears that the core does not work with all SD cards. I tried a Lexar Media SD card 128MB initially, which didn't work. But my Apacer and Nokia branded SD card works. SDHC cards don't work. 

 

Now I'm trying to get it working with the DMA controller to speed it up. 

 

kwuaker, thanks for sending me your core. What transfer rate did you get from your core?
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

After a lot of trying I got the UP IP Finaly to work. But I have to say that it is a little bit Buggy and especially the Doku is bad. 

1. The HAL Driver doesn't check the Valid Bit of the Aux Reg.  

You have to implement your own checking Function, otherwise you get random errors depending on the speed of your System and the Card. 

2. HAL does not work on a NIOSII with Cache, because it access the Memory with Pointers instead of direct IOWR and IORD.  

3. It is very slow. I got 140kB with direct access. (But I still checking this).
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

Hi All, 

 

You can try it SD Card IP core from SLS ( www.slscorp.com )  

 

I think they will provide SD core for evaluation purpose. Using this you might be getting speed as per SD card specification mentioned. 

 

Regards, 

Hardik Sheht
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

HI Schaf, 

 

I am working on the same IP core for SD card and it doesn't work at all. Can you send your code to me. It will be a great help from you, my mail ID is todakar_vivek@yahoo.com 

 

Thanks, 

Vivek.
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

 

--- Quote Start ---  

Hi All, 

 

You can try it SD Card IP core from SLS ( www.slscorp.com )  

 

I think they will provide SD core for evaluation purpose. Using this you might be getting speed as per SD card specification mentioned. 

 

Regards, 

Hardik Sheht 

--- Quote End ---  

 

 

There's also another eval sd card reader ip core from El Camino: 

http://www.elcamino.de/prode.html
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

hey ppl, 

 

 

I am having problem with using this Ip core from university program,  

 

i m running the same program given in the altera document for the sd_card ip core, 

 

but it is not detecting the card, 

 

am i missing out on something crucial here? i m a beginner 

 

thanks,
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

Hi all! 

I am working on DE2-115 Board. My purpose now is load the file.sof from SD Card to FPGA chip.The result is display on Led.  

have anyone done it? 

i am very glad to get your support, 

Thanks all. 

if possible, pls send me information to my email pavenpham@gmail.com
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

 

--- Quote Start ---  

What SD card IP core do you mean? I've not seen any such university IP core. 

 

The SD card example for DE1 and DE2 boards are just a couple PIO's for the SD's DAT, DAT3, CMD and CLK lines. 

 

I've made my own SD card core which is more efficient. It will wait for the CPU to send a command, and then wait for the SD's response and data if needed in hardware. 

 

It's a pretty simple module, I've attached all the needed files to this thread if you need it. 

 

Hope you like it. 

--- Quote End ---  

 

 

Hi, is it posssible create a file with your module??
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

Hi, 

i used the university sd card ip core, its working fine but have problem when writing data, i tried to write text file greater than 32kb but its getting corrupted, if i go less than that size, ip core is working fine. how to solve this..
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

how to use this code.. can you help me.. tnx

0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

Hi! I'm using De1-Soc development board. It has micro SD card which connected to the HPS. Can I use Altera University Program SD Card IP cores for that board. Can any one tell me is there have any way to access Micro SD card from FPGA.

0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

Hi Kwuaker, 

 

Can i use sdcard file for detecting micro sdhc card?
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

Under university program Altera provides IP and Altera _up_sd is one of them.

0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

 

--- Quote Start ---  

What SD card IP core do you mean? I've not seen any such university IP core. 

 

The SD card example for DE1 and DE2 boards are just a couple PIO's for the SD's DAT, DAT3, CMD and CLK lines. 

 

I've made my own SD card core which is more efficient. It will wait for the CPU to send a command, and then wait for the SD's response and data if needed in hardware. 

 

It's a pretty simple module, I've attached all the needed files to this thread if you need it. 

 

Hope you like it. 

--- Quote End ---  

 

 

 

 

Thanks for providing the IP for SD card. can I use this IP to store data also. 

I have VEEK-MT one of the Altera board. It has camera module attached with the board. I just want to store the images captured. It will be helpful if you guide or provide some documents.
0 Kudos
Altera_Forum
Honored Contributor II
2,730 Views

HAL does not work on a NIOSII with Cache, because it access the Memory with Pointers instead of direct IOWR and IORD.

0 Kudos
Reply