cancel
Showing results for 
Search instead for 
Did you mean: 

SD CARD Configuration using STM32CubeIDE

MHass.2
Associate III

I use STM32F407 Discovery board with STM32CubeIDE Version: 1.6.1 (Latest version) and I want to setup SD Card.

I adjusted the RCC clock and selected SDIO 4 bit wide bus bit and FATFS (SD Card ) and when i generate the code I get this warning message

0693W000008yfYuQAI.png Also I tried this code in main but there is not any response

 FATFS myfat ;

 FIL myfile ;

 UINT mybytes;

 if( f_mount(&myfat , SDPath , 1) == FR_OK)

 {

 char mypath[] = "Mido.txt\0";

 f_open(&myfile , mypath , FA_WRITE | FA_CREATE_ALWAYS );

 char data[] = "I am working ";

 f_write(&myfile , data , sizeof(data) , &mybytes);

 f_close(&myfile);

 }

Can anyone help me to fix this warning ?

2 REPLIES 2
Khouloud ZEMMELI
ST Employee

Hello @MHass.2​ 

Thanks for your post,

In fact, you need to select a GPIO input then add it into FATFS configuration/ Platform Settings to avoid this warning (as mentioned in the image below), then the warning message will disappear:

0693W000008yfpaQAA.png 

Hope my answer helped you 🙂 when your question is answered please close this topic by choosing Select as Best, this will help other users find that answer faster.

Thanks, Khouloud

Hello

This warning says that CD pin Card Detect pin is left unconnected.. In this case fatfs assumes that card is always inserted. Just ignore it.

>> Also I tried this code in main but there is not any response

Note, that card must be formated with fat32 .

Assuming that "any response " means f_mount failed, this is a classic error.

A workaround (not a solution) is to decrease the clock rate by increasing the divide factor from cube MX (eg set to 8 for 4.8MHZ clock).

After you have a "just working" code, spend some time to dig the code , the community reports, and general the internet to find the best solution.