Pages: [1]   Go Down
Author Topic: SD Card Info Returns wrong size  (Read 842 times)
0 Members and 1 Guest are viewing this topic.
Melbourne Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 42
There are only 10 types of people in the world: those who understand binary, and those who don't.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 :

http://www.ebay.com.au/itm/1-8-Serial-SPI-TFT-LCD-Module-Display-PCB-Adapter-Power-IC-SD-Socket-128X160-/200926655502?pt=AU_B_I_Electrical_Test_Equipment&hash=item2ec829740e&_uhb=1

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:
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 smiley
Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1631
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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,
Logged

Melbourne Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 42
There are only 10 types of people in the world: those who understand binary, and those who don't.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your reply fat16lib.

How embarrassing, you are correct re the 29gb.  Stupid decimal points smiley-wink

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

Pages: [1]   Go Up
Jump to: