Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] MMC filesystem speed

2005-11-26 by Bertrik Sikken

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi again,

Tom Walsh wrote:
> Bertrik Sikken wrote:
>>And have you tried the WRITE_MULTIPLE_BLOCK command?
>>- From what I've read in some of the sandisk documents,
>>their flash products internally use blocks much larger
>>than a single 512-byte sector, so using the WRITE_MULTIPLE_BLOCK
>>command may help to write more efficiently (faster, smoothly) and
>>probably also reduce wear of the flash medium.
>>
> 
> The program is not structure for Multiple Sector operations.  However, 
> using Multiple Sectors is problematic at best.  To effectively write 
> data in chunks larger than 512bytes, you would have to configure the 
> BLOCK_SIZE (CMD51) so that both reads and writes would use the larger 
> block.  This becomes a huge problem of now that you have to deblock down 
> to a smaller size to utilize 512byte sectors within the RDCF2.
> 
> Doing Multiple Writes of a BLOCK_SIZE of 512bytes gains you nothing.  
> Each BLOCK_SIZE of data is treated by the SD/MMC as a unit which must be 
> programmed, regardless of the physical blocking on the device.
> 
> Why not take the RDCF2 code and try some of this out?

I did some experiments to get a feel for the write speed.
It turns out that, contrary to what I expected, the WRITE_MULTIPLE_BLOCK
command is hardly any faster than the WRITE_BLOCK command.

I measured the time it took to read and write 4MB of contiguous raw data
directly onto the disk (without a file system). Writing was done both
with the WRITE_BLOCK command and the WRITE_MULTIPLE_BLOCK.
The WRITE_MULTIPLE_BLOCK command was configured to write 256 sectors
of 512 bytes (128 kB). I measured the time by looking at my wristwatch.
My hardware is a LPC2148 quickstart board from embedded artists,
configured to run at 60 MHz PCLK and 7.5 MHz SPI clock (highest possible
for SPI0). My results are:

read            13 s
write single    14 s
write multiple  13 s

I find it surprising that the write speed is not significantly slower
than the read speed.

While waiting for the card response the software lights a LED, so this
gives me a rough idea how much time is spent waiting and how much is
spent actually sending data over SPI.
When I look at the LED, I see a distinct flashing pattern. It seems
that for every 128kB (256 sectors) written, the LED lights longer
than for the other sectors, both for single block and multi-block
writes. I guess the card caches 256 contiguous blocks and then
writes those in one go.

This was on a standard Kingston 128 MB SD card, which uses multi-level
memory cells and is specified for up to 1.5 MB/s, which I think is
rather slow. Other cards probably give other/better results.

All the best,
Bertrik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDiOuSETD6mlrWxPURAv/MAJsGMteEYzDpuz6gzGG7ze9DrY8z2QCcCCYA
DqeXFSI5rIbLW/WWBzVEOYo=
=nDGF
-----END PGP SIGNATURE-----

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.