Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: A little help with SD cards . . . ?

2006-04-26 by kernels_nz

Hi Jesper,

Thanks for that, it was as I understood it from the datasheets, just
wanted to double check with someone more familiar. Just one more
thing, am I then correct in assuming that Block1 is bytes 0 to 511,
block 2 is bytes 512 to 1023 etc. ? And the address I supply for write
instructions, I always then just change bits higher than the 9th bit
(512) ? 

Cheers again
Hein
Auckland, New Zealand.

--- In AVR-Chat@yahoogroups.com, Jesper Hansen <jesperh@...> wrote:
>
> kernels_nz wrote:
> > Hi guys,
> > 
> > Ive googled it to death, and read all the app notes and data sheets I
> > could get my hands on, but clearly I havent read them hard enough!
> > 
> > Just a few questions if anyone has used them succesfully please.
> > 
> > 1. As i read and understand it, can I only use 512byte block sizes for
> > single block writing in SPI mode ? Do I then have to write as a
> > minimum 512bytes of info everytime I write to the card ?
> 
> You MUST write complete 512 byte blocks. When reading you can terminate 
> a read by raising CS, but when writing this is not possible. If you do 
> not fullfill a block write, no data will be written at all.
> 
> > 2. Can anyone enlighten me as to how the physical sectors work ? How
> > many blocks per sector etc ? As I understand it, I need to supply a
> > start address for all write / read instructions, just wondering how I
> > know what address to give to make sure I start at the edges of blocks
> > and stay in the same sector.
> 
> Forget all about physical sectors and just think of the card as a 
> collection of 512 byte blocks. If you start playing with different
block 
> sizes (which only works on read anyway) you'll quickly end up confused. 
> Simply address the card by logical sector numbers, by simply
shifting up 
> the sector number 9 bits and feed that address to the card.
> 
> /Jesper
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.