bianchi77
Advanced Member level 4
- Joined
- Jun 11, 2009
- Messages
- 1,313
- Helped
- 21
- Reputation
- 44
- Reaction score
- 20
- Trophy points
- 1,318
- Location
- California
- Activity points
- 9,442
Hello Guys,
I tried to read a free space on FAT32 SDcard, based on :
http://elm-chan.org/fsw/ff/en/getfree.html
How can I use _FS_NOFSINFO ?
Because the size I got on UART was not right :
FREE SPACE ON SDCARD
Free space : 692517509 bytes Total space : 199 bytes
My SDCard is 1Gb and is being used about 30Mb
thanks
I tried to read a free space on FAT32 SDcard, based on :
http://elm-chan.org/fsw/ff/en/getfree.html
How can I use _FS_NOFSINFO ?
Because the size I got on UART was not right :
FREE SPACE ON SDCARD
Free space : 692517509 bytes Total space : 199 bytes
My SDCard is 1Gb and is being used about 30Mb
thanks
Code:
/* Get volume information and free clusters of drive 1 */
res = f_getfree("1:", &fre_clust, &fs);
//if (res) die(res);
/* Get total sectors and free sectors */
tot_sect = (fs->n_fatent - 2) * fs->csize;
fre_sect = fre_clust * fs->csize;
/* Print the free space (assuming 512 bytes/sector) */
printf("%10lu KiB total drive space.\n%10lu KiB available.\n",
tot_sect / 2, fre_sect / 2);
sprintf_P( &temp_buffer, PSTR(" Free space : %10lu bytes "), fre_sect );
usart_pstr( &temp_buffer );
sprintf_P( &temp_buffer, PSTR(" Total space : %10lu bytes "), tot_sect );
usart_pstr( &temp_buffer );