Go Down

Topic: macOs / Windows cannot read SdFat formatted card, but Arduino can? (Read 79 times) previous topic - next topic


I'm using SdFat in a project on Due. I'm using a 3d printer LCD display / controller / SD interface (although the project isn't a 3d printer) and the SD card is connected to the Due's hardware SPI. Fundamentally it's a data logger which writes data to the SD in 512 byte blocks, to files opened for append, and then closes them; data is written a few times a second.

I've implemented formatting support in my project using the code from the format example.

Yesterday, doing some testing, I formatted a card I've not used before - a 2GB nominal microsd in an adaptor - using the format code in my project (which is the same as the format example in SdFat).

When I removed the card from the Arduino and put it in my Mac, it's unreadable - the Mac wants me to format it. I experience the same results in windows too, and linux. I've dumped an image of the card and played with it a bit in linux and I can't get anything useful off it.

However, the card still works fine on the Arduino. My code implements a directory browser, and it can see the files too. I modified the "LongFilenames" example to dump more than 500 bytes of data and it is able to dump the data from the files on the SD card to serial, and the data is fine - not corrupted and all present and correct.

I'm really not sure what is going on. Are there circumstances where the format code can product a format that is out of spec, but which the SdFat library is fine with?

Here is the output from the SdInfo example:

Code: [Select]

init time: 3 ms

Card type: SD1

Manufacturer ID: 0X3
Product: SU02G
Version: 8.0
Serial number: 0XE3C05130
Manufacturing date: 10/2006

cardSize: 2032.66 MB (MB = 1,000,000 bytes)
flashEraseSize: 32 blocks
eraseSingleBlock: true
OCR: 0X80FF8000

SD Partition Table

Volume is FAT16
blocksPerCluster: 64
clusterCount: 62020
freeClusters: 61940
freeSpace: 2029.65 MB (MB = 1,000,000 bytes)
fatStartBlock: 250
fatCount: 2
blocksPerFat: 243
rootDirStart: 736
dataStartBlock: 768

Go Up