Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

SD card ip core: read block error with SDHC

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!

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.