SDCard maximum storage space

Discussion to talk about software related topics only.
Post Reply
vmetodiev
Posts: 3
Joined: Tue Apr 19, 2016 4:01 am

SDCard maximum storage space

Post by vmetodiev »

Hello,

What is the maximum storage size that I can address using the onboard microSD card slot on MOD54415?

At the moment I am testing with an 8GB Card and the f_getfreespace returns the following.

Total Space On Drive: 3644850176
Free Space On Drive: 3644784640

And here is the code snippet that I am using to generate the mentioned output:

Code: Select all

		F_SPACE space;
		int ret_space = f_getfreespace( f_getdrive(), &space );

		if ( !ret_space )
		{
			/* Some Info */
			iprintf("\r\nTotal Space On Drive: %lu", space.total);
			iprintf("\r\nFree Space On Drive: %lu", space.free);
                }
Regards,
Varban
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: SDCard maximum storage space

Post by rnixon »

Your not using the function correctly to read the high bits. Take a look at the EFFS docs for that function call.
joepasquariello
Posts: 85
Joined: Mon Apr 28, 2008 7:32 am

Re: SDCard maximum storage space

Post by joepasquariello »

Varban, for cards > 4GB, you need to compute 64-bit (long long) values by combining the "low" and "high" 32-bit fields of F_SPACE. See the code in nburn\examples\MOD5441X\EFFS-MULTIPLE-MMC. Note "%llu" is the format to print long long unsigned.

Joe

F_SPACE space;
volatile int rv = f_getfreespace( drv, &space );
if ( rv == F_NO_ERROR ) {
long long total = ((long long)space.total_high << 32) + space.total;
long long free = ((long long)space.free_high << 32) + space.free;
long long used = ((long long)space.used_high << 32) + space.used;
long long bad = ((long long)space.bad_high << 32) + space.bad;
iprintf( "%llu total, %llu free, %llu used, %llu bad\r\n", total, free, used, bad );
}
vmetodiev
Posts: 3
Joined: Tue Apr 19, 2016 4:01 am

Re: SDCard maximum storage space

Post by vmetodiev »

@rnixon

@joepasquariello

Oh, okay... Thank you very much for your suggestions!

Regards,
Varban
Post Reply