2025-02-07 03:03 PM - edited 2025-02-07 03:25 PM
Hi,
I've been trying to get a MicroSD card working with my H755 Nucleo for the last week. Tricky, isn't it?!
I started with a SPI SD-card interface but gave up on that after about several days of pain. My focus now is on interfacing via SDIO, using the SDMMC peripheral on H7 and FATFS with FreeRTOS. I've tried both 1- and 4-bit mode.
I have the card initialising OK in MX_SDMMC1_SD_Init(), but calls to f_mount() are failing in check_fs() (in ff.c) which returns FR_DISK_ERR (=4).
I've tried multiple different cards.
Interestingly I have been able to format a card, but it remains un-mountable, as well as when using an externally-formatted card.
I came across https://community.st.com/t5/stm32cubemx-mcus/stm32h7-how-to-use-sdmmc-with-mdma/m-p/220163 which contains a useful PDF which aims to fill the holes in AN5200 (whoever wrote the section around Figure 14 "MDMA end of data configuration with STM32CubeMx" seems to have lost interest just as they got to the interesting and important bit). That document is somewhat incomplete.
If anybody can point me towards a complete working example please, that would be great. By complete, I mean including the .ioc file as well as generated source, otherwise I've little chance of re-creating the solution in any maintainable way.
STM Staff, please would you sort out the documentation on this area? I think there's a need for a definitive set of instructions for SD Cards + FAT-FS, whereas currently I see a collection of incomplete documents and references to possible solutions from helpful developers in this community. You only have to look at all the questions asked by others to see how poorly documented this aspect of STM32 is.
I've attached my .ioc.
I'm sure I'll have done something silly or completely missed something that should be obvious - any help to identify the missing pieces would be much appreciated.
Thank you!