cancel
Showing results for 
Search instead for 
Did you mean: 

Data logger

udibit
Associate II
Posted on July 13, 2015 at 14:26

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.
1 REPLY 1
Posted on July 14, 2015 at 18:11

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..