2019-09-11 06:52 AM
Hello, I found this handy site with example code on getting free space on a USB connected to my STM32F7. The example code says "assuming 512 bytes/sector"... but I can't get the math to work out. How do I tell how many bytes per sector is on my USB drive, and will this be the same for all USB drives? OR is there another query I need to do on the card to figure out this bytes/sector parameter? Thanks!
Oops, here's the handy site. Got me *almost* all the way there.
2019-11-17 09:51 PM
Hi
using this function, you will get number of free clusters
FRESULT f_getfree (
const TCHAR* path, /* Path name of the logical drive number */
DWORD* nclst, /* Pointer to a variable to return number of free clusters */
FATFS** fatfs /* Pointer to return pointer to corresponding file system object */
)
and evry cluster size is fixed
so based on that you wil get available size of usb stick
Best of luck