2015-07-13 05:26 AM
Hi,
I would like to use micro-SD to log data of several sensors. (I have connected micro-SD to my STM32F103 nucleo board, and I am able to open and write into a file). 1. In order to add new data (16bit), i just use ''f_write'', is there more appropriate function? 2. How can i check if a new file name is already exist? 3. Can someone refer me to such example code? Thanks - Udi.2015-07-14 09:11 AM
Don't f_write() 16-bits at a time, buffer much larger blocks of data.
You can use various forms of f_open(), with FA_OPEN_ALWAYS you can check fil.fsize, and f_lseek() to the end if you want to append to an existing file. You could use f_open() with FA_READ and see if you get an error, or not? You could also use f_opendir/f_readdir to check what files exist The FatFS website seems to provide sufficient examples and documentation to get things done.