2019-01-05 12:21 PM
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.
2019-01-05 02:09 PM
Is this a 1GB or less sized card?
2019-01-05 02:11 PM
No, it is a 8GB SDHC card from Kingston
2019-01-09 10:31 AM
I fixed the problem, I had to add SDIO DMA streams since these are used by default
2019-10-01 03:50 AM
Hi,
currently I am facing the same problem. I manually added the DMA streams in the CubeMX GUI. Unfortunately, this didn't solve the problem. Anyway, I do not see, why adding DMA streams should help at this point, as these streams are used for the read and write block functions. If I understood the code correctly, the SDIO interface directly sends commands and watches for some flags to evaluate during this init sequence. Did you change any other things that might had an influence on that issue.
Best regards,
Daniel