2025-01-08 02:12 PM
Hi
I'm trying to connect an SD card to my Nucleo U5A5ZJ-Q board using SDMMC peripheral and use it with FatFS library. When I use 1GB card and 4 bit mode, everything works fine. By "works fine" I mean that:
1. it passes this FatFS test: http://elm-chan.org/fsw/ff/res/app4.c
2. it is able to create a working text file.
But there are 2 problems:
1. 1 bit SDMMC mode doesn't work. When I'm trying to use it, the FatFS test fails at an SD card write. After clicking around in STM32CubeIDE debugger I found that there is a CRC error in SD callback being set as status, which then leads to a timeout and test fail. This problem isn't critical, because 4 bit mode seems to work, but it worries me a bit.
2. 16GB and 32GB cards don't work. They get a bit further (to reading), but fail in a simmilar way (SD callback -> CRC error -> timeout -> test fail). I haven't been able to test 2-8GB cards yet. This is more of a problem, because it's getting harder and harder to get such small capacity cards.
The whole project is attached below.
Ideas, anyone? Thanks in advance.
Adam
2025-01-08 02:31 PM
Hi,
most probably a hardware problem.
1-bit mode is less difficult, so it should work most times...even when 4-bit not working.
So search/read here in forum, what i wrote about sd-card problems and what to do.
...set pin speed medium, pullups on...etc.
+ i have sd-cards on my H743 audio player and no problem, 2GB or 32 GB .
2025-01-08 02:43 PM
Ok, I'm gonna try these things tomorrow. I find it weird that 4 bit mode is working but 1 bit mode is not. It seems that everyone has the opposite situation.
2025-01-10 08:04 AM
I've tested some uSD cards and here are the results:
1. 1 bit SDMMC mode isn't working at all. It's hanging at a first write with CRC error.
2. 4 bit mode does work but only on 1GB and below cards. Anything above 1GB hangs with a CRC error on first read (so after writing).
All pins exept for CLK are with pullups. All pins set to medium.
2025-01-10 08:40 AM - edited 2025-01-10 08:41 AM
So next: how long are your lines cpu/pin -> sd-card/pin ?
and clk /speed setting for sdmmc ?
+
Please dont write or mkfs -never ever- as long , its not working perfect with mount and reading.
Your just lucky, if cards survive these bad access trials.
Only mount and read (existing) files , until this works 100% perfect. Then try a write or create file...