STM32H7 and SDMMC/FatFs
Hello Everyone,
I have an STM32H7 interfacing with an SD card Using FatFs. I am using the cube ide, latest drivers etc. (embedded packages version 1.9.0) (FatFs Middlewhere version: R0.12c)
I am facing an issue where sometimes (50% of the time?) The Card Does not apear to initialize when I boot up the board.
There are 2 problems I see, the 1st:
- Many Times there is a timeout (default 30secs) in SDMMC_GetCmdResp1. This is from an initial call to f_open(). I have seen other threads about this being an issue with RTOS. But I am not using RTOS. This happens when I open I file on bootup.
- Sometimes the above works fine, and my first call to FRESULT res = f_lseek(&file, address); Returns FR_DISK_ERR. this is right after a "successful" opening of the file. (with no errors thrown there)
- sometimes no errors are thrown and everything is initialized properly.
My current hack way of handling this is to reboot the entire board until non of these startup errors happen. Which for whatever reason sometimes there are no errors and things run fine.
I am using the DMA template for FatFs, and Hardware Flow Control Enabled. Any Ideas on why this sometimes would fail? My MMC clock rate is 40mhz. Everything is 3.3v. I have tried lower clock rates but that does not seem to help.
Power Cycling does not always start correctly either.
Thanks for any Ideas or help,
Trevor
