This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SD Card Read "0x08-Out of range" Data Response Error

Other Parts Discussed in Thread: MSP430F5438A

I am interfacing 8GB SDHC Card with MSP430F5438A through SPI. I have implemented basic function to Init SD Card, Read a sector, write a sector and also succesfully tested on initial sectors.

But Problem is when I try to read higher sectors, it gives me 0x08 Data Error Response which is Out of range. I have tried to read sector number 32768(0x8000) and got this error. after that I tried to read sectors from 0 to last and get error first time at sector 0x7670 and after that i always get Out of range error. My SD Card is of 8 GB, so number of available sectors is more than 32768 sectors.

As per CSD Register ver 2.0, available bytes are 0x1D9C00000 and for 512 bytes long sector, total no of sectors = 0xECE000.

So What is the reason behind getting out of range error?

and how to fix this problem?

If anyone have faced this issue or have knowledge about it, please help.

Thanks,
Amit Bhorania 

  • There's a significant difference between MMC-compatible SD cards (<4GB) and XD cards (>1GB). While on the old standard, the address is given as a linear byte address, the XD card takes the sector address.

    Now 0x7670 * 0x200 is exactly 0xECE000. That means, your read function sends the linear address of the first byte to the SD card instead of the sector number. Which is correct for SD/MMC cards but no longer for XD cards.
    Your read attempts are skipping 511 of 512 sectors, reaching the end of the memory by a factor of 512 sooner than expected.

    p.s.: SD cards between 1 and 4GB that are no XD cards will have 1k or 2k sectors, as the old CSD structure allows only for 0x200000 sectors. So for >1GB the sector size has to increade from 512 to 1024 or 2048 until the next limiting factor is the 32 bit address range that is parameter to the read/write commands.

  • Thanks Jens-Michael Gross for your help.

    My Error is solved.

    Thanks,
    Amit Bhorania 

**Attention** This is a public forum