2018-11-08 04:27 AM
The f_mount() function initially returns FR_NOT_READY then on subsequent attempts to mount the SD card the f_mount() function returns FR_DISK_ERR.
There seems to be a lot of posts with a similar (or same) problem on the STM32F4.
I have followed several "suggested" fixes for these but none work.
I have tried both using and not using DMA - the results are the same.
Initially I was developing on a bespoke PCB with an STM32F769BI MCU but decided to try out a very simple project on the STM32F679i-Disco board. Both have the same issue.
FATFS configuration using the default settings
SDMMC1 Clock set to 48MHz - I have tried several clock divide factors
I've also tried using pull-ups on D0..D3 (and without pull ups also)
code snippet from the most simplest of projects...
//declared at global filescope
FATFS myFatFS;
FIL myFile;
UINT testByte;
MX_FATFS_Init();
if(f_mount(&myFatFS, SDPath, 1)==FR_OK)
{
HAL_GPIO_TogglePin(LD_USER2_GPIO_Port, LD_USER2_Pin);
char myPath[] = "WRITE1.TXT\0";
f_open(&myFile, myPath, FA_WRITE | FA_CREATE_ALWAYS);
char myData[] = "Hello World\0";
f_write(&myFile, myData, sizeof(myData), &testByte);
f_close(&myFile);
HAL_Delay(1000);
}
else
{
HAL_GPIO_TogglePin(LD_USER1_GPIO_Port, LD_USER1_Pin);
}
Any help will be gratefully received.
Andy