Eventual SDHC read failure


I have a microcontroller project/product which uses a 4GB SanDisk SDHC Class 4 card and it fails to read after a (large) number of reads. As I need less than 1GB storage I would prefer to use the 4GB cards I already have, if I can get past this problem.

It holds .WAV files which a dsPIC uses for short sound effects. After loading the card with the files there is no more writing.

To test the circuit and s/w I set the uC to read, via 11MHz SPI, two files alternately about 1s apart. After ~ 18 hours (about 30,000 reads) the circuit is left hanging with Clk running. Re-booting the circuit gets the files playing again, but it will stop reading within a few seconds to a few minutes. I’ve repeated this 3 times during the week.  The last occurence was a little odder. It ran for almost 30 hours and an intermittent small click was heard in a file, as though a couple of 0xFFFF bytes were being put through the dsPIC’s DAC to drive it to its limits. However, the dsPIC is OK and so is the file, so I’m guessing this errant data came from the card’s FTL.

Formatting and re-loading the card’s files gets it working but not permanently, as above. I’ve compared the card files with the originals and they match, so I don’t think they’ve become corrupted by, for example, read disturb. File start sectors are in a RAM table on the dsPIC, so the card’s FAT isn’t being read more than once.

Something in the FTL is being reset or refreshed by the re-format and I’d like to know what  that is and how I could do it from the dsPIC, as a format and re-load is not practical for the end user. Maybe an occassional block write will force the FTL to do some housework. Would this be a systemic failure that will happen no matter what card I use ?

I have no idea what the mechanism of this failure is. Perhaps the FTL gets “clogged” with something after so many reads and needs to do a garbage collection, or maybe it’s blocks in one file that are adjacent to those in the other which are affected by read disturb. Although the files always appear to be OK.

I’d be most grateful if someone can give me a solution. For the time being I’ve added a 512kB RAM to play the files from so I can keep testing but this isn’t ideal, and I don’t think should be necessary

Thanks in advance