Returns information the information of the card which are stored on the CSD register.
2283 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) 2284 uint32_t block_nbr = 0;
2287 pCSD->
CSDStruct = (uint8_t)((hmmc->CSD[0] & 0xC0000000U) >> 30U);
2289 pCSD->
SysSpecVersion = (uint8_t)((hmmc->CSD[0] & 0x3C000000U) >> 26U);
2291 pCSD->
Reserved1 = (uint8_t)((hmmc->CSD[0] & 0x03000000U) >> 24U);
2293 pCSD->
TAAC = (uint8_t)((hmmc->CSD[0] & 0x00FF0000U) >> 16U);
2295 pCSD->
NSAC = (uint8_t)((hmmc->CSD[0] & 0x0000FF00U) >> 8U);
2297 pCSD->
MaxBusClkFrec = (uint8_t)(hmmc->CSD[0] & 0x000000FFU);
2299 pCSD->
CardComdClasses = (uint16_t)((hmmc->CSD[1] & 0xFFF00000U) >> 20U);
2301 pCSD->
RdBlockLen = (uint8_t)((hmmc->CSD[1] & 0x000F0000U) >> 16U);
2303 pCSD->
PartBlockRead = (uint8_t)((hmmc->CSD[1] & 0x00008000U) >> 15U);
2305 pCSD->
WrBlockMisalign = (uint8_t)((hmmc->CSD[1] & 0x00004000U) >> 14U);
2307 pCSD->
RdBlockMisalign = (uint8_t)((hmmc->CSD[1] & 0x00002000U) >> 13U);
2309 pCSD->
DSRImpl = (uint8_t)((hmmc->CSD[1] & 0x00001000U) >> 12U);
2313 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) 2319 if(hmmc->MmcCard.CardType == MMC_LOW_CAPACITY_CARD)
2322 pCSD->
DeviceSize = (((hmmc->CSD[1] & 0x000003FFU) << 2U) | ((hmmc->CSD[2] & 0xC0000000U) >> 30U));
2332 pCSD->
DeviceSizeMul = (uint8_t)((hmmc->CSD[2] & 0x00038000U) >> 15U);
2334 hmmc->MmcCard.BlockNbr = (pCSD->
DeviceSize + 1U) ;
2335 hmmc->MmcCard.BlockNbr *= (1UL << ((pCSD->
DeviceSizeMul & 0x07U) + 2U));
2336 hmmc->MmcCard.BlockSize = (1UL << (pCSD->
RdBlockLen & 0x0FU));
2338 hmmc->MmcCard.LogBlockNbr = (hmmc->MmcCard.BlockNbr) * ((hmmc->MmcCard.BlockSize) / 512U);
2339 hmmc->MmcCard.LogBlockSize = 512U;
2340 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) 2342 else if(hmmc->MmcCard.CardType == MMC_HIGH_CAPACITY_CARD)
2344 hmmc->MmcCard.BlockNbr = block_nbr;
2345 hmmc->MmcCard.LogBlockNbr = hmmc->MmcCard.BlockNbr;
2346 hmmc->MmcCard.BlockSize = 512U;
2347 hmmc->MmcCard.LogBlockSize = hmmc->MmcCard.BlockSize;
2352 __HAL_MMC_CLEAR_FLAG(hmmc, SDMMC_STATIC_FLAGS);
2353 hmmc->ErrorCode |= HAL_MMC_ERROR_UNSUPPORTED_FEATURE;
2354 hmmc->State = HAL_MMC_STATE_READY;
2359 pCSD->
EraseGrSize = (uint8_t)((hmmc->CSD[2] & 0x00004000U) >> 14U);
2361 pCSD->
EraseGrMul = (uint8_t)((hmmc->CSD[2] & 0x00003F80U) >> 7U);
2367 pCSD->
ManDeflECC = (uint8_t)((hmmc->CSD[3] & 0x60000000U) >> 29U);
2369 pCSD->
WrSpeedFact = (uint8_t)((hmmc->CSD[3] & 0x1C000000U) >> 26U);
2371 pCSD->
MaxWrBlockLen= (uint8_t)((hmmc->CSD[3] & 0x03C00000U) >> 22U);
2379 pCSD->
FileFormatGroup = (uint8_t)((hmmc->CSD[3] & 0x00008000U) >> 15U);
2381 pCSD->
CopyFlag = (uint8_t)((hmmc->CSD[3] & 0x00004000U) >> 14U);
2383 pCSD->
PermWrProtect = (uint8_t)((hmmc->CSD[3] & 0x00002000U) >> 13U);
2385 pCSD->
TempWrProtect = (uint8_t)((hmmc->CSD[3] & 0x00001000U) >> 12U);
2387 pCSD->
FileFormat = (uint8_t)((hmmc->CSD[3] & 0x00000C00U) >> 10U);
2389 pCSD->
ECC= (uint8_t)((hmmc->CSD[3] & 0x00000300U) >> 8U);
2391 pCSD->
CSD_CRC = (uint8_t)((hmmc->CSD[3] & 0x000000FEU) >> 1U);
__IO uint8_t WrProtectGrSize
__IO uint8_t TempWrProtect
__IO uint8_t MaxWrCurrentVDDMax
__IO uint8_t WrBlockMisalign
__IO uint8_t ContentProtectAppli
__IO uint8_t PartBlockRead
__IO uint8_t RdBlockMisalign
static HAL_StatusTypeDef MMC_ReadExtCSD(MMC_HandleTypeDef *hmmc, uint32_t *pBlockNbr, uint32_t Timeout)
Reads extended CSD register to get the sectors number of the device.
__IO uint8_t MaxBusClkFrec
__IO uint8_t MaxRdCurrentVDDMax
__IO uint8_t MaxWrBlockLen
__IO uint8_t SysSpecVersion
__IO uint16_t CardComdClasses
__IO uint8_t WrProtectGrEnable
__IO uint8_t MaxWrCurrentVDDMin
__IO uint8_t DeviceSizeMul
__IO uint8_t MaxRdCurrentVDDMin
__IO uint8_t WriteBlockPaPartial
__IO uint8_t FileFormatGroup
__IO uint8_t PermWrProtect