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++
12627 Discussions

SD card ip core: read block error with SDHC

Altera_Forum
Honored Contributor II
1,358 Views

Hello all, my Project is as below: 

 

IP CORE SD CONTROLLER with SPI mode, 

work with 2G SD card but not with card >= 4G; 

 

The initialisation flow is all good, no problem. 

 

The problem is: 

With a card HC(4G), when I tell it to read a block beginning at 40 00 00h, it reads at 80 00 00 00h (512 times bigger); 

but with a card non HC(2G), there is no such problem. 

 

the API using is "sd_read_data_block( sd_card_info_struct* sd_card, char* data_buffer, alt_u32 read_address )

 

Can someone help me with this? It drives me crazy:cry: 

 

THX very much!
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
641 Views

Problem solved, the difference between the addr of sdhc and sdsc is 9bits (512 times), because sdhc requires more space for the addr. 

so before reading a block, we should determine either it is hc or sc.
0 Kudos
Altera_Forum
Honored Contributor II
641 Views

Hi lylli007, 

I am having trouble when trying to read or writing data to a SanDisk Ultra 2GB class4 which is also an SDHC. Can you explain how you solve the addressing issue? 

Thanks.
0 Kudos
Altera_Forum
Honored Contributor II
641 Views

Hi Lyllie007 

Did you use the Altera University Program IP Core?
0 Kudos
Altera_Forum
Honored Contributor II
641 Views

Hello lylli. 

 

Can i get the source for detecting the SDHC card. University IP will detect only 2GB cards..I have struck from 1 month .It will be a great help.
0 Kudos
Reply