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)?