Addressing in an SD Standard capacity card

This conference allows discussion on any subject not already covered in another PICmicro conference. If a topic becomes popular enough, a new conference will be created for it.

Addressing in an SD Standard capacity card

Postby Joseph Watson » Mon Jan 04, 2016 11:02 pm

I am about to write PIC18 assembly language code that accesses an SD card of standard capacity (that is, up to 2 gigabytes) using SPI. It is a version 2 card. The card is not formatted with a FAT system so I will be using RAW mode.

I have already dabbled with writing and reading a little data on this type of card but I want to expand on the theme and I am wanting everything to make sense before I plow into it all big time.

One of the commands available is the CMD17 command which reads the contents of a single 512-byte block. The CMD17 command includes a 32-bit field of information that specifies the start address for the block being read. Since this is a standard capacity card (not a High Capacity card), the address field is specified as a byte address, not a block address.

An unsigned 32-bit number can vary from 0 to 4,294,967,295. That is, it can address 4 billion addresses.

I rather expected that since standard capacity cards are limited to 2 gigabytes in capacity, the highest address that could be expressed in 32 bits would have been 2,147,483,647 but, as you can see, the address field can address twice that number of bytes. Is it true that the most significant bit of a CMD17 command's 32-bit address field is always zero or have I missed something in the specs? Are there portions of the address space where the card does not address the storage medium inside the card (implying that I would need to skip those portions)?
NCR once refused to hire me because I was too short. I'm still waiting on my growth spurt.
User avatar
Joseph Watson
 
Posts: 49
Joined: Sat May 31, 2014 8:06 pm
Location: Ohio, USA
PIC experience: Experienced Hobbyist

Re: Addressing in an SD Standard capacity card

Postby jtemples » Fri Jan 08, 2016 8:12 pm

I believe there are 4GB standard SD cards, but they do not comply with the spec. All 4GB and greater cards are supposed to be HC.
jtemples
Verified identity
 
Posts: 195
Joined: Sun May 25, 2014 2:23 am
Location: The 805
PIC experience: Professional 5+ years with MCHP products

Re: Addressing in an SD Standard capacity card

Postby Joseph Watson » Sat Jan 09, 2016 3:16 am

jtemples,

I think you have introduced a good clue there. When I went looking for such a thing as a 4GB SD card that was not SDHC, I found this one for starters:

http://www.newegg.com/Product/Product.a ... 12K0EZ8257

So I guess the architecture of SDSC really can address 4 billion bytes. They just normally don't because the standard says that they should not.

Thanks
NCR once refused to hire me because I was too short. I'm still waiting on my growth spurt.
User avatar
Joseph Watson
 
Posts: 49
Joined: Sat May 31, 2014 8:06 pm
Location: Ohio, USA
PIC experience: Experienced Hobbyist

Re: Addressing in an SD Standard capacity card

Postby jtemples » Sat Jan 09, 2016 3:02 pm

Yes, that's the kind of card I was remembering. I don't believe those kinds of cards do anything special or unusual, they just don't comply with the spec. In fact, the Sandisk spec specifically points out that the maximum size that can be encoded in the CSD register is 4 GB. I don't think it was until the HC spec was released that a 4GB standard card was considered out of spec.
jtemples
Verified identity
 
Posts: 195
Joined: Sun May 25, 2014 2:23 am
Location: The 805
PIC experience: Professional 5+ years with MCHP products

Re: Addressing in an SD Standard capacity card

Postby ric » Tue Jan 12, 2016 1:05 am

It's probably to avoid those pesky negative numbers you get when you go over 2GB, and have been too lazy to declare your variables as unsigned. ;)
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products


Return to Other PICmicro topics

Who is online

Users browsing this forum: No registered users and 7 guests

cron