Go Down

Topic: SD Card Info Returns wrong size (Read 988 times) previous topic - next topic


G'day all,

I'm working with a 1.8" TFT display, which has an SD card reader installed into it.  The display was bought off EBay :


The display works great, and I'm able to create and write files to a 16GB SD card with no problem.

The issue I have is when I run 'Card Info' from the SD example library, it returns these values :

Code: [Select]

Initializing SD card...Wiring is correct and a card is present.

Card type: SDHC

Volume type is FAT32

Volume size (bytes): 3038248960
Volume size (Kbytes): 2967040
Volume size (Mbytes): 2897

It reports that it's size is 3038248960 bytes, equating to a little under 29GB.  This is obviously incorrect, as the card is only 16GB to start with.

I used SD formatter from Adafruit to format the card, and it happily reports it's size as 14.8GB formatted, which I believe is correct.

Any thoughts would be greatly appreciated - I need to monitor how much free space is on the card, and I really would prefer not to have some type of offset to arrive at the correct number.

Thanks in advance :)


This is a well known bug in SD.h, not sure why the Arduino company has not fixed it.  CardInfo was written by Adafruit.

The reported value in bytes is truncated to 32-bits so it is incorrect for cards over 4 GB.

3038248960 is not 29 GB.  It is 3,038,248,960 bytes, about 3 GB,


Thanks for your reply fat16lib.

How embarrassing, you are correct re the 29gb.  Stupid decimal points ;)

So, given that the reported value is incorrect, am I still able to write to all 16gb of the card?

Go Up