Here's some more info for you, from the datasheet:

In the case of a Standard Capacity Memory Card, a data block can be as
big as one card write block
and as small as a single byte. Partial block read/write operations are
enabled by card options specified
in the CSD register.
In the case of a High Capacity SD Memory Card, the size of data block
is fixed to 512 bytes. The block
length set by CMD16 is only used for CMD42 and not used for memory
data transfer. So, partial block
read/write operations are also disabled. Furthermore, Write Protected
commands (CMD28, CMD29 and
CMD30) are not supported.

Set Block Length
When memory read and write commands are used in block address mode,
512-byte fixed
block length is used regardless of the block length set by CMD16. The
setting of the block
length does not affect the memory access commands. CMD42 is not
classified as a memory
access command. The data block size shall be specified by CMD16 and
the block length can
be set up to 512 bytes. Setting block length larger than 512 bytes
sets the
BLOCK_LEN_ERROR error bit regardless of the card capacity.

>From my lib:
address = address * 512 -- make sd card sector addressable, sd cards
are normally byte addressable.

My comment is not completely true. SD Cards ARE normally byte
addressable, but for fat32 and PC's, there is never a need to start in
the middle of a 512 byte chunk and end in the middle of the next.

For example, you could start a read at byte 256 of the sd card, and
end at byte 512 + 256 (which is 512 bytes read total)

FAT32 and PC's assume the first sector starts at byte 0 and the next
sector is at byte 512

My conclusion:
You can start reading or writing a block from anywhere, but have to
read/write an entire block, default block size is 512 (one sector).
I'm not sure if there's another way to read/write other then block
mode. We could improve the library by looking into this or to set a
block size of 1 byte and add a constant for the user.

512 should stay default, byte reads/writes may not work at all on high
capacity SD memory cards. I don't think I tried any high capacity
cards yet with this lib.

Filesystems usually assume sectors are 512 bytes. From what I
understand, hard disks always use 512 byte sectors. Hard disks have a
read/write buffer that is 512 bytes.

I would have to ask the user: why not just use 23k256 instead of sd
card for byte reads/writes?

What are your thoughts on this?

Matt.

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to