HAL MMC Generic Driver
__IO uint16_t HAL_MMC_CardStatusTypeDef::EraseSize
Determines the number of AUs to be erased in one operation
__IO uint8_t HAL_MMC_CardStatusTypeDef::EraseTimeout
Determines the timeout for any number of AU erase
__IO uint8_t HAL_MMC_CardStatusTypeDef::EraseOffset
Carries information about the erase offset
28.2
MMC Firmware driver API description
28.2.1
How to use this driver
This driver implements a high level communication layer for read and write from/to this
memory. The needed STM32 hardware resources (SDMMC and GPIO) are performed by
the user in HAL_MMC_MspInit() function (MSP layer). Basically, the MSP layer
configuration should be the same as we provide in the examples. You can easily tailor this
configuration according to hardware resources.
This driver is a generic layered driver for SDMMC memories which uses the HAL SDMMC
driver functions to interface with MMC and eMMC cards devices. It is used as follows:
1.
Initialize the SDMMC low level resources by implement the HAL_MMC_MspInit() API:
a.
b.
c.
d.
e.
2.
At this stage, you can perform MMC read/write/erase operations after MMC card
initialization
356/1371
Enable the SDMMC interface clock using
__HAL_RCC_SDMMC_CLK_ENABLE();
SDMMC pins configuration for MMC card
Enable the clock for the SDMMC GPIOs using the functions
__HAL_RCC_GPIOx_CLK_ENABLE();
Configure these SDMMC pins as alternate function pull-up using
HAL_GPIO_Init() and according to your pin assignment;
DMA Configuration if you need to use DMA process
(HAL_MMC_ReadBlocks_DMA() and HAL_MMC_WriteBlocks_DMA() APIs).
Enable the DMAx interface clock using
__HAL_RCC_DMAx_CLK_ENABLE();
Configure the DMA using the function HAL_DMA_Init() with predeclared and
filled.
NVIC configuration if you need to use interrupt process when using DMA transfer.
Configure the SDMMC and DMA interrupt priorities using functions
HAL_NVIC_SetPriority(); DMA priority is superior to SDMMC's priority
Enable the NVIC DMA and SDMMC IRQs using function
HAL_NVIC_EnableIRQ()
SDMMC interrupts are managed using the macros
__HAL_MMC_ENABLE_IT() and __HAL_MMC_DISABLE_IT() inside the
communication process.
SDMMC interrupts pending bits are managed using the macros
__HAL_MMC_GET_IT() and __HAL_MMC_CLEAR_IT()
NVIC configuration if you need to use interrupt process
(HAL_MMC_ReadBlocks_IT() and HAL_MMC_WriteBlocks_IT() APIs).
Configure the SDMMC interrupt priorities using function
HAL_NVIC_SetPriority();
Enable the NVIC SDMMC IRQs using function HAL_NVIC_EnableIRQ()
SDMMC interrupts are managed using the macros
__HAL_MMC_ENABLE_IT() and __HAL_MMC_DISABLE_IT() inside the
communication process.
SDMMC interrupts pending bits are managed using the macros
__HAL_MMC_GET_IT() and __HAL_MMC_CLEAR_IT()
DocID028236 Rev 2
UM1940
Need help?
Do you have a question about the STM32F2 and is the answer not in the manual?
Questions and answers