Associate III
November 6, 2019
Question
SDMMC 4 bit mode with DMA (STM32L4R7)
- November 6, 2019
- 1 reply
- 983 views
Hi,
I'm trying to configure SDMMC module using DMA since I'm using FREERTOS. But in STM32CUBEMX, there is no option to configure DMA settings under FATfs.
So, I'm trying to setup the DMA configuration through code.
I can see that there is no definition for DMA SDMCC request in stm32l4xx_hal_dma.h .
When I trying to use the following line, I get the error message says that "no member named hdmarx in __SD_Handle_Typedef"
__HAL_LINKDMA(&hsd1,hdmarx,hdma_sdmmc1_rx); DMA_HandleTypeDef hdma_sdmmc1_rx;
DMA_HandleTypeDef hdma_sdmmc1_tx;
static DMA_HandleTypeDef hdmatx;
static DMA_HandleTypeDef hdmarx;
/* DMA controller clock enable */
__HAL_RCC_DMAMUX1_CLK_ENABLE();
__HAL_RCC_DMA2_CLK_ENABLE();
/* SDMMC1 DMA Init */
/* SDMMC1_RX Init */
hdma_sdmmc1_rx.Instance = DMA2_Channel4;
hdma_sdmmc1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
hdma_sdmmc1_rx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_sdmmc1_rx.Init.MemInc = DMA_MINC_ENABLE;
hdma_sdmmc1_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
hdma_sdmmc1_rx.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
hdma_sdmmc1_rx.Init.Mode = DMA_NORMAL;
hdma_sdmmc1_rx.Init.Priority = DMA_PRIORITY_LOW;
hdma_sdmmc1_rx.Init.Request = DMA_REQUEST_UART4_RX;
if (HAL_DMA_Init(&hdma_sdmmc1_rx) != HAL_OK)
{
Error_Handler();
}
__HAL_LINKDMA(&hsd1,hdmarx,hdma_sdmmc1_rx);
/* SDMMC1_TX Init */
hdma_sdmmc1_tx.Instance = DMA2_Channel5;
hdma_sdmmc1_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_sdmmc1_tx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_sdmmc1_tx.Init.MemInc = DMA_MINC_ENABLE;
hdma_sdmmc1_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
hdma_sdmmc1_tx.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
hdma_sdmmc1_tx.Init.Mode = DMA_NORMAL;
hdma_sdmmc1_tx.Init.Priority = DMA_PRIORITY_LOW;
if (HAL_DMA_Init(&hdma_sdmmc1_tx) != HAL_OK)
{
Error_Handler();
}
__HAL_LINKDMA(&hsd1,hdmatx,hdma_sdmmc1_tx);Please help me to configure SDMMC using DMA
