2015-09-09 05:12 AM
In the HAL Code the Capacity is calculated differently for Low Speed and High Speed Cards.
Low Speed cards use this code:pCardInfo->CardCapacity = (pCardInfo->SD_csd.DeviceSize + 1) ; pCardInfo->CardCapacity *= (1 << (pCardInfo->SD_csd.DeviceSizeMul + 2)); pCardInfo->CardBlockSize = 1 << (pCardInfo->SD_csd.RdBlockLen); pCardInfo->CardCapacity *= pCardInfo->CardBlockSize;While High Speed Cards use this:pCardInfo->CardCapacity = ((pCardInfo->SD_csd.DeviceSize + 1)) * 512 * 1024;It should be either:pCardInfo->CardCapacity = ((uint64_t) (pCardInfo->SD_csd.DeviceSize + 1)) * 512 * 1024;orpCardInfo->CardCapacity = (pCardInfo->SD_csd.DeviceSize + 1));pCardInfo->CardCapacity *= 1024;pCardInfo->CardCapacity *= pCardInfo->CardBlockSize;To avoid the overflow in uint32_t, because DeviceSize is a uint32_t itself.- Robert #sd #hal #bug #!bug2015-09-11 06:58 AM
Hi Robert,
Could you precise in which HAL library you have found the issue. So, we can verify it.-Syrine-2015-10-12 05:54 AM
Hi Syrine,
I am referring to the HAL SD library (stm32f2xx_hal_sd.c in my case) in functionHAL_SD_ErrorTypedef
HAL_SD_Get_CardInfo(
SD_HandleTypeDef*hsd,
HAL_SD_CardInfoTypedef*pCardInfo)
- Robert2015-10-13 01:13 AM
Hi Robert,
I will check this issue with our development team & come back to you.Sorry for the inconvenience may bring.-Syrine-2016-04-06 05:42 AM
2016-04-06 06:36 AM
Hi lori.b,
•Please check the last release of the STM32CubeF2 firmware package (1.3.0), the issue is already fixed.•Regarding your question about MMC, I confirm that there is a plan to support it on HAL but the driver is not yet available.-Syrine-2016-04-06 06:59 AM
2016-05-24 01:33 AM
Any update on this?
Is there a realease date for the MMC driver?