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-sdhc2012-09-13 03:21 AM
The SD code provided by the ST EVAL examples talks to the SD card via a 32-bit linear address, which obviously has 4GB issues, rather than using block addressing.
I'd point at some threads here, but there are many, and the search just *****. Here is a FAT FS example, ported to the STM32F4-Discovery, with the blocking fixed and consistent. I'm not sure it's the most up-to-date one, and I do have examples under Keil, and for the USB MSC example too. The MSC example is here, check the readme.txt for wiring details, which can also be a problem if fouled up. You need pull-up resistors.https://docs.google.com/open?id=0B7OY5pub_GfIaUozb1VsY3Flb1E
2012-09-13 05:50 AM
2012-09-13 07:08 AM
Thank you for your fast reply.
I've used the code you have attached. That worked with sdsc properly, but in case of sdhc, I get random errors when reading. I got CRC error after SD_Stop_transfer() function. By the way I'm trying to read 4864 bytes. And It never read that much data. With SDSC all is working as intended. Also I'm trying to use 4 GB SDHC class 4 card.2012-09-13 07:09 AM
Thank you for your fast reply.
I've used the code you have attached. That worked with sdsc properly, but in case of sdhc, I get random errors when reading. I got CRC error after SD_Stop_transfer() function. By the way I'm trying to read 4864 bytes. And It never read that much data. With SDSC all is working as intended. Also I'm trying to use 4 GB SDHC class 4 card.2012-09-13 10:44 AM
How, specifically, do you have it wired up?
I'm using a MicroSD card socket, the signal lines are about 1'' long, with 33K pull ups. I'm using a different GPIO for the CARD DETECT pin.2012-09-13 11:36 AM
I've connected slot as described with pullups on each line, except the clk line. I am not currently using sd_detect pin and also removed detection from the code.
I'm getting CRC errors randomly for commands that I sent. Also there is no problem with the sdsc mode. Only the sdhc mode has the CRC problem.2012-09-13 01:12 PM
I've discovered that only 4b wide mode of sdhc has the crc problem. 1b is working fine. But I need to speed it up.
note: sdsc mode can be used in 4b wide mode without any problem. Only sdhc has the problem.2012-09-13 03:59 PM
So basically an integrity issue, perhaps cross-talk, or relative skewing.
You could try dropping the SDIO bus clock, or a PCB solution with controlled path lengths/characteristics.2013-06-09 09:35 AM
THANK YOU!!!!!!!!!!!!
I cannot express the level of gratitude I have for you posting the above demo. I mean seriously. You went out of your way to put together a fairly complex piece of code and provided it free to all of us. That kind of altruism should be rewarded.Right now I'm bringing up a personal project of mine. I was dreading bringing up the sd card / FAT file system. I had tackled this before on a bread board and just barely got it working after weeks of labor. I didn't use Chan's FAT last time and had to write a bit of code to finally get things in order but I never felt it was clean.Now I have my own PCBA and decided to try and implement the full Chan FAT. If I had not stumbled upon this old thread and your code I'm quite sure I would still be struggling weeks from now. THANK YOU!!!!!! Absolutely worked the first time! That is stunning in and of itself!!!I was going to send you a private email but I think this needed to be said publicly. I don't know how many will see this old thread but it's worth a shot.Shannon