Skip to main content
Graduate II
March 28, 2025
Solved

How to use MDMA for QuadSPI in STM32H7 series

  • March 28, 2025
  • 1 reply
  • 491 views

Hello Guys!

Im using STM32H743IITx MCU and W25Q128 QuadSPI. i want to know that how to use MDMA feature for QuadSPI.

Thanks.

    This topic has been closed for replies.
    Best answer by Saket_Om

    Hello @jumman_JHINGA 

    Please refer to the MDMA configuration in the example found at 'Projects/STM32H743I-EVAL/Examples/QSPI/QSPI_ReadWriteDual_DMA'.

    /*##-4- Configure the DMA channel ###########################################*/
     /* Enable MDMA clock */
     /* Input MDMA */
     /* Set the parameters to be configured */ 
     hmdma.Init.Request = MDMA_REQUEST_QUADSPI_FIFO_TH;
     hmdma.Init.TransferTriggerMode = MDMA_BUFFER_TRANSFER;
     hmdma.Init.Priority = MDMA_PRIORITY_HIGH;
     hmdma.Init.Endianness = MDMA_LITTLE_ENDIANNESS_PRESERVE;
     
     hmdma.Init.SourceInc = MDMA_SRC_INC_BYTE;
     hmdma.Init.DestinationInc = MDMA_DEST_INC_DISABLE;
     hmdma.Init.SourceDataSize = MDMA_SRC_DATASIZE_BYTE;
     hmdma.Init.DestDataSize = MDMA_DEST_DATASIZE_BYTE;
     hmdma.Init.DataAlignment = MDMA_DATAALIGN_PACKENABLE;
     hmdma.Init.BufferTransferLength = 4;
     hmdma.Init.SourceBurst = MDMA_SOURCE_BURST_SINGLE;
     hmdma.Init.DestBurst = MDMA_DEST_BURST_SINGLE;
     
     hmdma.Init.SourceBlockAddressOffset = 0;
     hmdma.Init.DestBlockAddressOffset = 0;
    
     hmdma.Instance = MDMA_Channel1;
    
     /* Associate the DMA handle */
     __HAL_LINKDMA(hqspi, hmdma, hmdma);
     
     /* DeInitialize the MDMA Stream */
     HAL_MDMA_DeInit(&hmdma); 
     /* Initialize the MDMA stream */
     HAL_MDMA_Init(&hmdma);
    
     /* Enable and set QuadSPI interrupt to the lowest priority */
     HAL_NVIC_SetPriority(MDMA_IRQn, 0x00, 0);
     HAL_NVIC_EnableIRQ(MDMA_IRQn);

     

    1 reply

    Saket_OmAnswer
    Technical Moderator
    March 28, 2025

    Hello @jumman_JHINGA 

    Please refer to the MDMA configuration in the example found at 'Projects/STM32H743I-EVAL/Examples/QSPI/QSPI_ReadWriteDual_DMA'.

    /*##-4- Configure the DMA channel ###########################################*/
     /* Enable MDMA clock */
     /* Input MDMA */
     /* Set the parameters to be configured */ 
     hmdma.Init.Request = MDMA_REQUEST_QUADSPI_FIFO_TH;
     hmdma.Init.TransferTriggerMode = MDMA_BUFFER_TRANSFER;
     hmdma.Init.Priority = MDMA_PRIORITY_HIGH;
     hmdma.Init.Endianness = MDMA_LITTLE_ENDIANNESS_PRESERVE;
     
     hmdma.Init.SourceInc = MDMA_SRC_INC_BYTE;
     hmdma.Init.DestinationInc = MDMA_DEST_INC_DISABLE;
     hmdma.Init.SourceDataSize = MDMA_SRC_DATASIZE_BYTE;
     hmdma.Init.DestDataSize = MDMA_DEST_DATASIZE_BYTE;
     hmdma.Init.DataAlignment = MDMA_DATAALIGN_PACKENABLE;
     hmdma.Init.BufferTransferLength = 4;
     hmdma.Init.SourceBurst = MDMA_SOURCE_BURST_SINGLE;
     hmdma.Init.DestBurst = MDMA_DEST_BURST_SINGLE;
     
     hmdma.Init.SourceBlockAddressOffset = 0;
     hmdma.Init.DestBlockAddressOffset = 0;
    
     hmdma.Instance = MDMA_Channel1;
    
     /* Associate the DMA handle */
     __HAL_LINKDMA(hqspi, hmdma, hmdma);
     
     /* DeInitialize the MDMA Stream */
     HAL_MDMA_DeInit(&hmdma); 
     /* Initialize the MDMA stream */
     HAL_MDMA_Init(&hmdma);
    
     /* Enable and set QuadSPI interrupt to the lowest priority */
     HAL_NVIC_SetPriority(MDMA_IRQn, 0x00, 0);
     HAL_NVIC_EnableIRQ(MDMA_IRQn);