I have interfaced a Micro SD card to a MSP430 microcontroller using the
SPI mode. Everything worked perfectly fine but I recently had problems
when writing too often into my files.
Here is my setup. As I said the card (SDHC 4Go) is directly connected to
the microcontroller via its USCI (SPI) peripheral. I have written the
basic SD access (register read / write, basically to find if a card is a
SDSC or SDHC, page read / write). I have followed the reduced SD
sp�cification to do so (CRC activated, waiting after any operation for
the card to leave the 'busy' state). On top of that I have implemented a
FAT32 filesystem driver that is able to create / delete, read / write
any file on the root directory (not directory handling, only short
filenames).
Here is my problem: sometimes (I'm not able to give specific detail on
'when' because it varies a lot in time and frequency), complete sectors
of my create files are filled with zeroes...
I have investigated on my filesystem implementation because it seemed
obvious that the problem what there. But it turned out that I have
managed to reproduce that bug only writing pages using the low level SD
access. For exemple if i write 4000 pages of 512 bytes filled with 0xAA
bytes, I get 2 to 10 pages filled with 0x00.
Does anyone encountered this kind problem? I would be so grateful if
someone could give me at least a hint on how to solve that bug because
I'm wasting my last week investigating on that.
Regards,
Christophe