2012-07-31 06:05 AM
Greetings,
I have been working with implementing FATfs for reading and writing to a microSD card. This is being done on an STM32L discovery board in the IAR Embedded Workbench environment. The issue that I am having is that although the files are being created on the disk, the data that I am trying to write rarely appears in the files, though I have had a few successes. I believe that my setup for the disk write and read routines are correct as I can write and read raw bytes to and from the SD card, as well as my SPI and card connections as initialization and communication of the card can be achieved. I am using a general mount-open-write-close-demount format to attempt these writes. I'm inquiring if anyone might have any thoughts on why these writes would not consistently happen or some other testing that I might be able to do in order to understand this problem. Stepping through the ff.c code for f_write and f_sync do not go to any obvious error paths and I am unsure what else to try. #stm32l---discovery #fatfs #microsd2012-07-31 06:33 AM
What size is the SD Card?
Consider also instrumenting the routines in diskio.c so you can understand what's going on in there, and perhaps do some analysis of the FAT structures so you can confirm it is doing the right thing, or where it might be putting the data.2012-08-06 06:53 AM
Hi,
I'm trying to do pretty much the same thing. Could I see your code ?Here is my mail: mp634@york.ac.ukWe should be able to do it !!Thanks,Mickael.2012-08-06 07:27 AM
I'm not using IAR or the STM32L1xx, but I have SD and FatFs working on several other STM32 devices and boards.
This thread might be worth a review, runs 2 pages [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/ST32f4discovery%2Bsdcard%2Bfatfs problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=597]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FST32f4discovery%2Bsdcard%2Bfatfs%20problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=597 The source The makefile needs fixing so HSE_VALUE=8000000, but the code might prove of interest despite the different chip and tool chain. For the L152 you might want to go dig through the example code for the EVAL board provided in the assorted firmware library releases.2012-09-12 06:25 AM
Hi Clive
Thanks for adding your example code, got it working on Atollic in no time at all, saved me a load of time ;) Thanks Andy.