SDIO problem when using FatFS on STM32F413
Hi, I am currently working on a project where I will have to log data to an µSD card using a STM32F413. I created a project in STM32CubeMX (version 5.0.0) and setup SDIO (currently in SD 1bit mode, but I also tried 4 bit mode). I also set up FatFS in CubeMX. After generating the code and trying to mount the sd card:
FRESULT mountresult = f_mount(&SDFatFS, "", 1);
if(mountresult == FR_OK)
{
}
else{
HAL_GPIO_TogglePin(LED4_GPIO_Port,LED4_Pin);
if(mountresult == FR_NOT_READY){
HAL_GPIO_WritePin(LED2_GPIO_Port,LED2_Pin,GPIO_PIN_SET);
}
}LED 2 and 4 light up, meaning that the result was FR_NOT_READY.
After digging deeper I find the problem situates at the BSP_SD_Init(void) function,
here HAL_SD_Init(SD_HandleTypeDef *hsd) is called,
in this function HAL_SD_InitCard(SD_HandleTypeDef *hsd) is called,
at last SD_PowerON(hsd); is called
finally the error situates here: (lines 2560-2565 in stm32f4xx_hal_sd.c)
/* SEND CMD55 APP_CMD with RCA as 0 */
errorstate = SDMMC_CmdAppCommand(hsd->Instance, 0U);
if(errorstate != HAL_SD_ERROR_NONE)
{
return HAL_SD_ERROR_UNSUPPORTED_FEATURE;
}The SDMMC_CmdAppCommand returns an error state, meaning that it is 'an unsupported feature'. However I can't find what the meaning of this error is and how I would be able to fix it.
