Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] A little help with SD cards . . . ?

2006-04-25 by Jesper Hansen

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.