I'm using a micro SD card of 4Gb from Kingston in an embedded project and I'm accessing it with a low level SPI driver.

Everything is running just fine, except for a weird behavior: after a given block (around 16 Kb of the card), the write speed drops to 1/3 of the first block's speed.

Is this normal? Maybe the first blocks of an SD card are of a higher speed memory, I don't know. Does someone have info about this?


2 Answers 2


Yes, this is normal. Many SD cards have a write buffer (think of it like a disk cache). If you read the datasheet for the specific component it should detail the size of the cache and access speeds of the device in general.

If you think that the speed is based on the block the test is easy: write to the SD card at some offset past where you think the "fast blocks" are -- they should be just as quick for the first writes.


An SD-to-flash interface must keep a sector which is being written in RAM until the write is complete, to allow for the possibility that the sector being written might fail (making it necessary to store the the data elsewhere). If that were the only buffering on the chip, then writing continuous data would require that the system alternate between feeding data to the chip (while the flash memory array is idle) and waiting for the data to be written (meaning the rest of the system would be idle). Adding a second buffer, and allowing it to be written while data is being stored to flash will allow the processes to be overlapped. If the slower of the two processes would takes time t1 in isolation and the faster one would take time t2, this will improve the time to write each sector from (t1+t2) to t1, a savings of t2/(t1+t2). If the two processes take roughly equal amounts of time, this could nearly double the speed.

Adding additional buffering may be helpful in some scenarios, but will seldom offer anything near the price/performance ratio of that second buffer. It will offer a 25% or better speed boost if the time to load a sector's worth of data into the controller is anywhere between 1/3 and 3x the time required for the controller to store it to the memory array. Given the relatively small cost of a buffer that size, there's little reason not to add it. Adding additional buffering, however, won't help things as much; if one has extra memory available, it may be better utilized for partial-address caching [an SD card of any size needs to be able to independently remap each 512-byte sector, and a 32GB card will have 64 million such sectors--too many for a single "flat" data structure; still, the more mapping-related information can be cached in RAM, the less time will have to be spent reading it from flash.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.