2024-07-20 11:46 PM
I generated a project using STM32CubeMX, in which I tried to use SDIO and FatFS. However, it doesn't seem to be working properly. I tried three cards. When executing SD_Driver.disk_initialize(0); the 256MB card (manufacturer unknown) and the 16GB card (Sandisk) would hang for a long time (stuck in the loop at static uint32_t SD_PowerON(SD_HandleTypeDef *hsd)) and return an error with a value of 1. Tracking the issue led to HAL_SD_ERROR_INVALID_VOLTRANGE. Another 512MB card (manufacturer unknown) could pass the initialization, but when reading the information, the capacity shown was only 13MB. Consequently, when trying to use FatFS with f_mount(&fs, "0:/", 1); an error occurred. I tried adjusting the SDIOCLK clock divide factor, but it had no effect.
The cards read normally on the computer and can be accessed normally in SPI mode (including using FatFS in SPI mode, which is also normal, but the speed is too slow to meet the requirements). This issue occurs on both the STM32F411RET6 and STM32F401RET6.
I'm not sure what is causing this issue.
cubemx version: 6.11.1
compiler:arm-none-eabi-gcc ,gcc version 12.3.1 20230626 (GNU Tools for STM32 12.3.rel1.20240306-1730)