AnsweredAssumed Answered

SD Card Cannot be mounted successfully using the Code generated by CubeMX

Question asked by Lingjun Kong on Jul 17, 2017
Latest reply on Jul 17, 2017 by Lingjun Kong

to use the FATFs on the STM32F746NG-Discovery Board, I generate the code using the CubeMX.

this is my main.c file.

during the debugging, I found that the value returned by the f_mount is FR_NOT_READY, so that the function will always fall into Error_Handle();


but with the same board and sd card, the demo project:


it could work well.


I want to know whether there is any other thing I've forgot to add to the project? Or the code generator itself has a big bug?


the method i generate the code is:


  1. select the board

2. config the pinout

and choose the FATFS

3. resolve the clock nothing

5. change the heap size

7. and generate the project project and add this line to main.c


FATFS SDFatFs; /* File system object for SD card logical drive */
FIL MyFile; /* File object */
char SDPath[4]; /* SD card logical drive path */


if(f_mount(&SDFatFs, (TCHAR const*)SDPath, 1) != FR_OK)



and rebuilt it, debug, falls into error_handle.