2012-09-12 11:37 PM
Hello,
I've a problem with sdhc used with sdio in stm32f4-discovery platform. I've tried 2 versions of fat file system and sd driver, but I am not able to run sdhc properly. The things I tried; 1) Nemui's sdio implementation with chan's fat version 0.09a. 2) stm324xg-eval implementation with also chan's fat 0.09.(which is used from stm32-demonstration builder) Both codes are working perfectly with standard sdsc card (which are below 2gb) but when I insert a FAT32 formated sdhc card, the following occur. 1) SD_init() returns OK 2) f_mount() returns OK 3) f_open with create new file option returns OK 4) f_write returns OK with byteswritten value returned as expected. 5) f_sync returns OK but when I connect the sdhc card to pc there seems nothings has been written. Also there exists only one file in sdhc named as ''audio.wav'', f_open to this file returns FR_NO_FILE the standard sdsc versions are working perfectly, the init sequence seems to support sdhc but there must be something I forget. Can you please help me ? Regards, Yigit #stm32-sdio-sdhc #sdio-sdhc-stm32 #stm32-sdio-sdhc #stm32-sdio-wide-mode-sdhc2013-07-15 09:38 PM
https://docs.google.com/open?id=0B7OY5pub_GfIaUozb1VsY3Flb1E
Hi Clive, I m new in interfacing sd with stm32 could u suggest me how to add F_open & other files in sd card eg. also some documentation regarding sd card library Thanks Amol2013-07-16 04:30 AM
http://elm-chan.org/fsw/ff/en/appnote.html
http://elm-chan.org/fsw/ff/00index_e.html
STM32F4xx_DSP_StdPeriph_Lib_V1.1.0\Project\STM32F4xx_StdPeriph_Examples\SDIO\SDIO_uSDCard2013-12-13 07:46 AM
Hello Shannon Could you help with this..
I am trying to understand what to do with the code that clive1 had attached. Please send me what you did to make it works. I will be so grateful. Thanks beforehand.2013-12-13 10:27 AM
The code as presented is an end-to-end demonstration of FAT access from a Micro SD Card.
On the STM32F4-Discovery this requires you to wire up a socket to the board, or use a base board like the STM32F4-DIS-BB with one provided. For the BB implementation you'd just need to modify the Card Detect pin the software uses by default, as I had used a different pin on the prototype I built. The question would then be what have you done, and why isn't it working for you?2013-12-17 06:11 AM
Hi Clive,
I've just tried to implement your code on my STM32F4 discovery with a SD Card connector (minus the detect pin) and for some reason, it's failing to send CMD0 and so gets a timeout error everytime. I know it's nothing to do with my card or connections as I have them working with code I've used before (without fatfs). Any idea what might be going wrong? I've commented out any code I can find to do with the detect pin.2013-12-17 06:31 AM
Not quite sure what's different about my system, but I added in a few millisecond delays around the SD Init phase, and that seemed to fix the problem.
2013-12-17 06:42 AM
By the way, whereabouts in the code do we define if we want FAT12,16, or 32?
2013-12-17 06:45 AM
By the way, whereabouts in the code do we define if we want FAT12,16, or 32?
Wouldn't that be a function of what's in the MBR/BPB?2013-12-17 06:53 AM
So does fatfs extract that information from the MBR and then just work in that format? What if I wanted to let's say format the card from the STM into a different format. Is that possible with fatfs? (I can't see anything about formatting in the docs)
2013-12-17 07:07 AM
The partition table in the MBR define the nature of the partition, the FAT's BPB actually defines the file systems geometry.
http://elm-chan.org/fsw/ff/en/mkfs.html
I personally haven't used it, I've built my own more industrial formatters in the past. But, again you really have some relatively limited control, the size of the media determines the appropriate maximum, 2GB being the limit for 32 KB clusters in FAT16. Microsoft has some rules about how this is done ''optimally'', SD Cards also have VERY specific needs for ALL structures to be aligned on Erase Block boundaries (perhaps 128 KB, but check stats returned by card) otherwise performance takes a hideous hit. Unless you have some specific insight into file systems and block devices you probably want to tread carefully.