2024-04-18 06:25 AM - edited 2024-04-18 06:48 AM
Hello,
I would like to get free memory on USB drive (64GB, FAT32) with FatFs library. Here is part of my code:
DWORD fre_clust, fre_sect;
uint64_t free_memory;
res_file = f_mount(&fs, "0:", 1);
res_file = f_getfree("0:", &fre_clust, &fs);
fre_sect = fre_clust * fs.csize;
free_memory = (uint64_t)((uint64_t)fre_sect*(uint64_t)fs.ssize)/1048576;//MB
The problem is that f_getfree() always returns same value, even if data size is changed.
Also I would like to say that res_file has return value FR_OK in both cases and
Iam able to write data on USB drive with FatFs.
(Iam using STM32CubeIDE 1.14.1 and STM32H753)
Does anyone know what Iam doing wrong?
Thank you for your response.
Solved! Go to Solution.
2024-04-19 05:25 AM
Reformatting the usb drive fixed my issue.
2024-04-19 05:25 AM
Reformatting the usb drive fixed my issue.