AnsweredAssumed Answered

FATFS chan library wrong free space

Question asked by kovaliov.nikolaj on Oct 16, 2014
Latest reply on Oct 17, 2014 by kovaliov.nikolaj

Good day everyone,

 

I tried to use Chan's FatFS library for a while, it works fine,

 

But I found some problems here.

 

If I read free space in my MicroSD card, it reads it wrong.

 

When I format it for a while it reads data normally, but later when I create, delete files, it shows it not correct.

 

Here is some debug information:

 

2058.049072 KB/s

done 4194304 bytes

 

7585 MiB total drive space.

7029 MiB available.

 

actual is:

 

7585 MiB total drive space.

7560 MiB available.

 

fat_res = f_getfree("", &fre_clust, &fs);

tot_sect = (fs->n_fatent - 2) * fs->csize;

fre_sect = fre_clust * fs->csize;

 

printf("\n%10lu MiB total drive space.\n%10lu MiB available.\n", tot_sect / 2 / 1024, fre_sect / 2 / 1024);

 

Thank you,

 

//Nikolaj

Outcomes