lpcware

LPC1769 SD card SPI mode write performance issue

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by wlamers on Fri Aug 31 07:26:31 MST 2012
Hello All,

I have a SD (or SDHC) card connected to a microcontroller via SPI mode. I am using Chan’s FAT library. I write data to it which comes from an 8192 byte buffer (buffer cannot be larger due to insufficient RAM). This writing is performed periodically. Normally writing is ready before the buffer is filled again. But once in a while (also depending on the buffer fill speed) things go wrong and writing is NOT ready before the new buffer has to be written, causing loss of data.

BTW, sector size is also set to 8192 bytes, but others do not seem to have an influence.

The writing can be monitored with a scope, and shows that sometimes writing takes a long time. E.g. 4x longer than usual.

Does someone knows what is going on here, and maybe how to prevent this from happening? Has this something to do with a read, modify, write sequence? Do I need an external RAM buffer? Or are there better ways to improve performance?

Thanks!

Outcomes