Reply by Rocky December 30, 20062006-12-30
larwe wrote:
> Rocky wrote: > > > Have I misunderstood the requirements relating to SD / MMC for updating > > a sector? > > Yes. The card is smart (unlike, say, SSFDC). > > [Note, by the way, that this would be outside the scope of DOSFS - it > belongs in physical format management. But in this particular case > there is no complication for you to deal with. I will - as soon as I > can sanitize it - be releasing the SD/MMC code I use underneath DOSFS. > It's adapted from a couple of sources].
Thanks to all who replied. --Rocky
Reply by Rocky December 30, 20062006-12-30
Jonathan Kirwan wrote:
> On 30 Dec 2006 04:53:44 -0800, "Rocky" <RobertGush@gmail.com> wrote: > > >I am starting some work that would be using an SD card (in MMC-SPI > >mode) and I was hoping to use a PIC or similar low memory chip. > > > >The idea was to use Lewin Edward's DOSFS (www.zws.com) as it only > >requires about 1KB RAM. > > > >The problem is that according to the SANDISK spec one can do sector > >writes of 512 bytes, but that an erase will operate on 32 sectors. This > >means that to update the directory or the FAT one needs to read out > >16KB of data, do the erase, update the byte(s) in ram and write it all > >back again. This 16K block won't fit in a PIC. > > > >Have I misunderstood the requirements relating to SD / MMC for updating > >a sector? > > Rocky, I know nothing about the sandisk spec and haven't examined > Lewin's code but have you considered the possibility of leaving always > at least one (or a few) 32-sector region(s) empty? That seems that it > may permit you to transfer a directory under modification without > having to keep an entire 16k block in ram. >
Hi Jon, That crossed my mind, but it did seem to be clumsy. Also I was hoping to keep the SD readable by a PC at all times. Antonio (in another post) suggests that I was wrong in my assumption and the card handles all of the erase / write transparently. --Rocky
Reply by larwe December 30, 20062006-12-30
Rocky wrote:

> Have I misunderstood the requirements relating to SD / MMC for updating > a sector?
Yes. The card is smart (unlike, say, SSFDC). [Note, by the way, that this would be outside the scope of DOSFS - it belongs in physical format management. But in this particular case there is no complication for you to deal with. I will - as soon as I can sanitize it - be releasing the SD/MMC code I use underneath DOSFS. It's adapted from a couple of sources].
Reply by Rocky December 30, 20062006-12-30
dalai lamah wrote:
> Un bel giorno Rocky digit=F2: > > > The problem is that according to the SANDISK spec one can do sector > > writes of 512 bytes, but that an erase will operate on 32 sectors. This > > means that to update the directory or the FAT one needs to read out > > 16KB of data, do the erase, update the byte(s) in ram and write it all > > back again. This 16K block won't fit in a PIC. > > I don't remember if there is a specific MMC command to erase sectors, > anyway you don't need to erase a sector before writing it, you can just > overwrite it with the new data: the MMC controller will take care of all > the necessary operations (i.e. erasing a flash sector, rewriting the > unchanged blocks, etc) in a transparent way. You just have to be aware th=
at
> sometimes a sector write will take more time than the usual, because of a=
ll
> these "hidden" operations.
Hi Antonio Ok, so I did misunderstand what was meant. That would be why they go on about it being more efficient if the data to be (over)written is the size of an 'erase block'. Thanks -- Rocky
Reply by Jonathan Kirwan December 30, 20062006-12-30
On 30 Dec 2006 04:53:44 -0800, "Rocky" <RobertGush@gmail.com> wrote:

>I am starting some work that would be using an SD card (in MMC-SPI >mode) and I was hoping to use a PIC or similar low memory chip. > >The idea was to use Lewin Edward's DOSFS (www.zws.com) as it only >requires about 1KB RAM. > >The problem is that according to the SANDISK spec one can do sector >writes of 512 bytes, but that an erase will operate on 32 sectors. This >means that to update the directory or the FAT one needs to read out >16KB of data, do the erase, update the byte(s) in ram and write it all >back again. This 16K block won't fit in a PIC. > >Have I misunderstood the requirements relating to SD / MMC for updating >a sector?
Rocky, I know nothing about the sandisk spec and haven't examined Lewin's code but have you considered the possibility of leaving always at least one (or a few) 32-sector region(s) empty? That seems that it may permit you to transfer a directory under modification without having to keep an entire 16k block in ram. Jon
Reply by dalai lamah December 30, 20062006-12-30
Un bel giorno Rocky digit&#4294967295;:

> The problem is that according to the SANDISK spec one can do sector > writes of 512 bytes, but that an erase will operate on 32 sectors. This > means that to update the directory or the FAT one needs to read out > 16KB of data, do the erase, update the byte(s) in ram and write it all > back again. This 16K block won't fit in a PIC.
I don't remember if there is a specific MMC command to erase sectors, anyway you don't need to erase a sector before writing it, you can just overwrite it with the new data: the MMC controller will take care of all the necessary operations (i.e. erasing a flash sector, rewriting the unchanged blocks, etc) in a transparent way. You just have to be aware that sometimes a sector write will take more time than the usual, because of all these "hidden" operations. -- emboliaschizoide.splinder.com
Reply by Rocky December 30, 20062006-12-30
Hi All,

I am starting some work that would be using an SD card (in MMC-SPI
mode) and I was hoping to use a PIC or similar low memory chip.

The idea was to use Lewin Edward's DOSFS (www.zws.com) as it only
requires about 1KB RAM.

The problem is that according to the SANDISK spec one can do sector
writes of 512 bytes, but that an erase will operate on 32 sectors. This
means that to update the directory or the FAT one needs to read out
16KB of data, do the erase, update the byte(s) in ram and write it all
back again. This 16K block won't fit in a PIC.

Have I misunderstood the requirements relating to SD / MMC for updating
a sector?

--Rocky