Sd Firmware Driver Api Description; How To Use This Driver - ST STM32F2 User Manual

Description of stm32f2 hal and low layer drivers
Hide thumbs Also See for STM32F2:
Table of Contents

Advertisement

UM1940
__IO uint8_t HAL_SD_CardStatusTypeDef::SpeedClass
Carries information about the speed class of the card
__IO uint8_t HAL_SD_CardStatusTypeDef::PerformanceMove
Carries information about the card's performance move
__IO uint8_t HAL_SD_CardStatusTypeDef::AllocationUnitSize
Carries information about the card's allocation unit size
__IO uint16_t HAL_SD_CardStatusTypeDef::EraseSize
Determines the number of AUs to be erased in one operation
__IO uint8_t HAL_SD_CardStatusTypeDef::EraseTimeout
Determines the timeout for any number of AU erase
__IO uint8_t HAL_SD_CardStatusTypeDef::EraseOffset
Carries information about the erase offset
41.2

SD Firmware driver API description

41.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 (SDIO and GPIO) are performed by the
user in HAL_SD_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 SDIO memories which uses the HAL SDIO driver
functions to interface with SD and uSD cards devices. It is used as follows:
1.
Initialize the SDIO low level resources by implement the HAL_SD_MspInit() API:
a.
b.
c.
d.
e.
Enable the SDIO interface clock using __HAL_RCC_SDIO_CLK_ENABLE();
SDIO pins configuration for SD card
Enable the clock for the SDIO GPIOs using the functions
__HAL_RCC_GPIOx_CLK_ENABLE();
Configure these SDIO 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_SD_ReadBlocks_DMA() and HAL_SD_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 SDIO and DMA interrupt priorities using functions
HAL_NVIC_SetPriority(); DMA priority is superior to SDIO's priority
Enable the NVIC DMA and SDIO IRQs using function
HAL_NVIC_EnableIRQ()
SDIO interrupts are managed using the macros __HAL_SD_ENABLE_IT()
and __HAL_SD_DISABLE_IT() inside the communication process.
SDIO interrupts pending bits are managed using the macros
__HAL_SD_GET_IT() and __HAL_SD_CLEAR_IT()
NVIC configuration if you need to use interrupt process
(HAL_SD_ReadBlocks_IT() and HAL_SD_WriteBlocks_IT() APIs).
Configure the SDIO interrupt priorities using function
HAL_NVIC_SetPriority();
Enable the NVIC SDIO IRQs using function HAL_NVIC_EnableIRQ()
SDIO interrupts are managed using the macros __HAL_SD_ENABLE_IT()
and __HAL_SD_DISABLE_IT() inside the communication process.
DocID028236 Rev 2
HAL SD Generic Driver
513/1371

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F2 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF