Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DMA Channel doesn't work (+SDMMC)
- Request Number: TECH040009
- Type: Technical
- Severity: Medium
- State: SOLUTION PROPOSED
- Product : Microcontrollers
- STM32 32-bit ARM Cortex MCUs
- STM32 Ultra Low Power MCUs
- STM32L476RG
- Description: Package: STM32-L476RG (Nucleo)
- Firmware: CubeMX 1.8.1
- When using SDMMC (1-Bit) + DMA, the DMA2 Channel 4 doesn't seem to work.
- When SDMMC_TX or _RX is put on channel 4, the SDMMC unit does not transmit anything (on cmd, data line, verified by oscilloscope).
- When SDMMC_TX or _RX is put on channel 5, the SDMMC unit works as expected.
- Thank you for any feedback!
- Resolution Summary: SOLUTION PROPOSED BY SUPPORTER - 21/9/2017 11:54:26 :
- ---------------------------------------------------------------------------------
- Dear Customer,
- I could reproduce your issue on STM32L476G eval board creating a project from CubeMx.
- I investigated looking at example on cubemx firmware project:
- xxx\STM32Cube\Repository\STM32Cube_FW_L4_V1.8.1\Drivers\BSP\STM32L476G_EVAL\stm32l476g_eval_sd.c
- I succeed to make work channel 4 and/or channel 5 for tx and rx by doing the following changes .
- uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr,
- uint32_t NumOfBlocks)
- {
- HAL_DMA_Abort(&hdma_sdmmc1_tx);
- HAL_DMA_Abort(&hdma_sdmmc1_rx);
- /* Deinitialize the Channel for new transfer */
- HAL_DMA_DeInit(&hdma_sdmmc1_tx);
- HAL_DMA_DeInit(&hdma_sdmmc1_rx);
- HAL_DMA_Init(&hdma_sdmmc1_rx);
- ..
- uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr,
- uint32_t NumOfBlocks)
- {
- uint32_t tickstart = HAL_GetTick();
- HAL_DMA_Abort(&hdma_sdmmc1_tx);
- HAL_DMA_Abort(&hdma_sdmmc1_rx);
- /* Deinitialize the Channel for new transfer */
- HAL_DMA_DeInit(&hdma_sdmmc1_tx);
- HAL_DMA_DeInit(&hdma_sdmmc1_rx);
- /* Configure the DMA Channel */
- HAL_DMA_Init(&hdma_sdmmc1_tx);
- void DMA2_Channelx_IRQHandler(void)
- {
- /* USER CODE BEGIN DMA2_Channel5_IRQn 0 */
- if((hsd1.Context == (SD_CONTEXT_DMA | SD_CONTEXT_READ_SINGLE_BLOCK)) ||
- (hsd1.Context == (SD_CONTEXT_DMA | SD_CONTEXT_READ_MULTIPLE_BLOCK)))
- {
- HAL_DMA_IRQHandler(&hdma_sdmmc1_rx);
- }
- else if((hsd1.Context == (SD_CONTEXT_DMA | SD_CONTEXT_WRITE_SINGLE_BLOCK)) ||
- (hsd1.Context == (SD_CONTEXT_DMA | SD_CONTEXT_WRITE_MULTIPLE_BLOCK)))
- {
- HAL_DMA_IRQHandler(&hdma_sdmmc1_tx);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement