2021-04-04 03:26 PM
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
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 ?
2021-04-05 12:17 AM
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:
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
2021-04-05 01:06 AM
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.