2013-05-03 09:01 PM
I am trying to implement at FAT FS on the STM32F4 Discovery board...the firmware package provided by st supplies third party files. But are these files enough to implement the FAT FS on the STM32F4 board? Or is there more files that I need to write myself?
#sdcard-stm32f4-sdio-fatfs #stm32f42013-05-03 09:29 PM
You might have to do some porting, and modifying the pin utilization to match how you wired it up. But generally the files are what you need.
Been there, done that. [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32%20sdio%20sdhc%204gb%20problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=102]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32%20sdio%20sdhc%204gb%20problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=1022013-05-08 07:16 PM
Thank you for your quick response I appreciate the example...I was able to compile my code and now I am working through a new problem. I am multiple functions that are using the f_open, f_write and f_close to write data onto my sd card. These functions are called based upon the state of my system and that state is what I am sending to the sd card. But when I run my tests of different states of the system then take the sd card and put it into my computer, only the final system state is saved on the sd card. Do you why this could be happening?
2013-05-09 07:38 AM
Try calling
f_sync()
after each write operation, equivalent tofflush
() on OS based code.2013-05-09 02:15 PM
I was told that if I f_open, f_write and f_close then if I try to f_open, f_write and f_close again the code will overwrite the old data. So I am trying to just f_mount and f_open the file once and f_write in other areas of my code. But by doing this my code is getting stuck in the diskio file trying to get the status of the sd card...do I need to have the f_write function right after the f_open function?
2013-05-09 03:34 PM
I was told that if I f_open, f_write and f_close then if I try to f_open, f_write and f_close again the code will overwrite the old data.
By whom? The documentation for FatFs is reasonably through, and not too dissimilar to STDIO. f_open() doesn't have to overwrite the file, it's quite easy to f_open(),f_lseek(),f_write(), and f_close() to incrementally add to a log file. If you keep the file open over a long period, you'll have to be sure the card isn't removed, reset or powered down. I would stick to the former method.[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Writing%20on%20USB-Memory&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=85]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FWriting%20on%20USB-Memory&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=85
2013-05-13 07:45 PM
Thank you for your help Clive1...I got it all working. You're the best.