Problem in open SD card using FATFS after unmount and mount again (FR_NOT_ENABLED)
Hi.
I use a custom board for my application. The MCU is STM32F746 and my IDE is STM32cubeide. My board has a SD card with SDIO connection and I use RTOS in my application. After power on , mounting and opening are OK but when I reject SD card and insert it again, after correct mounting "F_OPEN" function return "FR_NOT_ENABLED" error. After rejecting of SD card, unmount it. All of this code is in one thread.
My Mounting code is:
FATFS_LinkDriver(&SD_Driver,SDPath);
HAL_Delay(200);
res = f_mount(&SDFatFS, (TCHAR const*)SDPath, 1);
if (res == FR_OK)
{
SD_CARD_Mount_Status = 1;
RS485_Write_Read(RS485_Write);
printf("Mount OK\n\r");
RS485_Write_Read(RS485_Read);
}
else
{
SD_CARD_Mount_Status = 0;
RS485_Write_Read(RS485_Write);
printf("Mount Failed = %u\n\r",res);
RS485_Write_Read(RS485_Read);
}
My Unmounting code is:
res = f_mount(NULL, (TCHAR const*)SDPath, 1);
HAL_Delay(200);
FATFS_UnLinkDriver(SDPath);
SD_CARD_Mount_Status = 0;
RS485_Write_Read(RS485_Write);
printf("Unmount OK\n\r");
RS485_Write_Read(RS485_Read);
Thanks
