cancel
Showing results for 
Search instead for 
Did you mean: 

How to use MDMA for QuadSPI in STM32H7 series

JJhin.1
Senior II

Hello Guys!

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

Thanks.

1 REPLY 1
Saket_Om
ST Employee

Hello @JJhin.1 

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);

 

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar