Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,060 Views

SD Card Core IP with Nios II - SD Card Detect Issue

Hello, 

 

I am having a problem getting my SD card to be detected using the core IP provided by Altera's University Program. I'm using the Nios II processor with Quartus 13.1 and Nios 13.1 Eclipse. In my Nios II code, I have programmed different LEDs to flash when the SD card is detected or not. 

 

Do any of you know if the DAT3 line is used to detect the SD card? If so, that means we have to have a pull-up resistor (mine is 10k ohms) in order to use that data line as a way to detect the SD card, right? Please help me out!  

 

Thank you!
Tags (1)
0 Kudos
4 Replies
Altera_Forum
Honored Contributor I
41 Views

Or better yet, can someone explain what this code is saying...? This is the C code in the HAL src folder 

 

bool alt_up_sd_card_is_Present(void) 

// Check if there is an SD Card insterted into the SD Card socket. 

bool result = false; 

 

if ((device_pointer != NULL) && ((IORD_16DIRECT(aux_status_register,0) & 0x02) != 0)) 

result = true; 

else if (initialized == true) 

int index; 

 

initialized = false; 

search_data.valid = false; 

is_sd_card_formated_as_FAT16 = false; 

 

for(index = 0; index < MAX_FILES_OPENED; index++) 

active_files[index].in_use = false; 

active_files[index].modified = false; 

return result; 

 

 

Thanks!
Altera_Forum
Honored Contributor I
41 Views

The code checks the second bit of the auxiliary status register - the 'card detect' bit (you can check this in the IP core's VHDL file) - and returns true if there is a card inserted. You can check this in the debugger. From what I've read here, certain types of SD card don't work with this IP core though (more recent generations, ie SDHC type), so you might want to try a different card or IP core. 

 

-N
Altera_Forum
Honored Contributor I
41 Views

only micro sd card works 2gb, other than this sd card ip will not work for sdhc type.if anyone knows how to make ip work for sdhc card.

Altera_Forum
Honored Contributor I
41 Views

I have try to partition my 16 gb sdhc type of sd card to 2gb size but my c code still stuck at can't detect card state. 

Anyone have the solution for this?
Reply