Oh, I love this Forum software. Get half-way through writing a message and it disappears.
I bought some Used microSD cards from Ebay. They give write errors on the PC.
So I bought some 'new' microSD from Ebay. They turn out to be Used too. (but error-free)
So I thought. Let's go through each sector on the duff microSD card(s):
Read it into a buffer. XOR it. Write it back. Read the written sector. XOR it. Compare with the original.
Then write the original sector back. Verify it.
Rinse and repeat for 4M sectors.
Surely this would show any problems with a sector. If the problem sector is in the FAT area, this is nasty. But for the DATA area, I could just mark as BAD cluster in the FAT and the PC or FATfs would be happy.
Since the PC found errors in the first few files written, my sector 'test' should find bad sectors pretty early.
Anyway, the MEGA2560 has been happily reading and writing sectors for the last few hours. sector #439000 at the moment. i.e. about 15% through the card. It has not found any errors yet.