I ran the SD Card Cardinfo sketch on my Arduino Uno, I had a 8 GB card plugged in but the serial monitor said only 3508 Megabytes.
Help please!!
Datalogging shield displaying incorrect storage
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- rahatmaini
- Posts: 176
- Joined: Wed Aug 29, 2012 5:15 pm
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Datalogging shield displaying incorrect storage
Is your card formatted as FAT16? That has a volume limit of 4GB. Can you plug it into a computer and check the volume size?
Try reformatting as FAT32.
Try reformatting as FAT32.
- rogerc2288
- Posts: 5
- Joined: Thu Jul 25, 2013 11:04 am
Re: Datalogging shield displaying incorrect storage
I am getting the same thing on the 8gb card I just tested. It is a Dane Elec 8gb SDHC formatted as FAT32 with the suggested SD format app and when I look at it in the computer it says it is 8gb FAT32 but when in the Data Logger Shield using Cardinfo I get volume size as 3.5 gb. Any help appreciated
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Datalogging shield displaying incorrect storage
I just took a look at cardinfo. I think you're simply seeing an integer overflow. cardinfo uses a 32-bit unsigned integer to compute the volume size in bytes. That will overflow when the value exceeds 4.2GB.
You can add a couple of lines to cardinfo to see the numbers it uses to compute the volume size:
I've got a 4GB card here, and I get this:
So 64 * 120704 * 512 = 3955228672
If you add the lines to print out blocksPerCluster and clusterCount, you should be able to multiply the results together with 512 and verify that your card really does have 8GB available.
You can add a couple of lines to cardinfo to see the numbers it uses to compute the volume size:
Code: Select all
Serial.print("volume.blocksPerCluster: "); Serial.println(volume.blocksPerCluster());
Serial.print("volume.clusterCount: "); Serial.println(volume.clusterCount());
volumesize = volume.blocksPerCluster(); // clusters are collections of blocks
volumesize *= volume.clusterCount(); // we'll have a lot of clusters
volumesize *= 512; // SD card blocks are always 512 bytes
Serial.print("Volume size (bytes): ");
Code: Select all
Initializing SD card...
Card type: SDHC
Volume type is FAT32
volume.blocksPerCluster: 64
volume.clusterCount: 120704
Volume size (bytes): 3955228672
If you add the lines to print out blocksPerCluster and clusterCount, you should be able to multiply the results together with 512 and verify that your card really does have 8GB available.
- rogerc2288
- Posts: 5
- Joined: Thu Jul 25, 2013 11:04 am
Re: Datalogging shield displaying incorrect storage
Thanks for that info Rick, it worked perfectly. I got 240467 clusters, 64 blocks per cluster and when I multiplied that with the 512 bytes per cluster I got exactly what my computer was telling me the size of the SD card was.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Datalogging shield displaying incorrect storage
Cool.
<*sigh*> I still remember when 32 was more bits than you would ever need.
<*sigh*> I still remember when 32 was more bits than you would ever need.
Please be positive and constructive with your questions and comments.