2012-06-30 02:43 PM
Hello,
i have a small problem i think.With the help of this forum and google i created a project with CoIDE.What it should do is reading the directory of an SDCARD.The SDCARD part is working. but the fatfs is not working and i don't know what i'm doing wrong. I believe everything is oke. so i hope someone could help me. I attached the whole project. #sdcard-stm32f4-sdio-fatfs2012-06-30 04:05 PM
''the fatfs is not working''
In what way, exactly, is it ''not working''? eg, what error code(s) do you receive? What debugging have you done? Have you checked the FatFs documentation & support on the FatFs site?2012-06-30 08:50 PM
What size cards are you using?
Have you logged what reads are going through disk_read()?2012-07-01 04:51 AM
i realy don't know what the problem is.
I use a 4Gb card formated as fat32this is what the debugger says res = disk_initialize(0); => fr_ok res = f_mount(0,&fs32); => fr_ok res = f_opendir(&dir, path); => FR_NO_FILESYSTEMbut there is a file system on the drive2012-07-01 05:55 AM
A cursory review of disk_read() suggest several basic flaws, that either do or will cause failure.
a) No error propagation b) Fails to handle media >4GB c) Fails to address memory alignment requirements of downstream code d) Doesn't test for media presencehttp://elm-chan.org/fsw/ff/en/dread.html
2012-07-01 07:53 AM
now i have insert a 2 Gb sd card same error.
and as far as i can see, there is a check for media precence. f_mount and f_opendir don't use diskread !!!!!could you give me som clue on how to find out what goes wrong ?2012-07-01 10:02 AM
could you give me som clue on how to find out what goes wrong ?
Add some debug output telemetry so you can figure where it goes, and what's happening. Make sure you propagate errors so it doesn't fail silently. Dump out structures, add breakpoints. A file system that doesn't read the media isn't going to get very far. I might poke at this on Monday as time permits.2012-07-01 12:27 PM
You should check the boot sector integrity at RAM. FAT FS (i.e. Microsoft FAT) is present if byte number 510 of boot sector equals 0xAA and byte 511 is 0x55.
There may be a problem in power source or hw connections. Personally, I encountered a problem with STM32F4-Discovery board due to DMA ''ate'' some bytes, so the signature 0xaa 0x55 shifted to the wrong position.2012-07-01 01:50 PM
The MBR and the boot sector all have signatures and markers.
The DMA is intolerant of alignment violations.2012-07-02 09:27 AM
You shouldn't need to call disk_initialize(), FsFat calls this.
Subsequent calls to SD_Init() might be failing, and this would cause disk_read() not to be called. You don't initialize path, and you don't clear out the FATFS structure. Use a debugger, and step through the code.